Disable recurring billing
Overview
Use the disableRecurringBilling method to disable recurring billing for a subscription. When you disable recurring billing, the subscription status doesn’t change. Users continue to use subscriptions with recurring billing disabled until they expire, and 2Checkout provides them with the option to renew their subscription through manual payments.
Parameters
Parameters |
Type/Description |
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
SubscriptionReference |
Required (string) |
Unique, system-generated subscription identifier. |
Response
Boolean |
true or false depending on whether the changes were successful or not. |
Request
<?php
$host = "https://api.2checkout.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
'location' => $host . "/soap/4.0/",
"stream_context" => stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
))
));
function hmac($key, $data)
{
$b = 64; // byte length for md5
if (strlen($key) > $b) {
$key = pack("H*", md5($key));
}
$key = str_pad($key, $b, chr(0x00));
$ipad = str_pad('', $b, chr(0x36));
$opad = str_pad('', $b, chr(0x5c));
$k_ipad = $key ^ $ipad;
$k_opad = $key ^ $opad;
return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
$now = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash = hmac($key, $string);
try {
$sessionID = $client->login($merchantCode, $now, $hash);
}
catch (SoapFault $e) {
echo "Authentication: " . $e->getMessage();
exit;
}
$SubscriptionReferenceTest = '48F5AC7011';
try {
$disabledRecurringBilling = $client->disableRecurringBilling($sessionID, $SubscriptionReferenceTest);
}
catch (SoapFault $e) {
echo "disabledRecurringBilling: " . $e->getMessage();
exit;
}
var_dump("disabledRecurringBilling", $disabledRecurringBilling);
Retrieve cross-sell campaign by code
Overview
Use the getCrossSellCampaign method to extract information about the cross-sell campaign identified by the provided campaign code.
Request parameters
Parameters | Type | Required/Optional | Description |
---|---|---|---|
sessionID |
String | Required |
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
CampaignCode |
String | Required | The campaign code. |
Request sample
<?php
declare(strict_types=1);
// Start clear CLI
echo chr(27).chr(91).'H'.chr(27).chr(91).'J';
// End clear CLI
$executionStartTime = microtime(true);
class Configuration
{
public const MERCHANT_CODE = 'your_merchant_code';
public const MERCHANT_KEY = 'your_merchant_key';
public const URL = 'http://api.avangate.local/rpc/6.0';
}
class Client
{
private const LOGIN_METHOD = 'login';
private const GET_CROSS_SELL_CAMPAIGN = 'getCrossSellCampaign';
private int $calls = 1;
private function generateAuth(): array
{
$merchantCode = 'your_merchant_code';
$key = 'your_merchant_key';
$date = gmdate('Y-m-d H:i:s');
$string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
$hash = hash_hmac('md5', $string, $key);
return compact('merchantCode', 'date', 'hash');
}
public function login()
{
$payload = $this->generateAuth();
$response = $this->callForRpc(Configuration::URL, self::LOGIN_METHOD, array_values($payload));
return $response['result'];
}
private function callForRpc(string $url, string $action, ?array $payload = null)
{
$request = json_encode([
'jsonrpc' => '2.0',
'method' => $action,
'params' => $payload,
'id' => $this->calls++,
]);
$headers = [
'Content-Type: application/json',
'Accept: application/json',
'Cookie: XDEBUG_SESSION=PHPSTORM'
];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSLVERSION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($curl);
if (empty($response)) {
die('Server unavailable');
}
echo "\n\r Method " . $action . " result: \n\r";
echo $response . "\n\r";
return json_decode($response, true);
}
public function getCrossSellCampaign($sessionId, $crossSellCampaignCode)
{
$response = $this->callForRpc(
Configuration::URL,
self::GET_CROSS_SELL_CAMPAIGN,
[$sessionId, $crossSellCampaignCode]
);
return $response['result'];
}
}
$crossSellCampaignCode = '2Xrl83J0k+qOr3W1ceTwZnHHr30=';
$client = new Client();
$sessionId = $client->login();
$result = $client->getCrossSellCampaign($sessionId, $crossSellCampaignCode);
var_dump("GET CROSS SELL CAMPAIGN BY CODE: \n\r", json_encode($result, JSON_PRETTY_PRINT));
$executionEndTime = microtime(true);
// The duration will be displayed in seconds and milliseconds.
$seconds = round($executionEndTime - $executionStartTime, 2);
// Print it out
echo "\n\rThis script took $seconds to execute.\n\r";
Response
Parameter | Type/Description |
---|---|
CrossSellCampaing | Object |
Subscription renewal notifications
Overview
Use the setRenewalNotificationStatus method to subscribe or unsubscribe shoppers from subscription renewal notifications.
Parameters
Parameters | Type/Description |
---|---|
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
subscriptionReference |
Required (string) |
Unique, system-generated subscription identifier. |
|
status |
Required (boolean) |
|
true – enable subscription renewal notifications. false – disable subscription renewal notifications. |
Response
Parameters | Type/Description |
---|---|
Boolean |
true or false depending on whether or not the operation succeeded. |
Request
<?php
require ('PATH_TO_AUTH');
$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$status = false;
$jsonRpcRequest = array (
'method' => 'setRenewalNotificationStatus',
'params' => array($sessionID, $subscriptionReference, $Status),
'id' => $i++,
'jsonrpc' => '2.0');
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
Update promotion
Overview
Use the updatePromotion method via JSON-RPC API 4.0 to alter the details of an existing promotion.
Parameters
Parameter | Type/Description |
---|---|
sessionID | Required (string) |
Output of the Login method. | |
promotion | Required (object) |
Promotion object that you want to update. |
Response
Parameter | Type/Description |
---|---|
promotion | Updated promotion object. |
Request
<?php
function callRPC($Request, $host, $Debug = true) {
$curl = curl_init($host);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_VERBOSE, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSLVERSION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
$RequestString = json_encode($Request);
curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);
if ($Debug) {
$RequestString;
}
$ResponseString = curl_exec($curl);
if ($Debug) {
$ResponseString;
}
if (!empty($ResponseString)) {
var_dump($ResponseString);
$Response = json_decode($ResponseString);
if (isset($Response->result)) {
return $Response->result;
}
if (!is_null($Response->error)) {
var_dump($Request->method, $Response->error);
}
} else {
return null;
}
}
$host = 'https://api.avangate.com/rpc/3.1/';
$merchantCode = "YOUR_MERCHANT_CODE"; // your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY"; // your account's secret key available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$hash = hash_hmac('md5', $string, $key);
$i = 1;
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash);
$jsonRpcRequest->id = $i++;
$sessionID = callRPC($jsonRpcRequest, $host);
// Retrieve promotion details
$promotionCode = 'PROMOTION_CODE'; // code of the promotion that you want to update
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getPromotion',
'params' => array($sessionID, $promotionCode)
);
//var_dump (callRPC((Object)$jsonRpcRequest, $host));
// Keep the promotion you want to update in $existingPromotion
$existingPromotion = callRPC((Object)$jsonRpcRequest, $host);
// Set the fields to update
$existingPromotion->Description = 'Updated description';
// Update the promotion
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'updatePromotion',
'params' => array($sessionID, $existingPromotion)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));
Retrieve installments
Overview
Use the getInstallments method to retrieve information about the number of installments available for a specific selection of products/services.
Supported payment methods
Credit/Debit cards: local Visa and MasterCard in Brazil and Turkey.
Parameters
Parameters | Type/Description |
---|---|
sessionID |
String / Required |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
Object / Required | |
|
An object designed to collect all data necessary for an order, including billing, product/subscription plan, and payment details. |
Response
Parameters | Type/Description | |
---|---|---|
InstallmentsOption |
Array of objects |
|
|
Details below. |
|
|
Number |
Int |
|
|
The number of installments. |
|
Amount |
Double |
|
|
Standalone installment value. (Total order value/Number of installments) |
|
Currency |
String |
|
|
Order currency. |
Request
class Configuration
{
public const MERCHANT_CODE = '';
public const MERCHANT_KEY = '';
public const URL = 'http://api.avangate.local/rpc/6.0';
public const ACTION = 'getInstallments';
public const ADDITIONAL_OPTIONS = null;
//array or JSON
public const PAYLOAD = <<<JSON
{
"Amount" : 500,
"Country": "BR",
"Currency": "BRL",
"FiscalCode" :"345.675.677-7",
"EesToken": ["c49702ea-b0c5-4d39-9f5b-ba43ccf26785"]
}
JSON;
}
class Client
{
private const LOGIN_METHOD = 'login';
private $calls = 1;
private $sessionId;
private function generateAuth(): array
{
$merchantCode = Configuration::MERCHANT_CODE;
$key = Configuration::MERCHANT_KEY;
$date = gmdate('Y-m-d H:i:s');
$string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
$hash = hash_hmac('md5', $string, $key);
return compact('merchantCode', 'date', 'hash');
}
public function login(string $url)
{
$payload = $this->generateAuth();
$response = $this->call($url, array_values($payload), self::LOGIN_METHOD);
$this->sessionId = $response['result'];
}
public function call(
string $url = Configuration::URL,
$payload = Configuration::PAYLOAD,
string $action = Configuration::ACTION
): ?array {
if (empty($this->sessionId) && $action !== self::LOGIN_METHOD) {
$this->login($url);
}
if (is_string($payload)) {
$payload = json_decode($payload, true);
}
if (!empty($this->sessionId)) {
$payload = [$this->sessionId, $payload, Configuration::ADDITIONAL_OPTIONS];
}
$payload = array_filter($payload);
$request = json_encode([
'jsonrpc' => '2.0',
'method' => $action,
'params' => $payload,
'id' => $this->calls++,
]);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSLVERSION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Cookie: XDEBUG_SESSION=PHPSTORM'));
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($curl);
if(empty($response)) {
die('Server unavailable');
}
echo $response . '</br>';
return json_decode($response, true);;
}
}
$client = new Client();
$result = $client->call();
var_dump($result);
Pricing options
Overview
Use this object to add/create and edit/update price options for your account.
Parameters
Parameters | Type/Description | |||
---|---|---|---|---|
PriceOptionsGroup |
Object |
|||
Name |
String |
|||
|
Price option group name. Use this parameter when adding a new price options group. To edit the name of a price option group use the Name parameter under the Translations object. |
|||
Description |
String |
|||
|
Pricing option group description. |
|||
Translations |
Array of objects |
|||
|
Details below. |
|||
|
Name |
String |
||
|
|
Product pricing options group name, localized under Options. |
||
|
Description |
String |
||
|
|
Product pricing options group description, localized under Options. |
||
|
Language |
String |
||
|
|
ISO language code. (ISO 639-1 two-letter code). |
||
Code |
String |
|||
|
Unique code that The 2Checkout system generates or set for each pricing options group. |
|||
Type |
String |
|||
|
The type of the pricing options group. Possible values: · RADIO · CHECKBOX · INTERVAL · COMBO |
|||
Options |
Array of objects |
|||
|
Details below. |
|||
|
Name |
String |
||
|
|
Pricing option child name. |
||
|
Description |
String |
||
|
|
Pricing option child description. |
||
|
Translations |
Array of objects |
||
|
|
Details above. |
||
|
|
Name |
String |
|
|
|
|
Localized product pricing options group name under PriceOptionGroup. Localized pricing option child name under Options. |
|
|
|
Description |
String |
|
|
|
|
Localized product pricing options group description under PriceOptionGroup. Localized pricing option child description under Options. |
|
|
|
Language |
String |
|
|
|
|
ISO language code. (ISO 639-1 two-letter code). |
|
|
Value |
String |
||
|
|
The code you set or that the 2Checkout system generated for each pricing option child inside a pricing options group parent. |
||
|
ScaleMin |
Int |
||
|
|
The minimum value of a scale interval set for each pricing option child inside a pricing options group parent of the type INTERVAL. |
||
|
ScaleMax |
Int |
||
|
|
The maximum value of a scale interval set for each pricing option child inside a pricing options group parent of the type INTERVAL. |
||
|
SubscriptionImpact |
Object |
||
|
|
Details below. |
||
|
Months |
String |
||
|
|
The value in months the 2Checkout system adds or subtracts from the initial billing cycle of a subscription. |
||
|
Impact |
String |
||
|
|
Possible values: · ADD · SUBTRACT · LIFETIME |
||
|
PriceImpact |
Object |
||
|
|
Details below. |
||
|
|
ImpactOn |
String |
|
|
|
|
Possible values:
|
|
|
|
Impact |
String |
|
|
|
|
Impact on price per unit:
|
|
|
|
Percent |
String |
|
|
|
|
The value of the percentage out of the price per product unit, when you use PERCENT for Method. |
|
|
|
Method |
String |
|
|
|
|
Possible values: · PERCENT · FIXED |
|
|
|
Amounts |
Array of objects. |
|
|
|
|
Details below. |
|
|
|
|
Currency |
String |
|
|
|
|
Currency ISO code - ISO 4217. |
|
|
|
Amount |
String |
|
|
|
|
The amount defined for each specific currency active for your account, when you use FIXED for Method. |
|
Default |
Boolean |
||
|
|
TRUE for preselected options. Missing for options that are not preselected. |
Enable recurring billing
Overview
Use the enableRecurringBilling method to switch on the automatic renewal system for a subscription that's manually renewable.
Parameters
Parameters |
Type/Description |
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. Avangate throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
SubscriptionReference |
Required (string) |
Unique, system-generated subscription identifier. |
Response
Boolean |
true or false depending on whether the changes were successful or not. |
Request
<?php
$host = "https://api.avangate.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
'location' => $host . "/soap/4.0/",
"stream_context" => stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
))
));
function hmac($key, $data)
{
$b = 64; // byte length for md5
if (strlen($key) > $b) {
$key = pack("H*", md5($key));
}
$key = str_pad($key, $b, chr(0x00));
$ipad = str_pad('', $b, chr(0x36));
$opad = str_pad('', $b, chr(0x5c));
$k_ipad = $key ^ $ipad;
$k_opad = $key ^ $opad;
return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$now = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash = hmac($key, $string);
try {
$sessionID = $client->login($merchantCode, $now, $hash);
}
catch (SoapFault $e) {
echo "Authentication: " . $e->getMessage();
exit;
}
$SubscriptionReferenceTest = '48F5AC7011';
try {
$enabledSubscriptionRecurring = $client->enableRecurringBilling($sessionID, $SubscriptionReferenceTest);
}
catch (SoapFault $e) {
echo "enabledSubscriptionRecurring: " . $e->getMessage();
exit;
}
var_dump("enabledSubscriptionRecurring", $enabledSubscriptionRecurring);
Subscription end user update
Overview
Use the updateSubscriptionEndUser method to update the details of a subscription’s end user. This method changes per-subscription end user data and not customer details.
Parameters
Parameters | Type/Description |
---|---|
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
SubscriptionReference |
Required (string) |
Unique, system-generated subscription identifier. |
|
EndUser |
Required (Object) |
Use this object to update end user information. |
Response
Parameters | Type/Description |
---|---|
Boolean |
true or false depending on whether the changes were successful or not. |
Request
<?php
$host = "https://api.2checkout.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
'location' => $host . "/soap/4.0/",
"stream_context" => stream_context_create(array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
))
));
function hmac($key, $data)
{
$b = 64; // byte length for md5
if (strlen($key) > $b) {
$key = pack("H*", md5($key));
}
$key = str_pad($key, $b, chr(0x00));
$ipad = str_pad('', $b, chr(0x36));
$opad = str_pad('', $b, chr(0x5c));
$k_ipad = $key ^ $ipad;
$k_opad = $key ^ $opad;
return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
$now = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash = hmac($key, $string);
try {
$sessionID = $client->login($merchantCode, $now, $hash);
}
catch (SoapFault $e) {
echo "Authentication: " . $e->getMessage();
exit;
}
$subscriptionreference = '8F749B63E7';
$EndUser = new stdClass ();
$EndUser->Address1 = 'Address line 1';
$EndUser->Address2 = 'Address line 2';
$EndUser->City = 'LA';
$EndUser->Company = 'Company Name';
$EndUser->CountryCode = 'us';
$EndUser->Email = 'customerAPI@2checkout.com';
$EndUser->FirstName = 'New Customer';
$EndUser->Language = 'en';
$EndUser->LastName = '2Checkout';
$EndUser->Phone = '1234567890';
$EndUser->State = 'California';
$EndUser->Zip = '90210';
$EndUser->Fax = null;
try {
$newEndUser = $client->updateSubscriptionEndUser($sessionID, $subscriptionreference, $EndUser);
}
catch (SoapFault $e) {
echo "newEndUser: " . $e->getMessage();
exit;
}
var_dump("newEndUser", $newEndUser);
Place a renewal order
Overview
Renew a subscription and collect recurring revenue using the 2Checkout Subscription Reference. You can renew subscriptions for both catalog and dynamic products.
For more details about how to be PCI compliant before accepting CC payments, see this page.
Requirements
To place a renewal order, you need to provide a valid subscription reference number.
Payment methods
You can place renewal orders using the following payment methods:
- Credit cards
- PayPal
- WeChat Pay
- iDEAL
- Purchase Order
- Wire
Use the PaymentDetails object to change the payment method used in the ordering process.
Parameters
Parameters | Type/Description |
---|---|
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
Required (Object) |
|
|
Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. To place an order with PayPal rather than PayPal Express, use PAYPAL as the type of the PaymentDetails object and send the shopper email and a return URL as part of the PaymentMethod object. See code sample. |
SubscriptionReference |
Required (String) 2Checkout generated subscription reference number. E.q. A8C5671BFE. |
Response
Parameters | Type/Description |
---|---|
Object |
Request
<?php
require ('PATH_TO_AUTH');
$Order = new stdClass();
$Order->Currency = 'USD';
$Order->Language = "EN";
$Order->Country = 'US';
$Order->CustomerIP = '91.220.121.21';
$Order->Source = "sourceAPI.net";
$Order->LocalTime = date('Y-m-d H:i:s');
$Order->Items = array();
/**/
$Order->Items[0]->RenewalInformation = new stdClass();
$Order->Items[0]->RenewalInformation->SubscriptionReference = 'A8C5671BFE'; //subscription used in the renewal process
$Order->Items[0]->Price = new stdClass();
$Order->Items[0]->Price->Type = 'CUSTOM';
$Order->Items[0]->Price->Amount = '10';
$Order->Items[0]->PriceOptions = array('uniqscale1=4');//
$Order->MachineId = "MachineID";
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->Address1 = 'Bil1ing address';
$Order->BillingDetails->Address2 = 'Billing address 2';
$Order->BillingDetails->City = 'Billing City';
$Order->BillingDetails->State = 'Billing State';
$Order->BillingDetails->CountryCode = 'US';
$Order->BillingDetails->Phone = 1231232123;
$Order->BillingDetails->Email = 'customer_details@test.com';
$Order->BillingDetails->FirstName = 'First';
$Order->BillingDetails->LastName = 'Customer';
$Order->BillingDetails->Company = 'Billing Company';
$Order->BillingDetails->Zip = '55104';
$Order->DeliveryDetails = new stdClass();
$Order->DeliveryDetails->Address1 = 'Bil1ing address';
$Order->DeliveryDetails->Address2 = 'Billing address 2';
$Order->DeliveryDetails->City = 'Billing City';
$Order->DeliveryDetails->State = 'Billing State';
$Order->DeliveryDetails->CountryCode = 'US';
$Order->DeliveryDetails->Phone = '12345';
$Order->DeliveryDetails->Email = 'customer_details@test.com';
$Order->DeliveryDetails->FirstName = 'First';
$Order->DeliveryDetails->LastName = 'Customer';
$Order->DeliveryDetails->Zip = "55104";
$Order->PaymentDetails = new stdClass();
$Order->PaymentDetails->Type = "CC";
$Order->PaymentDetails->Currency = $currency;
$Order->PaymentDetails->PaymentMethod = new stdClass();
/**/
$Order->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";
$Order->PaymentDetails->PaymentMethod->CardType = "VISA";
$Order->PaymentDetails->PaymentMethod->ExpirationYear = "2019";
$Order->PaymentDetails->PaymentMethod->ExpirationMonth = "12";
$Order->PaymentDetails->PaymentMethod->CCID = "123";
$Order->PaymentDetails->PaymentMethod->HolderName = "John Doe";
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = TRUE;
$Order->PaymentDetails->PaymentMethod->HolderNameTime = 1;
$Order->PaymentDetails->PaymentMethod->CardNumberTime = 1;
/**/
try {
$newOrder = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
echo "newOrder: " . $e->getMessage();
exit;
}
var_dump("newOrder", $Order);