我想使用上一个事务中已创建的令牌测试付款,但无法使用SOAP Toolkit API真正找到一种方法。
我在他们的文档中找到了这个:
Requesting an On-Demand Transaction
An on-demand transaction is a real-time transaction using the details stored in a customer profile. On-demand transactions that you can request are:
Credit cards—authorization, sale (an authorization and capture), and credit.
Electronic checks—debit and credit.
PINless debits—debit.
To request an on-demand sale transaction:
Step 1 Set the ccAuthService_run service field to true.
Step 2 Set the ccCaptureService_run service field to true.
Step 3 Include the following fields in the request:
merchantID
merchantReferenceCode
purchaseTotals_currency
purchaseTotals_grandTotalAmount
recurringSubscriptionInfo_subscriptionID
所以我假设recurringSubscriptionInfo_subscriptionID
是我需要提供的令牌,并编写了这段代码:
$referenceCode = 'my_merchant_id';
$client = new CybsSoapClient();
$request = $client->createRequest($referenceCode);
// Build a sale request (combining an auth and capture).
$ccAuthService = new stdClass();
$ccAuthService->run = 'true';
$request->ccAuthService = $ccAuthService;
$ccCaptureService = new stdClass();
$ccCaptureService->run = 'true';
$request->ccCaptureService = $ccCaptureService;
$request->merchantID = 'my_merchant_id';
$request->merchantReferenceCode = uniqid();
$request->purchaseTotals_currency = 'USD';
$request->purchaseTotals_grandTotalAmount = '25';
$request->recurringSubscriptionInfo_subscriptionID = 'xxxxxxxx';
$reply = $client->runTransaction($request);
当我第一次运行此代码时,API抱怨说我没有提供结算信息,但我认为没有必要,因为我提供了代币进行付款。添加结算信息后,它开始抱怨信用卡号丢失,这没有任何意义,因为重点是避免发送这些信息并改为使用支付代币。
答案 0 :(得分:0)
我相信您需要启用名称-值对,以提供使用recurringSubscriptionInfo_subscriptionID
进行嵌套的字段(例如:// ...
$ccAuthService = new stdClass();
$ccAuthService->run = 'true';
$request->ccAuthService = $ccAuthService;
$ccCaptureService = new stdClass();
$ccCaptureService->run = 'true';
$request->ccCaptureService = $ccCaptureService;
$request->merchantID = '<my merchant id>';
$request->merchantReferenceCode = uniqid();
$recurringSubscriptionInfo = new stdClass();
$recurringSubscriptionInfo->subscriptionID = '<my subscription token>';
$request->recurringSubscriptionInfo = $recurringSubscriptionInfo;
$purchaseTotals = new stdClass();
$purchaseTotals->currency = 'USD';
$purchaseTotals->grandTotalAmount = '100';
$request->purchaseTotals = $purchaseTotals;
// ...
),当我将代码更改为使用XML有效负载时,它起作用了:< / p>
grep -v 'seg[0-9]\{1,\}\.[0-9]\{1\}' file_name | tee file_name