Skip to main content

Subscription additional information fields

Overview

Use this object to assign, update, retrieve and delete additional information fields from your subscriptions.

Parameters

Parameters Type/Description

fieldName

String

 

The name of the additional information field. Used for identifying additional information fields.

fieldValue

String

 

The value of the additional information field.

 

 

Place orders with upsell campaign

Overview

When calling the placeOrder method in order to place an order with an upsell campaign, the code of the master product and the campaign code need to be added to the UpSell object for the product item where it is applied.

UpSell Object for the placeOrder API method

Parameter name Type Required/Optional Description
CampaignCode String Required The upsell campaign code.
ParentCode String Required Product code of the product to be recommended to the shopper.
PriceOptions String Required

Array of priceOptions strings used on parent product.

Quantity Integer Required Product quantity.

Request Example

{ 
  "Currency": "USD", 
  "Language": "EN", 
  "Country": "US", 
  "CustomerIP": "10.10.10.10", 
  "Source": "sourceAPI.net", 
  "CustomerReference": 421820775, 
  "Items": [ 

    { 
      "Code": "15", 
      "Quantity": 1 
    }, 
    { 
      "Code": "34924C876E", 
      "Quantity": 1, 
      "UpSell": {
        "CampaignCode": "1490b954-c299-430a-8134-e6a0501913ef",
        "ParentCode": "0BQ591VOTW",
        "PriceOptions": [
            "option_code_1"
        ],
        "Quantity": 5
      }
    } 
  ], 

   "BillingDetails":{ 

      "FirstName":"Customer First Name", 
      "LastName":"Customer Last Name", 
      "CountryCode":"US", 
      "State":"California", 
      "City":"San Francisco", 
      "Address1":"Example Street", 
      "Zip":"90210", 
      "Email":"example@email.com" 

   }, 

  "PaymentDetails": { 
    "Type": "CC", 
    "Currency": "USD", 
    "CustomerIP": "10.10.10.10", 
    "PaymentMethod": { 

      "Vendor3DSReturnURL": "https:\/\/example.com", 
      "Vendor3DSCancelURL": "https:\/\/example.com", 
      "CardNumber": "4111111111111111", 
      "CardType": "VISA", 
      "ExpirationYear": "2020", 
      "ExpirationMonth": "12", 
      "CCID": "123", 
    } 
  } 
} 

Response

Using the same structure, the getContents method will take into account the discount associated with the up-sell campaign and display the appropriate prices and taxes.

{ 
    "Country": "DE", 
    "Currency": "EUR", 
    "Items": [ 
        { 
            "Code": "NIQRPI0GTU", 
            "Quantity": 1 
        }, 
        { 
            "Code": "0XICS3OVDK", 
            "Quantity": 1, 
      "UpSell": {
        "CampaignCode": "1490b954-c299-430a-8134-e6a0501913ef",
        "ParentCode": "0BQ591VOTW",
        "PriceOptions": [
          "option_code_1"
        ],
        "Quantity": 5
       }
        } 
    ], 

    "BillingDetails": { 
        "FirstName": "Customer First Name", 
        "LastName": "Customer Last Name", 
        "CountryCode": "DE", 
        "City": "Bucharest", 
        "Address1": "Example Street", 
        "Zip": "73331", 
        "Email": "example@email.com" 
    } 
} 

 

 

Restricted countries and territories

Overview

The 2Checkout services and products are not available in the restricted countries listed below. 2Checkout does not accept merchants or businesses from these prohibited countries.

OFAC-Restricted Countries

The United States Department of Treasury's Office of Foreign Assets Control (OFAC) is a legal entity that enforces and administers economic and trade regulations according to US foreign policies and national security goals.

Regulations and sanctions administered by OFAC are meant to protect shoppers from terrorists, traffickers, and other national security threats.

2Checkout is fully compliant with OFAC regulations, restricting shoppers from the following countries from placing orders:

  • The Republic of Cameroon
  • The Republic of Cuba
  • The Islamic Republic of Iran
  • The State of Libya
  • The Republic of Sudan
  • The Syrian Arab Republic
  • The Republic of Tunisia
  • The Democratic People's Republic of Korea

The list of countries can be updated without any notice at any moment by OFAC and will be applied immediately. Check the official OFAC website for the latest updates.

Shoppers from OFAC-restricted countries are unable to finalize payments or place orders, as the 'Buy' button is not accessible to them during the checkout process.

OFAC-Sanctioned Countries

  • The Russian Federation

Retrieve proposal by ID

Overview

Use the getProposalById method via SOAP APIv6 to retrieve a proposal/quote using a specific ID.

Request parameters

Request parameters for the getProposalById method via SOAP APIv6
Parameters Type Required/Optional Description
proposalId String

Required

The unique merchant proposal ID generated by the 2Checkout system.

sessionId String Required Unique 2Checkout session ID code.

Request sample

<?php

require ('PATH_TO_AUTH');

$proposalID = "0573e71d-38bb-4d61-88ca-b3c557517c68";

try {
    $result = $soapClient->getProposalById($sessionID, $proposalID);
    echo "Proposal: </br>", 
    var_dump($result);
}
catch (SoapFault $e) {
    echo "Could not fetch proposal: " . $e->getMessage();
    exit;
}

Response

The getProposalById call via SOAP APIv6 returns the Proposal object.

Retrieve product groups

Overview

Use the getProductGroups method to extract information about the product groups you created 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.

Response

ProductGroup

Array of objects

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 = "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;
}

try {
    $ProductGroups = $client->getProductGroups($sessionID);
}

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

var_dump("ProductGroups", $ProductGroups);


?>

ProductInfo Object Structure

Parameters

Parameter Type/Description
SimpleProduct Object
  Product object with the structure detailed below.
PriceOptions Object
  PriceOptionsGroupItem object with the structure detailed below.

 

Upgrade price

Overview

Retrieve the upgrade price for a subscription.

Attributes

Parameters Parameters

BillingPrice

Double

 

The price 2Checkout charges the customer, without taxes.

BillingGrossPrice

Double

 

The price 2Checkout charges the customer, including taxes.

BillingCurrency

String

 

The currency ISO code used for the payment - ISO 4217.

Quantity

Int

 

The mandatory quantity for the upgrade (you cannot make partial upgrades)

DisplayPrice

Double

 

Display price.

DisplayGrossPrice

Double

 

Display price before deductions.

DisplayCurrency

String

 

Display currency. ISO 4217 code.

ProratedPrice String
 

Net prorated price for the upgrade.

If the calculated upgrade price is 0, the prorated price is also send as 0. 

If customers upgrade to a product with a lower price, the total and net prices will be 0, however, the Prorated Price will be the negative calculated value. Use this information in case you want to refund customers for upgrades to lower priced subscription plans.

ProratedGrossPrice String
 

Gross prorated price for the upgrade.

If the calculated upgrade price is 0, the prorated gross price is also 0. 

If customers upgrade to a product with a lower price, the total and net prices will be 0, however, the Prorated Gross Price will be the negative calculated value. Use this information in case you want to refund customers for upgrades to lower priced subscription plans.

Discount     Float
  Applied discounts
DiscountedProratedPrice Float
  Prorated net price for the upgrade with applied discounts
DiscountedProratedGrossPrice Float
  Prorated gross price for the upgrade with applied discounts
DiscountedBillingPrice Float
  Net billing price available for  the upgrade process with applied discounts
DiscountedBillingGrossPrice Float
  Gross billing price available for  the upgrade process with applied discounts
DisplayDiscount Float
  Discount displayed for the upgrade process
DiscountedDisplayPrice     Float
  Net display price available for the upgrade process with applied discounts
DiscountedDisplayGrossPrice     Float
  Gross display price available for the upgrade process with applied discounts

 

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

$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 = "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;
}

$ProductCode = 'my_subscription_1';

try {
    $ProdbyCode = $client->getProductByCode($sessionID, $ProductCode);
}

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

var_dump("ProductInfo", $ProdbyCode);


?>

Retrieve price option groups

Overview

Use the searchPriceOptionGroups to extract information on the price option groups you configured.

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.

PriceOptionGroupSearch

Optional (object)

 

Details below

PriceOptionGroupSearch

Object

Details below

Name

Optional (string)

 

The name of the pricing options groups configured in the 2Checkout system.

Can be NULL.

Types

Optional (array)

 

Possible values:

  • RADIO
  • CHECKBOX
  • INTERVAL
  • COMBO

Can be NULL.

Limit

Optional (int)

 

Number of results displayed per page. Default maximum value is 10.

Can be NULL.

Page

Optional (int)

 

A specific page of search results. Default value is 1.

Can be NULL.

Response

Parameters Type/Description

PriceOptionGroup

Array of objects

Request

<?php

require ('PATH_TO_AUTH');

try {
    $existentPriceOptions = $client->searchPriceOptionGroups($sessionID, $SearchOptions);
}

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

var_dump("existentPriceOptionst", $existentPriceOptions);

?>

Shipping method

Overview

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

Search shipping method

Shipping method object

Parameters   Type/Description
Items   Array of objects
      Contains shipping methods objects.
  ShippingMethod

Shipping method object.

Details below.

          Name String
      Shipping method name that you define when creating the method.
          Code String
      System-generated identified for the shipping method.
          TrackingURL String
      URL assigned to the shipping method. Provided to your customers that purchase physical products.
          BasePrice String
      Base fee attached to the shipping method, that will be charged to customers when shipping method is available in cart, regardless of their country, product value or weight.
          Currency String
      Currency in which the base fee is expressed. Example: 'USD'.
           Active Boolean
     

Possible values:

  • TRUE - if shipping method is active.
  • FALSE - if shipping method is inactive.
    Availability Strings
     

Defined where the shipping method is active.

Possible values:

  • ALL - all delivery countries.
  • CUSTOM - selected delivery countries.
  • HOME - only your home country.
    Countries Array of objects
      Countries where the shipping method applies.
                  CountryCode String
                  Two-letters country code.
                  Surcharge String
      Surcharge defined for each country.
    Surcharge Array of objects
      Additional fee assigned to the shipping method.
                 Type String
                 

Order property based on which the surcharge is added.

Possible values:

  • PRICE -  surcharge is based on total order amount.
  • WEIGHT -  surcharged is based on total order weight.
                 From Float
                  Lower interval limit.
                 To Int
      Higher interval limit.
                  Amount Int
      Surcharge defined based on order price/weight.
                 ApplyTo String
     

Possible values:

  • interval - surcharge is added for a given interval. Example: from 1 kg to 4kg.
  • unit - surcharge is added for each additional unit. Example: $5 for each unit over 4 kg.
  Pagination Object
      Pagination filters.
    Page Int
      Number of pages used for displaying the results.
    Limit Int
      Number for limiting the results.
    Count Int
      Total number of results.

 

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