Skip to main content

Create percentage discount

Overview

Use setPromotionDiscount via JSON-RPC API 4.0 to set a percentage-based promotion discount.

Parameters

Parameter Type/Description

sessionID

Required (string)

 

Output of the Login method.

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to set the discount for.

promotionDiscount

Required(Object)

 

Type

Required (String)

 

 

Discount type:

  • PERCENT, use in combination with Value
  • FIXED, use in combination with Values and DefaultCurrency

 

Value / Values

Required (Int / Array of objects)

 

 

  • Value = Int, determines the discount percentage from 0 to 100
  • Values = Array of Value objects

 

 

Value

Required (Object)

 

 

 

Currency

Required (String)

 

 

 

 

Discount currency ISO code (ISO 4217).

 

 

 

Amount

Required (Int)

 

 

 

 

Discount amount in corresponding currency.

 

DefaultCurrency

Required (String)

 

 

Default discount currency ISO code (ISO 4217).

Response

Parameter Type/Description
promotionDiscount 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);

// Promotion code assigned to the promotion you want to update
$promotionCode = '';

$promotionDiscount = new stdClass;
$promotionDiscount->Type = 'PERCENT';
$promotionDiscount->Value= '25';

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'setPromotionDiscount',
'params' => array($sessionID, $promotionCode, $promotionDiscount)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));

Set an external reference for an upgrade

Overview

Use the setExternalRef method in conjunction with setSubscriptionUpgrade.

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.

externalRef

Required (string)

 

External reference you control.

Response

Parameters Type/Description

Boolean

true or false depending on whether or not the operation succeeded.

Request

<?php

require ('PATH_TO_AUTH');

$externalReference = 'YOUR_EXTERNAL_REFERENCE';

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

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

Order session content

Overview

The object below is returned directly or within a successful response from the following API requests:

Retrieve session content                              Retrieve contents with prefill                                         Retrieve VAT or sales tax

Session contents object

Parameters                                                                                                       Type/Description

Errors

 

Array of strings

 

 

Payment gateway processing errors.

Items

Array of objects

    Details below. 

 

ProductDetails

Object

      Details below. 

 

 

Name

String

 

 

 

Product name.

    ShortDescription String
      Product short description.
    Tangible Boolean
     

Possible values:

  • TRUE - for physical products
  • FALSE - for digital products
    IsDynamic Boolean
     

Possible values:

  • TRUE - for dynamic products
  • FALSE - for catalog products

 

 

ExtraInfo

String

 

 

 

The text entered in the Additional information field when generating Buy links, or via the INFO[PRODUCT_ID] parameter used in Buy links.

 

 

RenewalStatus

Boolean

 

 

 

  • TRUE for orders renewing subscriptions.
  • FALSE for all other orders: new purchases, upgrades.

 

 

Subscriptions

Object

        Details below. 

 

 

 

SubscriptionReference

String

 

 

 

 

Unique, system-generated subscription identifier.

 

 

 

PurchaseDate

String

 

 

 

 

The date time stamp when shoppers acquired their subscriptions corresponding to the moment when the 2Checkout system marks the purchase as finished. Format (YYYY-MM-DD HH:mm:ss). Default GMT+02:00.

 

e.g. 2015-08-11 15:18:52

 

 

 

SubscriptionStartDate

String

 

 

 

 

 

Example: 2015-09-29 17:57:59

 

 

 

ExpirationDate

String

 

 

 

 

The date time stamp of upcoming renewal/expiration for subscriptions not taking into account grace period settings.

 

Format (YYYY-MM-DD HH:mm:ss). Default GMT+02:00.

 

e.g. 2015-09-11 15:18:52

 

 

 

Lifetime

Boolean

 

 

 

 

  • TRUE – For non-recurring, evergreen subscriptions.
  • FALSE– For recurring subscriptions with a specific billing cycle from 7 days to 36 months.

 

 

 

Trial

Boolean

 

 

 

 

  • TRUE – For trial subscriptions.
  • FALSE– For non-trial, recurring subscriptions with a specific billing cycle from 7 days to 36 months.

 

 

 

Enabled

Boolean

 

 

 

 

  • TRUE – For active and past due subscriptions.
  • FALSE– For expired and cancelled subscriptions.

 

 

 

RecurringEnabled

Boolean

 

 

 

 

  • TRUE - customers opted for subscriptions to renew automatically when they expire.
  • FALSE- customers did not choose to renew the subscription automatically.

                    

PriceOptions

Array of strings

 

 

Product price options.

 

Price

Object

 

 

This object returns the price per unit at order line level.

 

In the case of trials, the object returns the costs for the trial to full subscription conversion.

 

 

UnitNetPrice

Float

 

 

 

The value per product unit, excluding sales tax/VAT expressed in the payment currency.

 

 

UnitGrossPrice

Float

 

 

 

Total value per product unit, including sales tax/VAT expressed in the payment currency. UnitGrossPrice does not reflect any discounts.

 

 

UnitVAT

Int
 

 

 

Sales tax/VAT per product unit expressed in the payment currency.

 

 

UnitDiscount

Int

 

 

 

Value of the discount per product unit expressed in the payment currency.

 

 

UnitNetDiscountedPrice

Float

 

 

 

The value per product unit, expressed in the payment currency, excluding sales tax/VAT, from which 2Checkout deducts the unit discount.

 

 

UnitGrossDiscountedPrice

Float

 

 

 

Total costs shoppers incur per product unit, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts.

 

 

UnitAffiliateCommission

Int

 

 

 

Value of the affiliate commission per product unit calculated expressed in the payment currency.

 

2Checkout deducts discounts from the costs incurred by shoppers before calculating affiliate commissions.

 

2Checkout does not take into account shipping costs when calculating affiliate commissions.

 

NULL when 2Checkout does not apply an affiliate commission.

    VATPercent Int
      Percentage of VAT charged on the order.
    HandlingFeeNetPrice Int
      Handling fee applied to your net price configuration. 
    HandlingFeeGrossPrice Int
      Handling fee applied to your gross price configuration.

 

 

Currency

Optional (string)

 

 

 

The currency ISO code for the payment - ISO 4217. Example: usd.

 

 

NetPrice

Optional (double)

 

 

 

The value per order line, excluding sales tax/VAT expressed in the payment currency.

 

 

GrossPrice

Optional (double)

 

 

 

Total value per order line, including sales tax/VAT expressed in the payment currency. UnitGrossPrice does not reflect any discounts.

 

 

NetDiscountedPrice

Optional (double)

 

 

 

The NetPrice value per order line, excluding sales tax/VAT, from which 2Checkout deducts discounts. NetDiscountedPrice is expressed in the payment currency.

 

 

GrossDiscountedPrice

Optional (double)

 

 

 

Total costs shoppers incur per order line, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts.

 

Example:

  • UnitNetPrice: 99
  • UnitGrossPrice: 120.39
  • UnitVAT: 21.39
  • UnitDiscount: 9.9
  • UnitNetDiscountedPrice: 89.1
  • UnitGrossDiscountedPrice: 110.49
  • UnitAffiliateCommission: 22.28
  • Currency: "usd"
  • NetPrice: 198
  • GrossPrice: 240.77
  • NetDiscountedPrice: 178.2
  • GrossDiscountedPrice: 220.97
  • Discount: 19.8
  • VAT: 42.77
  • AffiliateCommission: 44.56

 

 

Discount

Optional (double)

 

 

 

Value of the discounts per order line expressed in the payment currency.

 

 

VAT

Optional (double)

 

 

 

Value of sales tax/VAT per order line expressed in the payment currency.

 

 

AffiliateCommission

Optional (double)

 

 

 

Value of the affiliate commission per order line, calculated from the NetDiscountedPrice expressed in the payment currency. Or NULL. 2Checkout does not take into account shipping costs when calculating affiliate commissions.

  LineItemReference String
    System-generated item reference.
  PurchaseType String
   

Possible values:

  • PRODUCT
  • SHIPPING
  • TAX
  • COUPON
  ExternalReference String
    External order reference that you control.

 

Code

String

 

 

Unique product identifier your control. Max length 256 characters.

 

Quantity

Int

 

 

Number of units

 

SKU

String

 

 

SKU identifier.

 

CrossSell

Object

      Details below. 

 

 

ParentCode

String

 

 

 

The product code of the master product you set to trigger the campaign.

 

 

CampaignCode

String

 

 

 

Unique, system-generated identifier for cross-sell campaigns.

 

Trial

Object

      Details below. 

 

 

Period

Int

 

 

 

The length of the trial subscription lifetime in days.

 

 

GrossPrice

Float

 

 

 

Total trial price in the payment currency before 2Checkout deducts any taxes, discounts, etc.

 

 

VAT

Float

 

 

 

The total value of taxes for the trial in the payment currency, before 2Checkout deducts any discounts.

 

 

NetPrice

Float

 

 

 

Total trial price in the payment currency, not including taxes, before 2Checkout deducts any discounts.

 

AdditionalFields

Array of objects

      Details below. 

 

 

Code

String

 

 

 

The alpha-numeric characters, underscores and dashes that are set as the field identifier.

 

 

Text

String

 

 

 

Field text visible to shoppers in the cart.

 

 

Value

String

 

 

 

Selected field value.

 

Promotion

Object

      Details below. 

 

 

Name

String

 

 

 

Promotion name.

 

 

Description

String

 

 

 

Promotion description.

 

 

StartDate

String

 

 

 

The date when you set the promotion to start. NULL for promotions that start immediately after you create them.

 

 

EndDate

String

 

 

 

The date when you set the promotion to end. NULL for promotions you want active indefinitely.

 

 

MaximumOrdersNumber

Int

 

 

 

2Checkout only applies the promotion to a maximum number of orders you define.

 

Can be NULL if you want the promotion to apply to an unlimited number of orders.

 

 

MaximumQuantity

Int

 

 

 

Discount only applies to a maximum number of units purchased through a single order, smaller than the quantity you defined. Shoppers purchase any extra units at full price. Can be NULL if you want the promotion to apply to an unlimited number units.

 

 

InstantDiscount

Boolean

 

 

 

The instant discount option auto-applies the discount for ALL selected products, without the need for shoppers to enter a discount coupon.

 

 

Coupon

String

 

 

 

Promotion coupon/voucher.

 

 

DiscountLabel

String

 

 

 

Discounts can be set as a percentage from the product price or as a fixed amount in the chosen currency.

 

 

Enabled

String

 

 

 

true or false, depending on whether a promotion is active or disabled. 

 

 

Type

String

 

 

 

  • REGULAR – product/cart line level discounts.
  • ORDER – quantity discounts.
  • GLOBAL – order-level discounts.

Promotions

Array of objects

    Details below. 

 

Name

String

 

 

Promotion name.

 

Description

String

 

 

Promotion description.

 

StartDate

String

 

 

The date when you set the promotion to start. NULL for promotions that start immediately after you create them.

 

EndDate

String

 

 

The date when you set the promotion to end. NULL for promotions you want active indefinitely.

 

MaximumOrdersNumber

Int

 

 

2Checkout only applies the promotion to a maximum number of orders you define.

 

Can be NULL if you want the promotion to apply to an unlimited number of orders.

 

MaximumQuantity

Int

 

 

Discount only applies to a specific number of units purchased at once, smaller than the maximum quantity you defined. Shoppers purchase any extra units at full price. Can be NULL if you want the promotion to apply to an unlimited number units.

 

InstantDiscount

Boolean

 

 

The instant discount option auto-applies the discount for ALL selected products, without the need for shoppers to enter a discount coupon.

 

Coupon

String

 

 

Promotion coupon/voucher.

 

DiscountLabel

String

 

 

Discounts can be set as a percentage from the product price or as a fixed amount in the payment currency.

 

Enabled

String

 

 

true or false, depending on whether a promotion is active or disabled. 

 

Type

String

 

 

  • REGULAR – product/cart line level discounts.
  • ORDER – quantity discounts.
  • GLOBAL – order-level discounts.

AdditionalFields

Array of objects

    Details below. 

 

Code

String

 

 

The alpha-numeric characters, underscores and dashes that are set as the field identifier.

 

Text

String

 

 

Field text visible to shoppers in the cart.

 

Value

String

 

 

Selected field value.

BillingDetails

Object

Details below

  Person      

Object

Details below

    FirstName   String
  Customer first billing name.
    LastName   String
  Customer last billing name.
    CountryCode   String
  Two-letters code for customer billing country.
    State   String
  Customer billing state.
    City   String
  Customer billing city.
    Address1   String
  Customer billing address.
    Address2   String
  Customer additional address information.
    Zip   String
        Customer billing zip code.
    Email   String
        Customer billing email.
    Phone   String
        Customer billing phone.
    Company   String
        Customer billing company.
    FiscalCode   String
  Customer billing fiscal code.
DeliveryDetails

Object

Details below

  Person      

Object

Details below

    Phone   String
  Customer delivery phone number.
    FirstName   String
  Customer delivery first name.
    LastName   String
  Customer delivery last name.
    Company   String
  Customer delivery company.
    Email   String
  Customer delivery email.
    Address1   String
  Customer delivery address.
    Address2   String
  Customer additional delivery address.
    City   String
  Customer delivery city.
    Zip   String
  Customer delivery zip code.
    CountryCode   String
  Customer delivery country code.
    State   String
  Customer delivery state.
DeliveryInformation

Object

Details below

  ShippingMethod    

Object

Details below

    Code     String
          System-generated code assigned to the shipping method.
    TrackingURL   String
          Tracking URL assigned to the shipping method. 
    TrackingNumber   String
        Tracking Number provided to customers, used for obtaining more information about their package.
    Comment   String
  Additional information regarding the physical delivery of the product.

Currency

String

 

The currency ISO code for the payment - ISO 4217. Example: usd.

NetPrice

Float

 

Order value excluding sales tax/VAT expressed in the payment currency.

GrossPrice

Float

 

Total order value, including sales tax/VAT expressed in the payment currency. GrossPrice does not reflect any discounts.

NetDiscountedPrice

Float

 

The NetPrice order value excluding sales tax/VAT, from which 2Checkout deducts discounts. NetDiscountedPrice is expressed in the payment currency.

GrossDiscountedPrice

Float

 

Total costs shoppers incur, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts.

 

For example:

  • Currency: "usd"
  • NetPrice: 396
  • GrossPrice: 486.29
  • NetDiscountedPrice: 376.2
  • GrossDiscountedPrice: 466.49
  • Discount: 19.8
  • VAT: 90.29
  • AffiliateCommission: 94.05

Discount

Float

 

Value of the discounts for an order expressed in the payment currency.

VAT

Float

 

Value of sales tax/VAT expressed in the payment currency.

AffiliateCommission

Float

 

Value of the affiliate commission for the order calculated from the NetDiscountedPrice expressed in the payment currency. Or NULL. 2Checkout does not take into account shipping costs when calculating affiliate commissions.

Create fixed discount

Overview

Use setPromotionDiscount to set a fixed promotion discount.

Parameters

Parameter Type/Description

sessionID

Required (string)

 

Output of the Login method.

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to set the discount for.

promotionDiscount

Required(Object)

 

Type

Required (String)

 

 

Discount type:

  • PERCENT, use in combination with Value
  • FIXED, use in combination with Values and DefaultCurrency

 

Value / Values

Required (Int / Array of objects)

 

 

  • Value = Int, determines the discount percentage from 0 to 100
  • Values = Array of Value objects

 

 

Value

Required (Object)

 

 

 

Currency

Required (String)

 

 

 

 

Discount currency ISO code (ISO 4217).

 

 

 

Amount

Required (Int)

 

 

 

 

Discount amount in the corresponding currency.

 

DefaultCurrency

Required (String)

 

 

Default discount currency ISO code (ISO 4217).

Response

Parameter Type/Description
promotionDiscount Object

Request

<?php
require ('PATH_TO_AUTH');

// Promotion code assigned to the promotion you want to update
$promotionCode = 'MY_PROMO_CODE';

$promotionDiscount = new stdClass;
$promotionDiscount->Type = 'FIXED';
$promotionDiscount->DefaultCurrency = 'USD';

// Define the first discount object for a specific currency
$discount1 = new stdClass;
$discount1->Currency = 'USD';
$discount1->Amount = 22;

// Define the second discount object for a specific currency
$discount2 = new stdClass;
$discount2->Currency = 'EUR';
$discount2->Amount = 50;

$promotionDiscount->Values = [$discount1, $discount2];

try {
    $updatedPromotion = $client->setPromotionDiscount($promotionCode, $promotionDiscount);
}

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

var_dump("UpdatedPromotion", $updatedPromotion);

 

Retrieve product info by code

Overview

Use getProductByCode to extract product information using the unique identifier you assign to subscription plans/products.  

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.

ProductCode

String

 

The product code that you control.

Response

Parameters Type/Description
Product Object

Request

<?php

require ('PATH_TO_AUTH');

$ProductCode = "subscr1";

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getProductByCode',
'params' => array($sessionID, $ProductCode)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));

?>

Remove promotion coupon

Overview

Use the deletePromotionCoupon method via SOAP API 4.0 to remove multiple coupons from a promotion. You cannot delete a single coupon. A coupon is required for the promotion.

Parameters

Parameter Type/Description

sessionID

Required (string)

 

Output of the Login method.

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to remove coupons from.

promotionCoupon

Required (object)

 

Type

Required (string)

 

 

Coupon type. Available values:

  • MULTIPLE, use in conjunction with Codes

 

Code/Codes

Required (string/array of strings)

 

 

Array of coupon codes (for MULTIPLE).

Response

Parameter Type/Description
promotionCoupon Object

Request

<?php 

class Client
{
    protected static $merchantCode;
    protected static $loginDate;
    protected static $hash;
    protected static $baseUrl;
    protected static $callCount = 0;
    protected static $sessionId = '';

    protected static $client;

    public static function setCredentials($code, $key)
    {
        static::$merchantCode = $code;
        static::$loginDate = gmdate('Y-m-d H:i:s');
        static::$hash = hash_hmac('md5', strlen($code) . $code . strlen(static::$loginDate) . static::$loginDate, $key);
        static::$sessionId = static::login();
    }

    public static function setBaseUrl($url)
    {
        static::$baseUrl = $url;
    }

    public static function login()
    {
        $client = static::getClient();
        return $client->login(static::$merchantCode, static::$loginDate, static::$hash);
    }

    public static function __callStatic($name, $arguments = array())
    {
        $client = static::getClient();

        array_unshift($arguments, static::$sessionId);
        $response = call_user_func_array(array($client, $name), $arguments);

        return $response;
    }

    protected static function getClient()
    {
        $opts = array(
            'http'=> ['user_agent' => 'PHPSoapClient'],
            'ssl' => [
                'verify_peer' => false,
                'verify_peer_name' => false,
            ],
        );

        if (null === static::$client) {
            static::$client = new \SoapClient(static::$baseUrl . '?wsdl', [
                'location' => static::$baseUrl,
                'cache_wsdl' => WSDL_CACHE_NONE,
                'stream_context' => stream_context_create($opts),
            ]);
        }

        return static::$client;
    }
}

Client::setBaseUrl('https://api.2checkout.com/soap/3.1/');
Client::setCredentials('YOUR_MERCHANT_CODE', 'YOUR_SECRET_KEY');
Client::login();

$promotionCode = 'YOUR_PROMOTION_CODE'; // code of the promotion that you want to update

// // Select single coupon object
// $promotionCoupon = new stdClass;
// $promotionCoupon->Type = 'SINGLE';
// $promotionCoupon->Code = 'YOUR_CODE_HERE';

// // Select multiple coupon object
// $promotionCoupon = new stdClass;
// $promotionCoupon->Type = 'MULTIPLE';
// $promotionCoupon->Codes = ['YOUR_CODE_1', 'YOUR_CODE_2'];

$response = Client::deletePromotionCoupon ($promotionCode,$promotionCoupon); // Delete selected coupons
var_dump($response);

 

Use free orders

Overview

Place an order with dynamic order information without requiring any payment information from the customers.

Requirements

The final order price has to be 0. Either use products with zero price, or add a promotion for 100% of the total order price. Recurring options should not be sent. Set the PaymentDetails type to FREE.

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.

Request

<?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 = 0; // should be 0
$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 = 0;
$Order->Items[0]->PriceOptions[] = $priceOption;

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

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



/*
 * 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 = 0; // should be 0
$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 = 0; // should be 0
$Order->Items[3]->IsDynamic = true;


/**
 * 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 = 0;
$Order->Items[4]->Price = new stdClass();
$Order->Items[4]->Price->Amount = 0; // should be 0, or the amount should be the opposite to the one send in the order
$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 = 'machineIdTestDan';
$Order->Discount = null;
$Order->ExternalReference = null;

$Order->BillingDetails = new stdClass();
$Order->BillingDetails->Address1 = 'John';
$Order->BillingDetails->Address2 = 'Doe';
$Order->BillingDetails->City = 'New York City';
$Order->BillingDetails->State = 'New York';
$Order->BillingDetails->CountryCode = 'US';
$Order->BillingDetails->Phone = 12345;
$Order->BillingDetails->Email = 'shopper@2checkout.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 details 1';
$Order->DeliveryDetails->Address2 = 'Delivery detais 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 = 'FREE';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = false;

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

var_dump("newOrder", $newOrder);
 

Use Purchase order flow

Overview 

Place an order using catalog products, and collect the payment using the Purchase Order flow.

Requirements

You have to send the InternalPONumber and AutoApprove parameters to place a Purchase Order. The company name is mandatory when placing an order via PO.

Currency support 

Check with Avangate support for a list of currencies available for Purchase Order. 

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.

Order

Required (Object)

 

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

 

Workflow 

  1. The customer is placing the order using Purchase Order as the ordering flow, filling in the internal PO number as mandatory information.
  2. You are able to set the order to auto-approve as soon as the purchase order is submitted. Otherwise, you have to approve/cancel it manually from Control Panel.
  3. After the order is placed, the order confirmation e-mail is sent, including the payment instructions and payment terms agreed.
  4. The order is finalized as soon as the payment is confirmed.
  5. If payment is not received according to the terms, the order is canceled.

Response 

Parameters Type/Description

Order information

Object

  Object containing order information.

Request

<?php

require ('PATH_TO_AUTH');

$Order = new stdClass();
$Order->RefNo = NULL;
$Order->Currency = 'usd';
$Order->Country = 'US';
$Order->Language = 'en';
$Order->CustomerIP = '91.220.121.21';
$Order->ExternalReference = NULL;
$Order->Source = NULL;
$Order->Affiliate = new stdClass();
$Order->Affiliate->AffiliateCode = 'Partner123'
$Order->Affiliate->AffiliateSource = 'MobilePlatform'
$Order->CustomerReference = NULL;
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1';
$Order->Items[0]->Quantity = 1;
$Order->Items[0]->PriceOptions = NULL;
$Order->Items[0]->SKU = NULL;
$Order->Items[0]->Price = NULL;
$Order->Items[0]->CrossSell = NULL;
$Order->Items[0]->Trial = false;
$Order->Items[0]->AdditionalFields = NULL;
$Order->Items[0]->Promotion = NULL;
$Order->Items[0]->SubscriptionStartDate = NULL; //If empty or null, subscriptions become active when purchase is made.

$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'Test Cosmin API';
$Order->BillingDetails->LastName = 'Cosmin API';
$Order->BillingDetails->CountryCode = 'us';
$Order->BillingDetails->State = 'California';
$Order->BillingDetails->City = 'LA';
$Order->BillingDetails->Address1 = 'Address example';
$Order->BillingDetails->Address2 = NULL;
$Order->BillingDetails->Zip = '90210';
$Order->BillingDetails->Email = 'cosmin.deftu@avangate.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = 'ABC Company';
$Order->DeliveryDetails = NULL;


$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'PURCHASEORDER';
$Order->PaymentDetails->Currency = 'USD';
$Order->PaymentDetails->PaymentMethod = new stdClass();
$Order->PaymentDetails->PaymentMethod->AutoApprove = true;
$Order->PaymentDetails->PaymentMethod->InternalPONumber = 84864848;


$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;

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

var_dump("prevrefOrder", $prevrefOrder);

Retrieve order fields

Overview

Use the getAdditionalFields method to extract information about additional fields you set up for your account.

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.

Response

AdditionalFields

Array of orders

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);
 
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getAdditionalFields ',
'params' => array($sessionID)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));
 
?>

Import product data using XML files

Overview

2Checkout recommends that you use XML when importing product and pricing data into the system.

Availability

Importing XML files is available for all 2Checkout accounts.

Requirements

It's recommended that at least one product be configured in the 2Checkout system. This way you'll be able to download the offerings as an XML and access a schema that best fits your specific account.

Product

Use the Product object to create/add, update/edit, and retrieve subscription plans/products for your account. You can control:

  • Product information
  • Pricing
  • Subscription plan settings and renewal configuration
  • Subscription plan recurring billing
  • Fulfillment
  • Shipping classes
  • Localization

Import limitations

For optimal performance, we recommend importing batches of 20 to 30 products at once, and using XML files smaller than 750 MB.

At this point in time, the Import from URL functionality is not available for XML files.

Mandatory elements

Below is an example of the minimum required data for the importing process when using XML files:

<?xml version="1.0" encoding="UTF-8"?>
<Import>
<Products>
<Product enabled="1">
<ProductName><![CDATA[Product for import]]></ProductName>
<ProductCode><![CDATA[productforimportCODE12345]]></ProductCode>
<PricingConfigurations>
<PricingConfiguration default="1"><DefaultCurrency>EUR</DefaultCurrency></PricingConfiguration>
</PricingConfigurations>
</Product>
</Products>
</Import>

Product

<Product id="1234567" enabled="1"> - product is enabled

<Product id="1234567" > - product is disabled

<Product id="1234567" enabled="0"> - product is disabled

 

Product code (mandatory )

Product ID (optional)

Result

Existent

Missing

Product is updated

Existent

Existent

Product is updated

Existent

New (is ignored)

Product is updated

New

New (is ignored)

New product is added

New

Missing

New product is added

New

Existent

New product is added

Product code

Make sure to set unique product codes to identify your products in the 2Checkout system. In scenarios involving product import and export, the product code takes precedence over the product ID, which can be excluded altogether. While the system-generated ID is unique across the platform, the product code that you control needs to be unique only for standalone accounts. This enables you to perform such tasks as product migration from one 2Checkout account to another.

Pricing configuration

To import a product with the minimum required information, the Pricing configuration element must be included, along with the default currency. All other elements can be omitted.

How do I import an XML file?

To import existing product data from the 2Checkout platform:

  1. Make your way to Products under Setup.
  2. Click on Import.
  3. Click Choose file and select the XML stored on your machine.
  4. Hit Next step.
  5. The 2Checkout system validates the XML file.
  6. Click Start upload.

Parameters

Additional fields

Parameters Type/Description

AdditionalField

Object

Label

String

 

Field text.

Code

String

 

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

Type

String

 

Field type:

  • LISTBOX
  • CHECKBOX
  • TEXTBOX
  • HIDDEN

ApplyTo

Sting

 

  • ORDER
  • PRODUCT

Values

Array of values

 

Custom values you control.

ValidationRule

String

 

The validation rule restricting the type of information shoppers can enter in the additional field during the purchase process.

Translations

Array of objects

 

Details below.

Translation

Object

Label

String

 

Field text translated in the language of the Translations object.

Values

Object

 

Custom values you control translated in the language of the Translations object.

Language

String

 

ISO language code. (ISO 639-1 two-letter code).

Pricing

Parameter 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 Avangate 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).

 

Code

String

 

 

The code you set or that the Avangate 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 Avangate 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:

  • BASE corresponding to impact on base price
  • GLOBAL for impact on calculated sum.

 

 

Impact

String

 

 

 

Impact on price per unit:

  • ADD
  • SUBTRACT

 

 

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.

Required

boolean (0/1)

 

True if you made the pricing option group mandatory.

Product

Parameters Type/Description

Product

 

Object

AvangateId

Int

 

Unique, system-generated Avangate product ID. Read-only.

ProductCode

String

 

The product code that you can define for each of your offerings. Needs to be unique.

ProductType

String

 

REGULAR or BUNDLE

ProductName

String

 

The name of the product

ProductVersion

String

 

The product version number

GroupName

String

 

The name of the Product Group to which the product belongs. Cannot be edited as part of the addProduct call.

ShippingClass

Object

 

Existing shipping class object with the structure detailed below.

 

Name

String

 

 

The name of the shipping class

 

Amount

Decimal

 

 

The shipping costs

 

Currency

String

 

 

The currency ISO code used for shipping costs - ISO 4217.

 

ApplyTo

String

 

 

Possible values:

• PRODUCT

• ORDER

 

Type

Possible values:

• FIXED

• PERCENT

GiftOption

boolean

 

True or false depending on whether the product can be gifted or not.

ShortDescription

String

 

The product's short description

LongDescription

String

 

The product's long description

SystemRequirements

String

 

System requirements

ProductCategory

String

 

Product category

Platforms

Array of Platform objects

 

Array of objects detailing the platforms supported by the application. Details below.

 

PlatformName

String

 

 

The label of the platform per the product configuration.

 

Category

String

 

 

Platform category per product configuration. 

ProductImages

Array of Image objects

 

Image object. Details below. Read-only.

 

Default

Boolean

 

 

True or False depending on whether you set the image stored at the address in the URL parameter as default or not.

 

URL

String

 

 

The location of the image on the Avangate system.

TrialUrl

String (anyURI)

 

The URL from where shoppers can download trial software.

TrialDescription

String

 

Descriptive text entered for trials.

Enabled

Boolean

 

True/false depending on whether the products are active or disabled. When empty, Avangate marks the product as disabled.  

AdditionalFields

Array of AdditionalFieldAssigned objects

 

Array of existing additional fields assigned to products. Details below.

 

Label

String

 

 

The name of the additional field assigned to a product.

 

Code

String

 

 

The code of the additional field assigned to a product.

 

Enabled

Boolean

 

 

True or false depending on whether the assigned product field is enabled or not.

 

Required

Boolean

 

 

True or false depending on whether the assigned product field is required or not.

 

URLParameter

String

 

 

The value of the system generated URL parameter for the product field that can be used in Buy Links.

Translations

Array of ProductTranslation objects

 

Details below.

 

LongDescription

String

 

 

The translated long description in the language corresponding to the Translation object.

 

TrialUrl

String

 

 

The trial URL for users speaking the language corresponding to the Translation object.

 

TrialDescription

String

 

 

 

 

SystemRequirements

String

 

 

Localized system requirements.

 

Name

String

 

 

Localized product name.

 

Description

String

 

 

Localized product short description.

 

Language

String

 

 

ISO 639-1 two-letter code.

PricingConfigurations

Array of PricingConfiguration objects

 

Details below. Avangate creates pricing configurations during the process when you add a product.

 

Name

String

 

 

Pricing configuration name

 

Code

String

 

 

System-generated identifier.

 

Default

boolean (0/1)

 

 

True for the default pricing configuration

 

BillingCountries

Array of strings

 

 

ISO codes of the countries assigned to the pricing configuration.

Empty unless specific countries are assigned to a pricing configuration.

 

PricingSchema

String

 

 

DYNAMIC – With a base price

FLAT – Without a base price

 

PriceType

String

 

 

Possible values:  NET / GROSS

 

DefaultCurrency

String

 

 

The ISO code of the default currency for the pricing configuration

 

Prices

Object

 

 

Details below.

 

Regular

Array of objects

 

 

Details below.

 

Amount

Int

 

 

The price of the product.

 

Currency

String

 

 

ISO code of the currency for the product price.

 

MinQuantity

Int

 

 

The minimum quantity of volume discounts. Default is 1.

 

MaxQuantity

Int

 

 

The maximum quantity of volume discounts. Default is 99999.

 

OptionCodes

Array of objects

 

 

Details below.

 

Code

String

 

 

Price option identifier.

 

Options

Array of strings

 

 

The pricing options group option code you configured that the Avangate system uses to calculate product prices for pricing configurations without a base price.

 

Renewal

Array of objects

 

 

Details below.

 

Amount

Int

 

 

The price of the product.

 

Currency

String

 

 

ISO code of the currency for the product price.

 

MinQuantity

Int

 

 

The minimum quantity of volume discounts. Default is 1.

 

MaxQuantity

Int

 

 

The maximum quantity of volume discounts. Default is 99999.

 

OptionCodes

Array of PriceOptionCode objects

 

 

Details below.

 

Code

String

 

 

Price option identifier.

 

Options

Array of strings

 

 

The pricing options group option code you configured that the Avangate system uses to calculate product prices for pricing configurations without a base price.

 

PriceOptions

Array of AssignedPriceOptionGroup objects

 

 

Details below.

 

Code

String

 

 

System generated pricing options group code (you can also configure it) that the Avangate system uses to calculate product prices for pricing configurations without a base price.

 

Required

Boolean

 

 

True or False depending on whether you want to make it mandatory for shoppers to select the price option during the puyrchase process.

BundleProducts

Array of BundleProductCode objects

 

Details below.

 

ProductId

String

 

 

Unique, system-generated product ID.

 

ProductCode

String

 

 

Editable product code that you control.

Fulfillment

String

 

BY_AVANGATE

NO_DELIVERY – The Avangate system finalizes orders immediately after it receives payment confirmation.

BY_VENDOR – you are responsible for delivering/fulfilling orders

Prices

Array of Price objects

 

Use this object only when Pricing Configurations are not available for your account. Details below.

 

Amount

Int

 

 

The price of the product.

 

Currency

String

 

 

ISO code of the currency for the product price.

 

MinQuantity

Int

 

 

The minimum quantity of volume discounts. Default is 1.

 

MaxQuantity

Int

 

 

The maximum quantity of volume discounts. Default is 99999.

 

OptionCodes

Array of objects

 

 

Details below.

 

Code

String

 

 

Price option identifier.

 

Options

Array of strings

 

 

The pricing options group option code you configured that the Avangate system uses to calculate product prices for pricing configurations without a base price.

GeneratesSubscription

boolean

 

TRUE or FALSE depending on whether you set the product to generate subscriptions or not.

 

NULL for bundles for which you set the following subscription management option: “Use the subscription settings of each product in the bundle”

SubscriptionInformation

ProductSubscriptionInformation Object

 

Details below. NULL for bundles which you set to use the renewal settings of child products and not of the parent bundle.

 

DeprecatedProducts

Array

 

 

Deprecated products.

 

BundleRenewalManagement String

 

 

Possible values:

  • GLOBAL
  • INDIVIDUAL

Can be NULL.

 

BillingCycle

String

 

 

The number of subscription billing cycle units (months or days).  Possible values:

  • 0 (zero represents a one-time fee)

Days

  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

 

Months

  • 1
  • 2
  • 3
  • 6
  • 12
  • 15
  • 18
  • 24
  • 36 (max)

 

BillingCycleUnits

String

 

 

The units of the billing cycle:

  • M - months

D - days

 

IsOneTimeFee

Boolean

 

 

True or False depending on whether the subscription is evergreen or not.

 

ContractPeriod

Object

 

 

Details below.

 

Period

Int

 

 

The contract period in months or days. -1 for unlimited contracts.

 

PeriodUnits

String

 

 

The contract period units

days | months

 

IsUnlimited

boolean

 

 

This flag is true if the contract is for an unlimited period

 

Action

String

 

 

The action performed after the subscription expires.

Possible values CANCEL | RESTART

 

EmailsDuringContract Boolean

 

 

True or False depending on whether you suppress renewal notification emails throughout the duration of the contract or not.

 

UsageBilling

Int

 

 

The usage billing interval must be smaller than or equal to the grace period.

 

Interval of time within the grace period, when the Avangate system attempts to automatically charge customers for recurring costs and additional metered usage fees (in arrears). Avangate renews subscriptions only after subscribers make all outstanding payments per the renewal settings (from the expiration or the renewal date). If automatic renewal and usage charges fail, subscriptions can be manually renewed only by the end of the grace period, after which they expire.

 

Can be NULL.

 

GracePeriod

Object

 

Type

String

 

 

CUSTOM – you configured grace period setting at product level.

GLOBAL – global grace period settings apply.

 

Period

String

 

 

Number of days set for the grace period.

 

PeriodUnits

String

 

 

D - Days.

 

IsUnlimited

Boolean

 

 

True or False depending on whether you set the grace peri2od to unlimited or not.

 

RenewalEmails

Object

 

 

Details below. Can be NULL. Available only in Product API 2.5 and later.

 

Type 

String

 

 

GLOBAL - Send emails according to the global renewal notification settings.

CUSTOM – per product renewal notification settings

 

Settings

Object (can be NULL)

 

 

Details below.

 

ManualRenewal Object (can be NULL)

 

 

Details below.

 

Before30Days Boolean

 

 

True or False.

 

Before15Days Boolean

 

 

True or False.

 

Before7Days Boolean

 

 

True or False.

 

Before1Day 

Boolean

 

 

True or False.

 

OnExpirationDate Boolean

 

 

True or False.

 

After5Days

Boolean

 

 

True or False.

 

After15Days 

Boolean

 

 

True or False.

 

AutomaticRenewal

Object (can be NULL)

 

 

Details below.

 

Before30Days Boolean

 

 

True or False.

 

Before15Days Boolean

 

 

True or False.

 

Before7Days Boolean

 

 

True or False.

 

Before1Day 

Boolean

 

 

True or False.

 

OnExpirationDate 

Boolean

 

 

True or False.

 

After5Days

Boolean

 

 

True or False.

 

After15Days 

Boolean

 

 

True or False.

FulfillmentInformation

Object

 

Details below. Can be NULL. Available only in Product API 2.5 and later.

 

IsStartAfterFulfillment  Boolean

 

 

True or False. Depending on whether you want the subscription lifetime to start afther the completion of the fulfillment process or not.

 

IsElectronicCode 

Boolean

 

 

True or False. Depending on whether you configure the delivery of keys/codes for the product or not.

 

IsDownloadLink 

Boolean

 

 

True or False. Depending on whether you configure the delivery of a product file or not.

 

IsBackupMedia 

Boolean

 

 

True or False. Depending on whether you configure the delivery of backup media or not.

 

IsDownloadInsuranceService Boolean

 

 

True or False. Depending on whether you enable the Download Insurance Service or not, for a product for which you configure a product file.

 

IsInstantDeliveryThankYouPage Boolean

 

 

True or False. Depending on whether you enable instant delivery in the Thank You page or not.

 

IsDisplayInPartnersCPanel Boolean

 

 

True or False. Depending on whether you share access to the product file with your channel partners or not.

 

CodeList 

Object (can be NULL)

 

 

Details below.

 

Code 

String

 

 

The unique code list identifier.

 

Name 

String

 

 

Name of the code list.

 

Type 

String

 

 

Code list type:

  • STATIC

DYNAMIC

 

BackupMedia 

Object (can be NULL)

 

 

Details below.

 

Code 

String

 

 

The unique backup media identifier.

 

Name 

String

 

 

Name of the backup CD/DVD.

 

Type 

String

 

 

Media type:

CD

 

ProductFile

Object (can be NULL)

 

 

Details below.

 

Code 

String

 

 

Unique product file identifier.

 

Name 

String

 

 

Display name.

 

File 

String

 

 

Name of the product file.

 

Version 

String

 

 

File version.

 

Size

String

 

 

File size.

 

Type 

String

 

 

File type.

 

LastUpdate 

String

 

 

YYYY-MM-DD HH-MM-SS. Date time stamp when you last updated the file.

 

AdditionalInformationByEmail String (can be NULL)

 

 

The text you set up in the Additional fulfillment information - by email area.

 

AdditionalInformationEmailTranslations Object (can be NULL)

 

 

Array of localized Additional fulfillment information - by email texts.

 

AdditionalThankYouPage String (can be NULL)

 

 

The text you set up in the Additional fulfillment information - "Thank you" page area.

 

AdditionalThankYouPageTranslations Array (can be NULL)

 

 

Array of localized Additional fulfillment information - "Thank you" page texts.

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