在Authorizenet SDK 1.1.8版的PHP有没有办法充电使用客户付款资料卡?

问题描述 投票:1回答:1

我一直在向上和向下通过SDK代码,并有增加的客户资料和付款资料,对他们的能力,但我看不到任何地方,在那里我可以收取卡或创建一个从客户资料和客户付款资料订阅。有没有人有这对于无论是创建订阅,或收取一定的卡,使用PHP SDK的答案。请理解,让我用AuthorizeNet的Web API的交互式网络的例子是没有帮助这里。该要求是它必须通过PHP SDK来完成,因为我们不能有过去的客户资料和客户付款资料创作的点卡用户交互。

payment authorize.net authorize.net-cim
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"

;

© www.soinside.com 2019 - 2024. All rights reserved.