Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php CyberSource SOAP工具包API代币支付?_Php_Soap - Fatal编程技术网

Php CyberSource SOAP工具包API代币支付?

Php CyberSource SOAP工具包API代币支付?,php,soap,Php,Soap,我想用上一个事务中已经创建的令牌测试一个支付,但实际上找不到使用soaptoolkitapi的方法 我在他们的文档中发现: 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:

我想用上一个事务中已经创建的令牌测试一个支付,但实际上找不到使用soaptoolkitapi的方法

我在他们的文档中发现:

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\u 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抱怨我没有提供账单信息,但我认为这不是必要的,因为我提供了支付令牌。添加账单信息后,它开始抱怨缺少信用卡号,这没有任何意义,因为关键是避免发送这些信息,而是使用支付令牌。

我认为您需要启用名称-值对,以便为嵌套提供使用
的字段(例如:
recurringSubscriptionInfo\u subscriptionID
),当我将您的代码更改为使用XML有效负载时,它起到了作用:

/。。。
$ccAuthService=new stdClass();
$ccAuthService->run='true';
$request->ccAuthService=$ccAuthService;
$ccCaptureService=new stdClass();
$ccCaptureService->run='true';
$request->ccCaptureService=$ccCaptureService;
$request->merchantID='';
$request->merchantReferenceCode=uniqid();
$recurringSubscriptionInfo=新stdClass();
$recurringSubscriptionInfo->subscriptionID='';
$request->recurringSubscriptionInfo=$recurringSubscriptionInfo;
$purchaseTotals=新stdClass();
$purchaseTotals->currency='USD';
$purchaseTotals->grandTotalAmount='100';
$request->purchaseTotals=$purchaseTotals;
// ...