Skip to main content

Retrieve an order field

Overview

Use the getAdditionalField method to extract information about a specific additional field you set up for your account.

Parameters

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.

FieldCode

Required (string)

 

Field identifier. Alpha-numeric chars, underscores and dashes.

Response

AdditionalField

Object

Request

<?php

$host   = "https://api.avangate.com";
$client = new SoapClient($host . "/soap/3.0/?wsdl", array(
    'location' => $host . "/soap/3.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 = "YOURCODE123"; //your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key          = "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;
}

$FieldCode = 'SourceOrder';

try {
    $AdditionalField = $client->getAdditionalField($sessionID, $FieldCode);
}

catch (SoapFault $e) {
    echo "AdditionalField: " . $e->getMessage();
    exit;
}

var_dump("AdditionalField", $AdditionalField);


?>

Retrieve the history of a subscription

Overview

Retrieve information on the evolution of a subscription in the Avangate system, including details of the initial acquisition and the subsequent renewals and upgrades. Use the getSubscriptionHistory method to retrieve details about a subscription. 

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

SubscriptionHistory

Object

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;
}
$subscriptionReference = '351D8F557E';
try {
    $subscriptionHistory = $client->getSubscriptionHistory($sessionID, $subscriptionReference);
}
catch (SoapFault $e) {
    echo "subscriptionHistory: " . $e->getMessage();
    exit;
}
var_dump("subscriptionHistory", $subscriptionHistory);

Assign a PricingOption Group

Overview

Use the assignPricingConfigurationOptionGroup method to assign a PricingOption Group to a PricingConfiguration.

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.

PricingConfigurationCode

Required (string)

 

Unique, system-generated pricing configuration identifier.  

PriceOptionsGroupAssigned

Required (Object)

 

Details below.

 

 

PriceOptionsGroupAssigned

Object

Code

Required (string)

 

PricingOption Group identifier.

Required

Required (Object)

 

True or false depending on whether the pricing options group is required during the purchase process or not.

 

Response

bool(true)

Request

<?php
 
function callRPC($Request, $hostUrl, $Debug = true) {
    $curl = curl_init($hostUrl);
    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'));
    $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.0/';
 
$merchantCode = "YOURCODE12345";//your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "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; // counter for api calls
 
// Call the login method for authentication
 
$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);
 
$PricingConfigurationCode = 'C4940279';
$PriceOptionsGroupAssigned = new stdClass();
$PriceOptionsGroupAssigned->Code = 'USERSUSERS';
$PriceOptionsGroupAssigned->Required = TRUE;
 
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'assignPricingConfigurationOptionGroup',
'params' => array($sessionID, $PricingConfigurationCode, $PriceOptionsGroupAssigned)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));
 
 
 
?>

Update a subscription

Overview

Change specific details about a subscription. Use the updateSubscription method to change specific details about a subscription. 

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.

Subscription

Required (Object)

 

You need to include the entire Subscription object keeping its structure unchanged (retrieve it using getSubscription) but you can update only specific parameters enumerated below.

 

EndUser

Object

 

 

End user details.

 

ExpirationDate

String

 

 

Subscription expiration date - If you changed the time zone for the 2Checkout API by editing system settings under Account settings, then 2Checkout calculates the ExpirationDate according to your custom configuration. Note: The default 2Checkout API time zone is GMT+02:00.

 

SubscriptionEnabled

Boolean

 

 

Possible values: TRUE/FALSE

 

RecurringEnabled

Boolean

 

 

Possible values: TRUE/FALSE

 

ExternalCustomerReference

String

 

 

Unique customer alphanumeric (string) identifiers that you control. Use this to 

move a subscription from under a customer to another customer entity. 2Checkout moves subscription under the customer for which you provide the External customer reference during the subscription update process. View example.

 

ProductId

Int

 

 

System-generated unique product ID. Needs to be the ID of an existing product in the 2Checkout system created under your account.

The product ID governs the product to which the subscription is associated with.

Product types must match Regular - Regular or Bundle - Bundle.

IDs must identify products with the renewal system enabled (max billing cycle 36 months).

 

ProductName

String

 

 

The name of the product for identifier used under ProductID.

 

ProductQuantity

Int

 

 

Ordered quantity.

 

PriceOptionCodes

Array

 

 

Array of product options codes. Pricing options codes are case sensitive.

To impact the renewal price, the PriceOptionsCodes need to belong to price options of pricing configurations used for the product with which the subscription is associated.

 

All other parameters of the Subscription object are non-editable.

The 2Checkout system uses the updated subscription information for:

  • Manual and automatic renewals
  • Upgrades
  • Trial conversions

Response

Boolean

true or false depending on whether the changes were successful or not.

Request


<?php
 
 
function callRPC($Request, $hostUrl, $Debug = true) {
    $curl = curl_init($hostUrl);
    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'));
    $RequestString = json_encode($Request);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);
 
 
    if ($Debug) {
        $RequestString;
    }
    $ResponseString = curl_exec($curl);
    if ($Debug) {
        $ResponseString;
    }
 
    if (!empty($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.2checkout.com/rpc/3.0/';
 
$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
 
$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; // counter for api calls
// call login
$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);
 
var_dump($sessionID);
$SubscriptionReferenceTest = '0177AAA92B';
$jsonRpcRequest = array (
'method' => 'getSubscription',
'params' => array($sessionID, $SubscriptionReferenceTest),
'id' => $i++,
'jsonrpc' => '2.0');
$updatedSubscription = callRPC((Object)$jsonRpcRequest, $host, true);
var_dump ($updatedSubscription);
$updatedSubscription->RecurringEnabled = false;
$updatedSubscription-> SubscriptionEnabled = true;
$updatedSubscription->ExpirationDate = '2020-12-12';

$jsonRpcRequest = array (
'method' => 'updateSubscription',
'params' => array($sessionID, $updatedSubscription),
'id' => $i++,
'jsonrpc' => '2.0');

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));

 

Update pricing configuration

Overview

Use the updatePricingConfiguration method to update/edit an existing pricing configuration.

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.

PricingConfiguration

Required (object)

 

Use this object to update/edit an existing pricing configuration for your account.

ProductCode

Required (string)

 

The unique product code that you control not the system-generated product identifier.

 

You cannot modify:

  • The pricing configuration CODE.
  • The PricingSchema from DYNAMIC to FLAT or vice versa.
  • The intervals of an existing pricing configuration (MinQuantity and MaxQuantity). 

Response

bool(true)

Request

<?php
 
function callRPC($Request, $hostUrl, $Debug = true) {
    $curl = curl_init($hostUrl);
    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'));
    $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.0/';
 
$merchantCode = "YOURCODE12345";//your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "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; // counter for api calls
 
// Call the login method for authentication
 
$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);
 
$ProductCode = 'subscode1';
 
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getPricingConfigurations',
'params' => array($sessionID, $ProductCode)
);
 
$existingPricingConfig = callRPC((Object)$jsonRpcRequest, $host);
var_dump ($existingPricingConfig );
die;
$existingPricingConfig[1]->Prices->Regular[0]->Currency = 'USD';
$existingPricingConfig[1]->Prices->Regular[0]->Amount = 99;
$newPriceConfig = $existingPricingConfig[1];
 
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'updatePricingConfiguration',
'params' => array($sessionID, $newPriceConfig, $ProductCode) //Use product ID and not product code for API versions smaller than 2.5
);
 
var_dump (callRPC((Object)$jsonRpcRequest, $host));
 
 
?>

Retrieve orders without partner invoice

Overview

Use this method to list all orders that have yet to be included in a partner invoice.

Requirements

This method requires you to set a specific partner using setPartner.

Parameters

Parameters Type/Description
sessionID Required (String)
  Session identifier, output of the Login method. An exception is thrown if the values are incorrect.

Response parameters

Parameters Type/Description
Order information Object

Request sample

<?php

require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner

try {
    $OrderswithoutProforma= $client->getOrdersWithoutProforma ($sessionID);
} catch (SoapFault $e) {
    echo "NoProforma: " . $e->getMessage();
    exit;
}
var_dump ("NoProforma", $OrderswithoutProforma);

Response sample

{
    "RefNo": "112579424",
    "OrderNo": 3167,
    "ExternalReference": null,
    "ShopperRefNo": null,
    "Status": "PENDING",
    "ApproveStatus": "WAITING",
    "VendorApproveStatus": "OK",
    "MerchantCode": "CHAOSGRO",
    "Language": "en",
    "OrderDate": "2020-01-17 12:53:47",
    "FinishDate": null,
    "Source": null,
    "AffiliateSource": null,
    "AffiliateId": null,
    "AffiliateName": null,
    "AffiliateUrl": null,
    "RecurringEnabled": false,
    "HasShipping": false,
    "BillingDetails": {
        "FiscalCode": null,
        "TaxOffice": null,
        "Phone": "830-485-6136",
        "FirstName": "Iron",
        "LastName": "Man",
        "Company": "Stark Industries",
        "Email": "anastasiya.nikolova@chaosgroup.com",
        "Address1": "411 Farland Avenue",
        "Address2": null,
        "City": "Victoria",
        "Zip": "77901",
        "CountryCode": "us",
        "State": "Texas"
    },
    "DeliveryDetails": {
        "Phone": "830-485-6136",
        "FirstName": "Iron",
        "LastName": "Man",
        "Company": "Stark Industries",
        "Email": "anastasiya.nikolova@chaosgroup.com",
        "Address1": "411 Farland Avenue",
        "Address2": null,
        "City": "Victoria",
        "Zip": "77901",
        "CountryCode": "us",
        "State": "Texas"
    },
    "PaymentDetails": {
        "Type": "OTHER",
        "Currency": "usd",
        "PaymentMethod": null,
        "CustomerIP": "212.91.166.163"
    },
    "DeliveryInformation": {
        "ShippingMethod": {
            "Code": null,
            "TrackingUrl": null,
            "TrackingNumber": null,
            "Comment": null
        }
    },
    "CustomerDetails": null,
    "Origin": "Web",
    "AvangateCommission": 0,
    "OrderFlow": "REGULAR",
    "GiftDetails": null,
    "PODetails": null,
    "ExtraInformation": null,
    "PartnerCode": "HBVQ99623329",
    "PartnerMargin": 2478,
    "PartnerMarginPercent": 20,
    "ExtraMargin": 0,
    "ExtraMarginPercent": 0,
    "ExtraDiscount": 0,
    "ExtraDiscountPercent": 0,
    "LocalTime": null,
    "TestOrder": false,
    "FxRate": 1,
    "FxMarkup": 0,
    "PayoutCurrency": "USD",
    "DeliveryFinalized": false,
    "Errors": null,
    "Items": [
        {
            "ProductDetails": {
                "Name": "V-Ray Next for 3ds Max - Perpetual",
                "ShortDescription": "",
                "Tangible": false,
                "IsDynamic": false,
                "ExtraInfo": null,
                "RenewalStatus": false,
                "Subscriptions": [
                    {
                        "SubscriptionReference": "1E26F2D686",
                        "PurchaseDate": "2020-01-17 12:53:48",
                        "SubscriptionStartDate": "2020-01-17 12:53:48",
                        "ExpirationDate": null,
                        "Lifetime": true,
                        "Trial": false,
                        "Enabled": true,
                        "RecurringEnabled": false
                    },
                    {
                        "SubscriptionReference": "F978B4AFDF",
                        "PurchaseDate": "2020-01-17 12:53:48",
                        "SubscriptionStartDate": "2020-01-17 12:53:48",
                        "ExpirationDate": null,
                        "Lifetime": true,
                        "Trial": false,
                        "Enabled": true,
                        "RecurringEnabled": false
                    }
                ],
                "DeliveryInformation": {
                    "Delivery": "NO_DELIVERY",
                    "DownloadFile": null,
                    "DeliveryDescription": "",
                    "CodesDescription": "",
                    "Codes": []
                }
            },
            "PriceOptions": [],
            "Price": {
                "UnitNetPrice": 590,
                "UnitGrossPrice": 628.94,
                "UnitVAT": 38.94,
                "UnitDiscount": 118,
                "UnitNetDiscountedPrice": 472,
                "UnitGrossDiscountedPrice": 510.94,
                "UnitAffiliateCommission": 0,
                "ItemUnitNetPrice": null,
                "ItemUnitGrossPrice": null,
                "ItemNetPrice": null,
                "ItemGrossPrice": null,
                "VATPercent": 8.25,
                "HandlingFeeNetPrice": 0,
                "HandlingFeeGrossPrice": 0,
                "Currency": "usd",
                "NetPrice": 7080,
                "GrossPrice": 7547.28,
                "NetDiscountedPrice": 5664,
                "GrossDiscountedPrice": 6131.28,
                "Discount": 1416,
                "VAT": 467.28,
                "AffiliateCommission": 0
            },
            "LineItemReference": "c790705c387a71545271367303e38e3ffd1b1055",
            "PurchaseType": null,
            "Code": "VR04MXPESCL001",
            "ExternalReference": "",
            "Quantity": 12,
            "SKU": null,
            "CrossSell": null,
            "Trial": null,
            "AdditionalFields": null,
            "Promotion": null,
            "RecurringOptions": null,
            "SubscriptionStartDate": null
        },
        {
            "ProductDetails": {
                "Name": "V-Ray Next for 3ds Max - Perpetual",
                "ShortDescription": "",
                "Tangible": false,
                "IsDynamic": false,
                "ExtraInfo": null,
                "RenewalStatus": false,
                "Subscriptions": [
                    {
                        "SubscriptionReference": "1E26F2D686",
                        "PurchaseDate": "2020-01-17 12:53:48",
                        "SubscriptionStartDate": "2020-01-17 12:53:48",
                        "ExpirationDate": null,
                        "Lifetime": true,
                        "Trial": false,
                        "Enabled": true,
                        "RecurringEnabled": false
                    },
                    {
                        "SubscriptionReference": "F978B4AFDF",
                        "PurchaseDate": "2020-01-17 12:53:48",
                        "SubscriptionStartDate": "2020-01-17 12:53:48",
                        "ExpirationDate": null,
                        "Lifetime": true,
                        "Trial": false,
                        "Enabled": true,
                        "RecurringEnabled": false
                    }
                ],
                "DeliveryInformation": {
                    "Delivery": "NO_DELIVERY",
                    "DownloadFile": null,
                    "DeliveryDescription": "",
                    "CodesDescription": "",
                    "Codes": []
                }
            },
            "PriceOptions": [],
            "Price": {
                "UnitNetPrice": 590,
                "UnitGrossPrice": 628.94,
                "UnitVAT": 38.94,
                "UnitDiscount": 118,
                "UnitNetDiscountedPrice": 472,
                "UnitGrossDiscountedPrice": 510.94,
                "UnitAffiliateCommission": 0,
                "ItemUnitNetPrice": null,
                "ItemUnitGrossPrice": null,
                "ItemNetPrice": null,
                "ItemGrossPrice": null,
                "VATPercent": 8.25,
                "HandlingFeeNetPrice": 0,
                "HandlingFeeGrossPrice": 0,
                "Currency": "usd",
                "NetPrice": 5310,
                "GrossPrice": 5660.46,
                "NetDiscountedPrice": 4248,
                "GrossDiscountedPrice": 4598.46,
                "Discount": 1062,
                "VAT": 350.46,
                "AffiliateCommission": 0
            },
            "LineItemReference": "ec426fce2d07bc279654b295b97644997a5c524d",
            "PurchaseType": null,
            "Code": "VR04MXPESCL001",
            "ExternalReference": "",
            "Quantity": 9,
            "SKU": null,
            "CrossSell": null,
            "Trial": null,
            "AdditionalFields": null,
            "Promotion": null,
            "RecurringOptions": null,
            "SubscriptionStartDate": null
        }
    ],
    "Promotions": [],
    "AdditionalFields": null,
    "CustomParameters": null,
    "Currency": "usd",
    "NetPrice": 12390,
    "GrossPrice": 13207.74,
    "NetDiscountedPrice": 9912,
    "GrossDiscountedPrice": 10729.74,
    "Discount": 2478,
    "VAT": 817.74,
    "AffiliateCommission": 0
}

Errors

Error Description

INVALID_PARTNER

No partner is set.

NO_ORDERS

There are no orders without partner invoice.

 

Place test orders

Overview

Place a test order using dynamic product information.

Set the Payment details type to TEST in order to create an order with a test credit card or a 2Pay.js token generated with a test credit card in a test environment.
For the full list of test credit card details, check this article.

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.

Order

Required (Object)

 

Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details.

 

 

Response 

Parameters Type/Description

Order information

Object

  Object containing order information.

 Test order request with credit cards

<?php

require ('PATH_TO_AUTH');

$Order = new stdClass();
$Order->Currency = "USD";
$Order->Language = "EN";
$Order->Country = "US";
$Order->CustomerIP = '91.220.121.21';//"10.10.13.37";
$Order->Source = "sourceAPI.net";
$Order->LocalTime = date('Y-m-d H:i:s');
$Order->CustomerReference = 421820775;
$Order->Items = array();

/**
 * 1st Product
 */
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = null;
$Order->Items[0]->Quantity = 2;
$Order->Items[0]->PurchaseType = 'PRODUCT';
$Order->Items[0]->Tangible = false; // physical
$Order->Items[0]->IsDynamic = true;
$Order->Items[0]->Price = new stdClass();
$Order->Items[0]->Price->Amount = 100;
$Order->Items[0]->Price->Type = 'CUSTOM';
$Order->Items[0]->Name = 'Dynamic Product 1 '. date("Y-m-d H:i:s");
$Order->Items[0]->Description = 'Description Produs OTF';

$Order->Items[0]->PriceOptions = [];
$priceOption = new stdClass();
$priceOption->Name = 'Name';
$priceOption->Value = 'Value';
$priceOption->Surcharge = 10;
$Order->Items[0]->PriceOptions[] = $priceOption;

$priceOption1 = new stdClass();
$priceOption1->Name = 'Name';
$priceOption1->Value = 'Value123';
$priceOption1->Surcharge = 11;
$Order->Items[0]->PriceOptions[] = $priceOption1;

$priceOption2 = new stdClass();
$priceOption2->Name = 'Name1';
$priceOption2->Value = 'Value1';
$priceOption2->Surcharge = 12;
$Order->Items[0]->PriceOptions[] = $priceOption2;

$Order->Items[0]->RecurringOptions = new stdClass();
$Order->Items[0]->RecurringOptions->CycleLength = 1;
$Order->Items[0]->RecurringOptions->CycleUnit = 'MONTH';
$Order->Items[0]->RecurringOptions->CycleAmount = 1234;
$Order->Items[0]->RecurringOptions->ContractLength = 3;
$Order->Items[0]->RecurringOptions->ContractUnit = 'Year';

/*
 * 3rd Product - SHIPPING
 */

$Order->Items[2] = new stdClass();
$Order->Items[2]->Name = 'Shipping Item '. date("Y-m-d H:i:s");
$Order->Items[2]->PurchaseType = 'SHIPPING';
$Order->Items[2]->Quantity = 1;
$Order->Items[2]->Price = new stdClass();
$Order->Items[2]->Price->Amount = 123;
$Order->Items[2]->IsDynamic = true;

/**
 * 4th Product - TAX
 */
$Order->Items[3] = new stdClass();
$Order->Items[3]->Name = 'Tax Item '. date("Y-m-d H:i:s");
$Order->Items[3]->PurchaseType = 'TAX';
$Order->Items[3]->Quantity = 1;
$Order->Items[3]->Price = new stdClass();
$Order->Items[3]->Price->Amount = 456;
$Order->Items[3]->IsDynamic = true;
$Order->Items[3]->RecurringOptions = new stdClass();
$Order->Items[3]->RecurringOptions->CycleLength = 1;
$Order->Items[3]->RecurringOptions->CycleUnit = 'MONTH';
$Order->Items[3]->RecurringOptions->CycleAmount = 10.2;
$Order->Items[3]->RecurringOptions->ContractLength = 3;
$Order->Items[3]->RecurringOptions->ContractUnit = 'Year';

/**
 * 5th Product - COUPON
 */
$Order->Items[4] = new stdClass();
$Order->Items[4]->Name = 'Coupon Item '. date("Y-m-d H:i:s");
$Order->Items[4]->PurchaseType = 'COUPON';
$Order->Items[4]->Quantity = 1;
$Order->Items[4]->Price = new stdClass();
$Order->Items[4]->Price->Amount = 234;
$Order->Items[4]->IsDynamic = true;

/**/

$additionalField1 = new stdClass();
$additionalField1->Code = "additional_field_order_1";
$additionalField1->Text = "REST";
$additionalField1->Value = "1";


$Order->AdditionalFields = array();


$additionalField1 = new stdClass();
$additionalField1->Code = "REST";
$additionalField1->Text = "REST";
$additionalField1->Value = "REST";


$Order->MachineId = 'machineIdTest';
$Order->Discount = null;
$Order->ExternalReference = null;

$Order->BillingDetails = new stdClass();
$Order->BillingDetails->Address1 = 'Billing address 1';
$Order->BillingDetails->Address2 = 'Billing address 2';
$Order->BillingDetails->City = 'New York City';
$Order->BillingDetails->State = 'New York';
$Order->BillingDetails->CountryCode = 'US';
$Order->BillingDetails->Phone = 12345;
$Order->BillingDetails->Email = 'customer@email.com';
$Order->BillingDetails->FirstName = 'John';
$Order->BillingDetails->LastName = 'Doe';
$Order->BillingDetails->Company = 'ABC Company';
$Order->BillingDetails->Zip = '12345';
$Order->BillingDetails->FiscalCode = 13205628845;

/**/
$Order->DeliveryDetails = new stdClass();
$Order->DeliveryDetails->Address1 = 'Delivery address 1';
$Order->DeliveryDetails->Address2 = 'Delivery address 2';
$Order->DeliveryDetails->City = 'New York City';
$Order->DeliveryDetails->State = 'New York';
$Order->DeliveryDetails->CountryCode = 'US';
$Order->DeliveryDetails->Phone = '12345';
$Order->DeliveryDetails->Email = 'customer@email.com';
$Order->DeliveryDetails->FirstName = 'John';
$Order->DeliveryDetails->LastName = 'Doe';
$Order->DeliveryDetails->Zip = 12345;
/**/

$Order->PaymentDetails = new stdClass();
$Order->PaymentDetails->Type = "TEST";

$Order->PaymentDetails->Currency = "USD";
$Order->PaymentDetails->CustomerIP = '91.220.121.21';//"10.10.13.37";

$Order->PaymentDetails->PaymentMethod = new stdClass();


/**/
$Order->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";//4222222222222 //4111111111111111 //4984123412341234 - Installments
$Order->PaymentDetails->PaymentMethod->CardType = "VISA";/**/

/**/
$Order->PaymentDetails->PaymentMethod->ExpirationYear = "2020";
$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);

Test order request with 2Pay.js token

 <?php

require ('PATH_TO_AUTH');

$Order = new stdClass();
$Order->Currency = "USD";
$Order->Language = "EN";
$Order->Country = "US";
$Order->CustomerIP = '91.220.121.21';//"10.10.13.37";
$Order->Source = "sourceAPI.net";
$Order->LocalTime = date('Y-m-d H:i:s');
$Order->CustomerReference = 421820775;
$Order->Items = array();

/**
 * 1st Product
 */
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = null;
$Order->Items[0]->Quantity = 2;
$Order->Items[0]->PurchaseType = 'PRODUCT';
$Order->Items[0]->Tangible = false; // physical
$Order->Items[0]->IsDynamic = true;
$Order->Items[0]->Price = new stdClass();
$Order->Items[0]->Price->Amount = 100;
$Order->Items[0]->Price->Type = 'CUSTOM';
$Order->Items[0]->Name = 'Dynamic Product 1 '. date("Y-m-d H:i:s");
$Order->Items[0]->Description = 'Description Produs OTF';

$Order->Items[0]->PriceOptions = [];
$priceOption = new stdClass();
$priceOption->Name = 'Name';
$priceOption->Value = 'Value';
$priceOption->Surcharge = 10;
$Order->Items[0]->PriceOptions[] = $priceOption;

$priceOption1 = new stdClass();
$priceOption1->Name = 'Name';
$priceOption1->Value = 'Value123';
$priceOption1->Surcharge = 11;
$Order->Items[0]->PriceOptions[] = $priceOption1;

$priceOption2 = new stdClass();
$priceOption2->Name = 'Name1';
$priceOption2->Value = 'Value1';
$priceOption2->Surcharge = 12;
$Order->Items[0]->PriceOptions[] = $priceOption2;

$Order->Items[0]->RecurringOptions = new stdClass();
$Order->Items[0]->RecurringOptions->CycleLength = 1;
$Order->Items[0]->RecurringOptions->CycleUnit = 'MONTH';
$Order->Items[0]->RecurringOptions->CycleAmount = 1234;
$Order->Items[0]->RecurringOptions->ContractLength = 3;
$Order->Items[0]->RecurringOptions->ContractUnit = 'Year';

/*
 * 3rd Product - SHIPPING
 */

$Order->Items[2] = new stdClass();
$Order->Items[2]->Name = 'Shipping Item '. date("Y-m-d H:i:s");
$Order->Items[2]->PurchaseType = 'SHIPPING';
$Order->Items[2]->Quantity = 1;
$Order->Items[2]->Price = new stdClass();
$Order->Items[2]->Price->Amount = 123;
$Order->Items[2]->IsDynamic = true;

/**
 * 4th Product - TAX
 */
$Order->Items[3] = new stdClass();
$Order->Items[3]->Name = 'Tax Item '. date("Y-m-d H:i:s");
$Order->Items[3]->PurchaseType = 'TAX';
$Order->Items[3]->Quantity = 1;
$Order->Items[3]->Price = new stdClass();
$Order->Items[3]->Price->Amount = 456;
$Order->Items[3]->IsDynamic = true;
$Order->Items[3]->RecurringOptions = new stdClass();
$Order->Items[3]->RecurringOptions->CycleLength = 1;
$Order->Items[3]->RecurringOptions->CycleUnit = 'MONTH';
$Order->Items[3]->RecurringOptions->CycleAmount = 10.2;
$Order->Items[3]->RecurringOptions->ContractLength = 3;
$Order->Items[3]->RecurringOptions->ContractUnit = 'Year';

/**
 * 5th Product - COUPON
 */
$Order->Items[4] = new stdClass();
$Order->Items[4]->Name = 'Coupon Item '. date("Y-m-d H:i:s");
$Order->Items[4]->PurchaseType = 'COUPON';
$Order->Items[4]->Quantity = 1;
$Order->Items[4]->Price = new stdClass();
$Order->Items[4]->Price->Amount = 234;
$Order->Items[4]->IsDynamic = true;

/**/

$additionalField1 = new stdClass();
$additionalField1->Code = "additional_field_order_1";
$additionalField1->Text = "REST";
$additionalField1->Value = "1";


$Order->AdditionalFields = array();


$additionalField1 = new stdClass();
$additionalField1->Code = "REST";
$additionalField1->Text = "REST";
$additionalField1->Value = "REST";


$Order->MachineId = 'machineIdTest';
$Order->Discount = null;
$Order->ExternalReference = null;

$Order->BillingDetails = new stdClass();
$Order->BillingDetails->Address1 = 'Billing address 1';
$Order->BillingDetails->Address2 = 'Billing address 2';
$Order->BillingDetails->City = 'New York City';
$Order->BillingDetails->State = 'New York';
$Order->BillingDetails->CountryCode = 'US';
$Order->BillingDetails->Phone = 12345;
$Order->BillingDetails->Email = 'customer@email.com';
$Order->BillingDetails->FirstName = 'John';
$Order->BillingDetails->LastName = 'Doe';
$Order->BillingDetails->Company = 'ABC Company';
$Order->BillingDetails->Zip = '12345';
$Order->BillingDetails->FiscalCode = 13205628845;

/**/
$Order->DeliveryDetails = new stdClass();
$Order->DeliveryDetails->Address1 = 'Delivery address 1';
$Order->DeliveryDetails->Address2 = 'Delivery address 2';
$Order->DeliveryDetails->City = 'New York City';
$Order->DeliveryDetails->State = 'New York';
$Order->DeliveryDetails->CountryCode = 'US';
$Order->DeliveryDetails->Phone = '12345';
$Order->DeliveryDetails->Email = 'customer@email.com';
$Order->DeliveryDetails->FirstName = 'John';
$Order->DeliveryDetails->LastName = 'Doe';
$Order->DeliveryDetails->Zip = 12345;
/**/

$Order->PaymentDetails = new stdClass();
$Order->PaymentDetails->Type = "TEST";

$Order->PaymentDetails->Currency = "USD";
$Order->PaymentDetails->CustomerIP = '91.220.121.21';//"10.10.13.37";

$Order->PaymentDetails->PaymentMethod = new stdClass();
$Order->PaymentDetails->PaymentMethod->EesToken = “90007562-681b-4df5-9797-53faf8abbc92”;
$Order->PaymentDetails->PaymentMethod->Vendor3DSReturnURL = "https://example.com";
$Order->PaymentDetails->PaymentMethod->Vendor3DSCancelURL = "https://example.com";


try {
    $newOrder = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
    echo "newOrder: " . $e->getMessage();
    exit;
}

var_dump("newOrder", $Order);

Add a subscription plan/product

Overview

Use the addProduct method to create subscription plans/products for your 2Checkout account. 

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.

Product

Required (object)

 

Use this object to configure your subscription plans/products.

 

You can set all Product parameters except AvangateID and GroupName. The 2Checkout system sets the unique product ID. The AvangateID and GroupName are not editable.

Mandatory parameters

 

ProductName
ProductCode
PricingConfigurations

Response

bool(true)

Request

<?php
 
require ('PATH_TO_AUTH');
 
$Product = new stdClass();
$Product->AvangateId = null;
$Product->ProductCode = 'API_Imported_1234567899';
$Product->ProductType = 'REGULAR';
$Product->ProductName = 'API_Subscription Imported New';
$Product->ProductVersion = '1.0';
 
//Shipping classes
 
/* $Product->ShippingClass = new stdClass();
$Product->ShippingClass->Name = '2o9rlujkvg';
$Product->ShippingClass->Amount = 89.40;
$Product->ShippingClass->Currency = 'GBP';
$Product->ShippingClass->ApplyTo = 'ct29dr3fj4';
$Product->ShippingClass->Type = 'bii521vp6k'; */
 
$Product->GiftOption = false;
$Product->ShortDescription = 'Placeat cumque necessitatibus est minus praesentium ut non quibusdam. Molestias provident tempore eligendi mollitia quia.';
$Product->LongDescription = 'Corrupti inventore vitae nesciunt ab. Nemo cum non maiores. Non repudiandae est iste voluptatibus.';
$Product->SystemRequirements = null;
$Product->ProductCategory = null;
$Product->Platforms = array();
$Product->Platforms[0] = new stdClass();
$Product->Platforms[0]->PlatformName = null;
$Product->Platforms[0]->Category = null;
$Product->Platforms[1] = new stdClass();
$Product->Platforms[1]->PlatformName = null;
$Product->Platforms[1]->Category = null;
$Product->ProductImages = array();
$Product->ProductImages[0] = new stdClass();
$Product->ProductImages[0]->URL = null;
$Product->ProductImages[0]->Default = false;
$Product->ProductImages[1] = new stdClass();
$Product->ProductImages[1]->URL = null;
$Product->ProductImages[1]->Default = true;
$Product->TrialUrl = null;
$Product->TrialDescription = null;
$Product->Enabled = True;
 
//Product additional fields
 
/* $Product->AdditionalFields = array();
$Product->AdditionalFields[0] = new stdClass();
$Product->AdditionalFields[0]->Label = 'i44wak1dzp';
$Product->AdditionalFields[0]->Code = 'ITYAK0OEWJ';
$Product->AdditionalFields[0]->Enabled = false;
$Product->AdditionalFields[0]->Required = false;
$Product->AdditionalFields[0]->URLParameter = 'id1ktigl6d';
$Product->AdditionalFields[1] = new stdClass();
$Product->AdditionalFields[1]->Label = 'aig699lmo1';
$Product->AdditionalFields[1]->Code = 'V28TP07PQN';
$Product->AdditionalFields[1]->Enabled = false;
$Product->AdditionalFields[1]->Required = true;
$Product->AdditionalFields[1]->URLParameter = '8to9p6y54j'; */
 
//Product localization
 
/* $Product->Translations = array();
$Product->Translations[0] = new stdClass();
$Product->Translations[0]->Name = 'zsg7wtg4e5';
$Product->Translations[0]->Description = 'Voluptate iure ut quam omnis impedit. Deserunt facere id dolores doloribus quis. Minima nostrum ut possimus incidunt vel est sint. Odit tempora omnis iste nesciunt commodi accusantium placeat.';
$Product->Translations[0]->Language = 'pt';
$Product->Translations[0]->LongDescription = 'Pariatur molestiae sit dignissimos modi. Aut modi libero numquam repudiandae. Doloribus explicabo delectus fugiat amet. Excepturi quo consequatur sint adipisci.';
$Product->Translations[0]->SystemRequirements = 'c16tvyg88c';
$Product->Translations[0]->TrialUrl = 'UNCAUGHT TYPE: anyURI';
$Product->Translations[0]->TrialDescription = 'Voluptas rem sit ut voluptas molestias quidem ut. Maiores facilis tempora voluptates. Consequuntur illum recusandae hic magni iste.';
$Product->Translations[1] = new stdClass();
$Product->Translations[1]->Name = 'cv2sx15aby';
$Product->Translations[1]->Description = 'Ut distinctio asperiores et a placeat voluptatem et. Et eveniet temporibus aut vel. Nemo occaecati praesentium dolor fugiat rerum assumenda expedita.';
$Product->Translations[1]->Language = 'fr';
$Product->Translations[1]->LongDescription = 'Et ut nostrum molestiae voluptates soluta. Molestiae cum in ut qui. Voluptatem voluptates vero odit quia corporis. In impedit eligendi sed expedita nihil temporibus nobis.';
$Product->Translations[1]->SystemRequirements = 'cfv2amk25j';
$Product->Translations[1]->TrialUrl = 'UNCAUGHT TYPE: anyURI';
$Product->Translations[1]->TrialDescription = 'Voluptatem ut possimus consequatur iste. Recusandae id quia sed quibusdam aut debitis. Cupiditate harum architecto quod quia.'; */
 
 
$Product->PricingConfigurations = array();
$Product->PricingConfigurations[0] = new stdClass();
$Product->PricingConfigurations[0]->Default = false;
$Product->PricingConfigurations[0]->Code = null;
$Product->PricingConfigurations[0]->Name = 'API Pricing Configuration Test';
$Product->PricingConfigurations[0]->BillingCountries = array();
$Product->PricingConfigurations[0]->PricingSchema = 'DYNAMIC';
$Product->PricingConfigurations[0]->PriceType = 'NET';
$Product->PricingConfigurations[0]->DefaultCurrency = 'USD';
$Product->PricingConfigurations[0]->Prices = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular = array();
$Product->PricingConfigurations[0]->Prices->Regular[0] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular[0]->Amount = 100;
$Product->PricingConfigurations[0]->Prices->Regular[0]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Regular[0]->MinQuantity = 1;
$Product->PricingConfigurations[0]->Prices->Regular[0]->MaxQuantity = 10;
$Product->PricingConfigurations[0]->Prices->Regular[0]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Regular[1] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular[1]->Amount = 200;
$Product->PricingConfigurations[0]->Prices->Regular[1]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Regular[1]->MinQuantity = 11;
$Product->PricingConfigurations[0]->Prices->Regular[1]->MaxQuantity = 100;
$Product->PricingConfigurations[0]->Prices->Regular[1]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Renewal = array();
$Product->PricingConfigurations[0]->Prices->Renewal[0] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Renewal[0]->Amount = 50;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Renewal[0]->MinQuantity = 1;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->MaxQuantity = 10;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Renewal[1] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Renewal[1]->Amount = 60;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Renewal[1]->MinQuantity = 11;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->MaxQuantity = 100;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->OptionCodes = array();
$Product->PricingConfigurations[0]->PriceOptions = array();
 
/* $Product->BundleProducts = array();
$Product->BundleProducts[0] = new stdClass();
$Product->BundleProducts[0]->ProductCode = '540Q45PQBN';
$Product->BundleProducts[0]->ProductId = 48439;
$Product->BundleProducts[1] = new stdClass();
$Product->BundleProducts[1]->ProductCode = 'PA3JDB5SZ2';
$Product->BundleProducts[1]->ProductId = 46439;
 */
$Product->Fulfillment = 'NO_DELIVERY';
$Product->Prices = array();
 
$Product->GeneratesSubscription = True;
$Product->SubscriptionInformation = new stdClass();
$Product->SubscriptionInformation->DeprecatedProducts = array();
$Product->SubscriptionInformation->BundleRenewalManagement = null;
$Product->SubscriptionInformation->BillingCycle = 1;
$Product->SubscriptionInformation->BillingCycleUnits = 'M';
$Product->SubscriptionInformation->IsOneTimeFee = false;
 
$Product->SubscriptionInformation->ContractPeriod = new stdClass();
$Product->SubscriptionInformation->ContractPeriod->Period = -1;
$Product->SubscriptionInformation->ContractPeriod->PeriodUnits = 'days';
$Product->SubscriptionInformation->ContractPeriod->IsUnlimited = TRUE;
$Product->SubscriptionInformation->ContractPeriod->Action = 'RESTART';
$Product->SubscriptionInformation->ContractPeriod->EmailsDuringContract = 'altenwerth.elise@gmail.com';
 
//$Product->SubscriptionInformation->UsageBilling = 77;
 
$Product->SubscriptionInformation->GracePeriod = new stdClass();
$Product->SubscriptionInformation->GracePeriod->Type = 'GLOBAL';
$Product->SubscriptionInformation->GracePeriod->Period = 14;
$Product->SubscriptionInformation->GracePeriod->PeriodUnits = 'D';
$Product->SubscriptionInformation->GracePeriod->IsUnlimited = false;
 
$Product->SubscriptionInformation->RenewalEmails = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Type = 'CUSTOM';
$Product->SubscriptionInformation->RenewalEmails->Settings = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before30Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before15Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before7Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before1Day = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->OnExpirationDate = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->After5Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->After15Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before30Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before15Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before7Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before1Day = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->OnExpirationDate = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->After5Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->After15Days = true;
 
$Product->FulfillmentInformation = new stdClass();
$Product->FulfillmentInformation->IsStartAfterFulfillment = false;
$Product->FulfillmentInformation->IsElectronicCode = false;
$Product->FulfillmentInformation->IsDownloadLink = false;
$Product->FulfillmentInformation->IsBackupMedia = false;
$Product->FulfillmentInformation->IsDownloadInsuranceService = false;
$Product->FulfillmentInformation->IsInstantDeliveryThankYouPage = false;
$Product->FulfillmentInformation->IsDisplayInPartnersCPanel = false;
 
/* $Product->FulfillmentInformation->CodeList = new stdClass();
$Product->FulfillmentInformation->CodeList->Code = '5C6F821DA1';
$Product->FulfillmentInformation->CodeList->Name = 'General delivery';
$Product->FulfillmentInformation->CodeList->Type = 'STATIC';  */
 
//$Product->FulfillmentInformation->BackupMedia = new stdClass();
 
//$Product->FulfillmentInformation->ProductFile = new stdClass();
 
/* $Product->FulfillmentInformation->AdditionalInformationByEmail = 'arlene03@hotmail.com';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations = array();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0] = new stdClass();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Name = 'kbaa1aj7po';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Description = 'Velit delectus sed amet sunt. Sunt deserunt quos recusandae consequuntur est. Velit aut optio error eius rerum. Nihil ipsam possimus ipsum dolores consequatur adipisci.';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[0]->Language = 'fr';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1] = new stdClass();
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Name = 'l4ocvz9wwa';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Description = 'Esse voluptatem delectus officiis eos quas asperiores. Quas non hic reiciendis enim. Consequatur similique recusandae laboriosam et autem.';
$Product->FulfillmentInformation->AdditionalInformationEmailTranslations[1]->Language = 'pt';
$Product->FulfillmentInformation->AdditionalThankYouPage = 'rvlhvkmxkp';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations = array();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0] = new stdClass();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Name = 'rl981w4nua';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Description = 'Qui explicabo molestiae dolorem consequuntur. Ullam maiores temporibus vitae. Totam eos et consequatur. Est sit minima animi nam ut aut.';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[0]->Language = 'en';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1] = new stdClass();
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Name = 'qye8hlwz3e';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Description = 'Id est rerum deserunt non et quia magnam. Minus aut nostrum dicta est officiis quia. Commodi nobis sit porro accusamus rerum quis. Fugit et asperiores eum.';
$Product->FulfillmentInformation->AdditionalThankYouPageTranslations[1]->Language = 'fr';
 */
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'addProduct',
'params' => array($sessionID, $Product)
);
 
$addedProduct = callRPC($jsonRpcRequest, $host);
var_dump ($addedProduct);

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo