1

我一直在使用 SDK 代码,并且能够为他们添加客户资料和付款资料,但我看不到任何地方,我可以在哪里收取卡或从客户资料和客户付款资料创建订阅。有没有人知道使用 PHP SDK 创建订阅或充值卡的问题。请理解,在这里给我一个使用 AuthorizeNet 的 Web API 的交互式 Web 示例没有帮助。要求是必须通过 PHP SDK 完成,因为我们不能在创建客户资料和客户付款资料之后进行卡用户交互。

4

1 回答 1

1

首先需要定义用于 SDK 请求的正常凭据

if (!defined("AUTHORIZENET_API_LOGIN_ID")) define("AUTHORIZENET_API_LOGIN_ID", {authorizenet_api_login_id};
if (!defined("AUTHORIZENET_TRANSACTION_KEY")) define("AUTHORIZENET_TRANSACTION_KEY",  {authorizenet_transaction_key};

然后创建事务并设置字段。

$transaction = new AuthorizeNetTransaction;
$transaction->amount = $amount;
$transaction->customerProfileId = $customerProfileId;
$transaction->customerPaymentProfileId = $customerPaymentProfileId;
// next line may be optional depending on your situation
$transaction->customerShippingAddressId = $customerShippingAddressId;

然后处理交易

$request = new AuthorizeNetCIM;
    $response = $request->createCustomerProfileTransaction("AuthCapture", $transaction);

if ($response->xml->messages->resultCode=="Ok") echo "It Was Approved"

;

于 2015-04-17T00:10:08.763 回答