colinbm/sagepayadminapi-php

0.0.1 2016-02-27 17:25 UTC

This package is not auto-updated.

Last update: 2024-09-20 20:43:23 UTC


README

提供了一种访问管理API的简单方法。您可以使用报告和管理API文档中指定的任何命令作为方法。传递一个包含要发送元素的数组,具体细节请参阅文档。

示例

获取单个交易

$adminapi = new SagePayAdminApi('vendor', 'username', 'password');
$transaction = $adminapi->getTransactionDetail(array('vendortxcode' => '12345678'));
echo "Third Man Status: {$transaction->t3maction} ({$transaction->t3mscore})\n";

获取2014年3月的Visa和万事达卡退款

$adminapi = new SagePayAdminApi('vendor', 'username', 'password');

// SagePay will only return 50 rows at a time so loop until we have them all.
do {
	$list = $adminapi->getTransactionList(array(
		'startdate'      => '01/03/2014 00:00:00',
		'enddate'        => '01/04/2014 00:00:00',
		'startrow'       => $end_row + 1,
		'txtypes'        => array(
			'txtype' => 'REFUND',
		),
		'paymentsystems' => array(
			'paymentsystem' => array(
				'MC',
				'Visa',
			)
		),
	) );

	// Check response is OK
	if ( '0000' != $list->errorcode ) {
		die( $list->errorcode . ' : ' . $list->error );
	}
	$total_rows = (int) $list->transactions->totalrows;
	$end_row = (int) $list->transactions->endrow;

	foreach ( $list->transactions->transaction as $transaction ) {
		var_dump( $transaction );
	}
} while ( $end_row < $total_rows );