cancel
Showing results for 
Search instead for 
Did you mean: 

CyberSource SOAP Toolkit API Token Payment

Hi

I would like to test a payment with already created token from the previous transaction, but can't really find a way to do that using SOAP Toolkit API.

I found this in their documentation:

 

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

So I assumed that recurringSubscriptionInfo_subscriptionID is the token that I need to provide, and wrote this code:

 

    $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);

When I first run this code, the API complained that I didn't provide billing info, but I thought that's not necessary cause I provided the token for payment. After adding the billing info, it started complaining about missing credit card number, which doesn't make any sense, cause the whole point is to avoid sending those information and use payment token instead.

 

4 REPLIES 4

.turns out the simple order API is simply for CRUD operations relating to transactions etc. When looking to obtain transaction details such as current status of an authorization etc. one must utilize CyberSource's xml/json reporting service; this service is hosted on a different endpoint and uses a basic authentication header when performing a GET with application/x-www-form-urlencoded data. The report I am pulling from the service is the transaction omglz.com detail report. Hope this info helps others looking to get details given omegle.love a specific omegle.2yu.co Request ID

I believe you need to enable name-value-pairs in order to provide fields using _ for nesting (e.g: recurringSubscriptionInfo_subscriptionID), when I changed your code to use XML payloads it worked:

 

// ...
$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;
// ...

 

 

DougReimers
Member

The CyberSource Token Management Service (TMS) enables you to safely store customer information, including payment data, in secure Visa data centers. It replaces this data with tokens in requests to other CyberSource services.

patrickmcBr
Member

 when I changed your code to use XML payloads it worked:

// ...
$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;
// ...
NorahDaniels
Member