Skip to main content

Update promotion

Overview

Use the updatePromotion method to alter the details of an existing promotion.

Parameters

Parameter Type/Description
sessionID Required (string)
  Output of the Login method.
Promotion Required (object)
  Promotion object that you want to update.

Response

Parameter Type/Description
Promotion Updated promotion object.

Request

<?php
require ('PATH_TO_AUTH'); 

// Retrieve promotion details

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

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

// Keep the promotion you want to update in $existingPromotion
$existingPromotion = callRPC((Object)$jsonRpcRequest, $host);
// Set the fields to update 
$existingPromotion->Description = 'Updated description';

// Update the promotion
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'updatePromotion',
'params' => array($sessionID, $existingPromotion)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));

Create proposal

Overview

Use the createProposal method via SOAP API 6.0 to add/create a new quote.

Request Parameters

Parameters Type Required/Optional Description
proposal Object Required  
proposalContent Object Required  
lineItems Object Required  
sessionId String Required Unique 2Checkout session ID code.

Request sample

<?php

require ('PATH_TO_AUTH');

$proposal = new stdClass();
$proposal->Type = "acquisition";
$proposal->BillTo = new stdClass();
$proposal->BillTo->Company = "Billing company";
$proposal->Content = new stdClass();
$proposal->Content->Language = "EN";
$proposal->Content->Currency = "USD";
$proposal->Content->LineItems =  array();
$lineItem = new stdClass();
$lineItem->ProductName = "My Product Name";
$lineItem->ProductCode = "5DCB30C6B0";
$lineItem->Quantity = 1;
$lineItem->Price = 54.2;
$lineItem->DiscountedPrice = 50;
$lineItem->PriceType = "net";
$lineItem->ContractPeriod = 0;
$proposal->Content->LineItems[0] = $lineItem;
$proposal->tac = new stdClass();
$proposal->tac->content = "Lorem ipsum.";
$proposal->SellTo = new stdClass();
$proposal->SellTo->Company = "End user company";

try {
    $results = $soapClient->createProposal($sessionID, $proposal);
    echo "New proposal created: </br>", 
    var_dump($results);
}
catch (SoapFault $e) {
    echo "Could not create proposal: " . $e->getMessage();
    exit;
}

Request sample with prorationDate

<?php

        require ('PATH_TO_AUTH');

        $proposal = new stdClass();
        $proposal->Type = "amendment";
        $proposal->BillTo = new stdClass();
        $proposal->BillTo->Company = "Billing company";
        $proposal->Content = new stdClass();
        $proposal->Content->Language = "EN";
        $proposal->Content->Currency = "USD";
        $proposal->Content->Tersm = 10;
        $proposal->Content->LineItems =  array();
        $lineItem = new stdClass();
        $lineItem->ProductName = "My Product Name";
        $lineItem->ProductCode = "5DCB30C6B0";
        $lineItem->Quantity = 1;
        $lineItem->Price = 54.2;
        $lineItem->DiscountedPrice = 50;
        $lineItem->PriceType = "net";
        $lineItem->ProrationDate = "2020-11-14T15:28:56+00:00";
        $lineItem->ContractPeriod = 0;
        $lineItem->subscriptionReference ="1234567890";
        $proposal->Content->LineItems[0] = $lineItem;
        $proposal->tac = new stdClass();
        $proposal->tac->content = "Lorem ipsum.";
        $proposal->SellTo = new stdClass();
        $proposal->SellTo->Company = "End user company";

        try {
            $results = $soapClient->createProposal($sessionID, $proposal);
            echo "New proposal created: </br>",
            var_dump($results);
        }
        catch (SoapFault $e) {
            echo "Could not create proposal: " . $e->getMessage();
            exit;
        }

Request sample with vatCode

    <?php

        require ('PATH_TO_AUTH');

        $proposal = new stdClass();
        $proposal->Type = "acquisition";
        $proposal->BillTo = new stdClass();
        $proposal->BillTo->Company = "Billing company";
        $proposal->Content = new stdClass();
        $proposal->Content->Language = "EN";
        $proposal->Content->Currency = "USD";
        $proposal->Content->LineItems =  array();
        $lineItem = new stdClass();
        $lineItem->ProductName = "My Product Name";
        $lineItem->ProductCode = "5DCB30C6B0";
        $lineItem->Quantity = 1;
        $lineItem->Price = 54.2;
        $lineItem->DiscountedPrice = 50;
        $lineItem->PriceType = "net";
        $lineItem->ContractPeriod = 0;
        $proposal->Content->LineItems[0] = $lineItem;
        $proposal->tac = new stdClass();
        $proposal->tac->content = "Lorem ipsum.";
        $proposal->SellTo = new stdClass();
        $proposal->SellTo->Company = "End user company";
        $proposal->SellTo->VatCode = "854234564";

        try {
            $results = $soapClient->createProposal($sessionID, $proposal);
            echo "New proposal created: </br>", 
            var_dump($results);
        }
        catch (SoapFault $e) {
            echo "Could not create proposal: " . $e->getMessage();
            exit;
        }

Request sample with TaxExemptionId

<?php

        require ('PATH_TO_AUTH');

        $proposal = new stdClass();
        $proposal->Type = "acquisition";
        $proposal->BillTo = new stdClass();
        $proposal->BillTo->Company = "Billing company";
        $proposal->Content = new stdClass();
        $proposal->Content->Language = "EN";
        $proposal->Content->Currency = "USD";
        $proposal->Content->LineItems =  array();
        $lineItem = new stdClass();
        $lineItem->ProductName = "My Product Name";
        $lineItem->ProductCode = "5DCB30C6B0";
        $lineItem->Quantity = 1;
        $lineItem->Price = 54.2;
        $lineItem->DiscountedPrice = 50;
        $lineItem->PriceType = "net";
        $lineItem->ContractPeriod = 0;
        $proposal->Content->LineItems[0] = $lineItem;
        $proposal->tac = new stdClass();
        $proposal->tac->content = "Lorem ipsum.";
        $proposal->SellTo = new stdClass();
        $proposal->SellTo->Company = "End user company";
        $proposal->SellTo->TaxExemptionId = "854234564";

        try {
            $results = $soapClient->createProposal($sessionID, $proposal);
            echo "New proposal created: </br>", 
            var_dump($results);
        }
        catch (SoapFault $e) {
            echo "Could not create proposal: " . $e->getMessage();
            exit;
        }    

Response

The createProposal call via SOAP API returns a Proposal object.

Two-factor authentication

Overview

Two-factor authentication is a method of computer access control that grants users access to their account after validating two criteria:

  • Knowledge - represented by a security aspect the user has knowledge of, such as the username and password.
  • Possession - represented by an item that only exists in the possession of that specific user, such as a smartphone, tablet, phone number, or email address.

Through two-factor authentication, users can access the 2Checkout Merchant Control Panel using their username, password, and a security token provided either by the Google Authenticator app or sent via email (associated with their Merchant Control Panel account).

For security reasons, master account users can enable two-factor authentication for their own accounts only via Google Authenticator

2Checkout allows you to manage user access to specific features by creating and assigning user roles. This extra layer of security enables you to restrict access to the Merchant Control Panel to specific users, based on unique tokens.

Availability

All 2Checkout accounts.

Requirements

  • Two-factor authentication through Google Authenticator requires a compatible mobile device running Android 2.3.3 or newer, or iOS 7.0 or newer.
  • Two-factor authentication via email requires the user to have access to his or her email account.

Google Authenticator for Android

You can download the Google Authenticator app for Android here or by accessing Google Play Store from your Android device.

Google Authenticator for iOS

You can download the Google Authenticator app for iOS here or by accessing the App Store from your iOS device.

Two-factor authentication types

2Checkout supports two types of two-factor authentication:

  • Two-factor authentication powered by Google Authenticator. Authentication codes are delivered through the Google Authenticator app for Android and iOS.
  • Two-factor authentication via emailParticular cases where users do not have access to their smartphones, such as environments that adhere to a "clean desk" policy, require authentication codes to be sent via email. In these situations, two-factor enrollment is done by the master account. Users enrolled by the master account cannot disable two-factor authentication on their own.

Two-factor authentication via Google Authenticator

Enable two-factor authentication

Follow the steps below to enable two-factor authentication for your account.

  1. Log in to the 2Checkout Merchant Control Panel.
  2. Navigate to the Settings cogwheel in the upper right corner.
  3. Click on My details.

2FA details.png

4. Go to the Two-factor authentication tab.

5. Scan the QR code using your smart device or enter the Authentication secret in the Google Authenticator app. The app will provide an authentication code.

6. Enter the authentication code in the dedicated field in the 2Checkout Merchant Control Panel.

7. Click Activate.

From this point on, every login attempt will require an authentication code provided by Google Authenticator.

Disable two-factor authentication

Follow the steps below to disable two-factor authentication.

  1. Login to the 2Checkout Control Panel.
  2. Navigate to the Settings cogwheel in the upper right corner.
  3. Click on My details.
  4. Go to the Two-factor authentication tab.
  5. Click Deactivate.

Two-factor authentication via email

Particular cases where users do not have access to their smartphones, such as environments that adhere to a "clean desk" policy, require authentication codes to be sent via email. In these situations, two-factor enrollment is done by the master account. Users enrolled by the master account cannot disable two-factor authentication on their own.

Follow the steps below to enable two-factor authentication via email.

  1. Login to the 2Checkout Merchant Control Panel with a master account.
  2. Navigate to the Settings cogwheel in the upper right corner.
  3. Click on User management.
  4. Identify the user you wish to enable two-factor authentication for and click Edit.
  5. Check the Two-factor authentication by email option.
  6. Click Save.

Once you enable two-factor authentication for a user, 2Checkout notifies them about the change and sends an authentication code to their email address each time a login attempt is detected.

Add promotion coupon

Overview

Parameters

Response

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

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

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

$response = Client::addPromotionCoupon ($promotionCode,$promotionCoupon); // Add coupons to the existing promotion
var_dump($response);

Enable a subscription

Overview

Use the enableSubscription method to enable 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.

subscriptionReference

Required (string)

 

Unique, system-generated subscription identifier.

Response

Parameters Type/Description

Boolean

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

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';

try {
    $enabledSubscription = $client->enableSubscription($sessionID, $SubscriptionReference);
}
catch (SoapFault $e) {
    echo "enabledSubscription: " . $e->getMessage();
    exit;
}
var_dump("enabledSubscription", $enabledSubscription);

Enable a subscription

Overview

Use the enableSubscription method to enable 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

Parameters Type/Description

Boolean

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

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';

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

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

Field data mapping

Overview

The tables below show how data in Salesforce is mapped to objects in 2Checkout.

Object-level mapping 

2Checkout objects are mapped to standard as well as custom objects in Salesforce. The latter are created by 2Checkout. This table shows the mapping between objects in both 2Checkout and Salesforce.

Field-level mapping

Below you can see how fields in standard Salesforce objects are mapped to data in 2Checkout.

Salesforce Object - Account

Salesforce 2Checkout Description
Field Label Field Name Data Type IPN LCN INS API  
Account Currency CurrencyIsoCode Picklist CURRENCY content.currency

INS:

- From the proposal event for the external proposals

Account Name Name Name

COMPANY_D

EMAIL_D

sell_to.company

IPN:

- If COMPANY_D is present and not empty it will be the one used, otherwise EMAIL_D will be used

INS:

- From the proposal event for the external proposal sent

Billing Address BillingAddress Address

STATE

COUNTRY_CODE

bill_to.address

bill_to.zip

bill_to.city

bill_to.state

bill_to.country

IPN:

- Only the Billing State/Province and Billing Country Code are being set with the corresponding IPN values

INS:

- From the proposal event for the external proposal sent

Country Code twoco__Country_Code__c Text(100) COUNTRY_CODE sell_to.country

INS:

- From the proposal event for the external proposal sent

 

Salesforce Object - Contact

Salesforce 2Checkout Description
Field Label Field Name Data Type IPN LCN INS API  
2Checkout TaxExempt ID twoco__X2Checkout_TaxExempt_ID__c Text(50) sell_to.tax_exemption_id

Usually manually set in Salesforce by the users

INS:

- From the proposal event for the external proposal sent

- For Sell To use sell_to.tax_exemption_id

Account Name AccountId Lookup(Account)

 

IPN:

- For Bill To use COUNTRY_CODE

- For Sell To use COUNTRY_D_CODE

INS:

- From the proposal event for the external proposal sent

- For Bill To use bill_to.country

- For Sell To use sell_to.country

Country Code twoco__Country_Code__c Text(100)

COUNTRY_CODE

COUNTRY_D_CODE

bill_to.country

sell_to.country

IPN:

- For Bill To use COUNTRY_CODE

- For Sell To use COUNTRY_D_CODE

INS:

- From the proposal event for the external proposal sent

- For Bill To use bill_to.country

- For Sell To use sell_to.country

Email Email Email

CUSTOMEREMAIL

EMAIL_D

bill_to.email

sell_to.email

IPN:

- For Bill To use CUSTOMEREMAIL

- For Sell To use EMAIL_D

INS:

- From the proposal event for the external proposal sent

- For Bill To use bill_to.email

- For Sell To use sell_to.email

Mailing Address MailingAddress Address

ADDRESS1

ADDRESS2

CITY

STATE

ZIPCODE

ADDRESS1_D

ADDRESS2_D

CITY_D

STATE_D

ZIPCODE_D

bill_to.address

bill_to.zip

bill_to.city

bill_to.state

bill_to.country

sell_to.address

sell_to.zip

sell_to.city

sell_to.state

sell_to.country

IPN:

- For Bill To use ADDRESS1, ADDRESS2, CITY, STATE and ZIPCODE

- For Sell To use ADDRESS1_D, ADDRESS2_D, CITY_D, STATE_D and ZIPCODE_D

INS:

- From the proposal event for the external proposal sent

- For Bill To use bill_to.*

- For Sell To use sell_to.*

Mobile MobilePhone Phone

PHONE

PHONE_D

bill_to.phone

sell_to.phone

IPN:

- For Bill To use PHONE

- For Sell To use PHONE_D

INS:

- From the proposal event for the external proposal sent

- For Bill To use bill_to.phone

- For Sell To use sell_to.phone

Name Name Name

FIRSTNAME

LASTNAME

FIRSTNAME_D

LASTNAME_D

bill_to.first_name

bill_to.last_name

sell_to.first_name

sell_to.last_name

IPN:

- For Bill To use FIRSTNAME and LASTNAME

- For Sell To use FIRSTNAME_D and LASTNAME_D

INS:

- From the proposal event for the external proposal sent

- For Bill To use bill_to.first_name and bill_to.last_name

- For Sell To use sell_to.first_name and sell_to.last_name

Other Address OtherAddress Address

ADDRESS1

ADDRESS2

CITY

STATE

COUNTRY_D_CODE

ZIPCODE

ADDRESS1_D

ADDRESS2_D

CITY_D

STATE_D

ZIPCODE_D

bill_to.address

bill_to.zip

bill_to.city

bill_to.state

bill_to.country

sell_to.address

sell_to.zip

sell_to.city

sell_to.state

sell_to.country

IPN:

- For Bill To use ADDRESS1, ADDRESS2, CITY, STATE and ZIPCODE

- For Sell To use ADDRESS1_D, ADDRESS2_D, CITY_D, STATE_D and ZIPCODE_D

INS:

- From the proposal event for the external proposal sent

- For Bill To use bill_to.*

- For Sell To use sell_to.*

Phone Phone Phone

PHONE

PHONE_D

bill_to.phone

sell_to.phone

IPN:

- For Bill To use PHONE

- For Sell To use PHONE_D

INS:

- From the proposal event for the external proposal sent

- For Bill To use bill_to.phone

- For Sell To use sell_to.phone

VAT Id twoco__VAT_ID__c Text(50) FISCALCODE sell_to.vat_codesell_to.vat_code

IPN:

- Set the same value for Bill To and Sell To

INS:

- From the proposal event for the external proposal sent

- For Sell To use sell_to.vat_code

Contact Currency CurrencyIsoCode Picklist content.currency

INS:

- From the proposal event for the external proposal sent

 Salesforce Object - Opportunity

Salesforce 2Checkout Description
Field Label Field Name Data Type IPN LCN INS API  
Account Name AccountId Lookup(Account)

The identified Account of the opportunity

Close Date CloseDate Date expiration_date

IPN:

- For incoming eCommerce orders it set automatically as NOW + 2 days. Once an eCommerce order ends up in the COMPLETE status, the Close Date will be set to the day and time when this happens.

INS:

- From the proposal event for the external proposal sent

Opportunity Currency CurrencyIsoCode Picklist CURRENCY content.currency

INS:

- From the proposal event for the external proposal sent

Opportunity Name Name Text(120)

REFNO

COMPANY_D

IPN_PARTNER_CODE

sell_to.company

name

IPN:

- For incoming eCommerce orders it set automatically as 2CO REFNO. If COMPANY_D is set, then it is concatenated at the end.

If IPN_PARTNER_CODE is set, then it is concatenated at the end.

- eCommerce orders pattern:

2CO <REFNO>[ <COMPANY_D>][ (Partner Code: <IPN_PARTNER_CODE>]

INS:

- From the proposal event for the external proposal sent

- For external proposals the pattern is the following:

2CO External <sell_to.company> <name>

Opportunity Type twoco__Opportunity_Type__c Picklist

IPN:

- For incoming eCommerce orders set as eCommerce

INS:

- From the proposal event for the external proposal sent

- Set as Assisted Sales

Stage StageName Picklist ORDERSTATUS

IPN:

- For incoming eCommerce orders set as 2CO eCommerce Order.

- If the ORDERSTATUS is COMPLETE, set it as Closed Won

INS:

- From the proposal event for the external proposal sent

- Set as 2CO External Order

Salesforce object - Offer

Salesforce 2Checkout Description
Field Label Field Name Data Type IPN LCN INS API  
2Checkout TaxExempt ID twoco__X2Checkout_TaxExempt_ID__c Text(50) FISCALCODE sell_to.tax_exemption_id

IPN:

- Set only if IPN COUNTRY_D is US

INS:

- From the proposal event for the external proposal sent

Accepted Date twoco__Accepted_Date__c Date/Time tac.accepted_date

INS:

- From the proposal updated event

Account twoco__Account__c Formula (Text)

The identified Account of the offer

Address twoco__Sell_To_Address__c Text(100)

ADDRESS1_D

ADDRESS2_D

sell_to.address

INS:

- From the proposal event for the external proposal sent

Address twoco__Billing_Address__c Text(100)

ADDRESS1

ADDRESS2

bill_to.address

INS:

- From the proposal event for the external proposal sent

Bill To Contact twoco__Billing_Contact__c Lookup(Contact)

The identified Bill To Contact of the associated Account

City twoco__Sell_To_City__c Text(30) CITY_D sell_to.city

INS:

- From the proposal event for the external proposal sent

City twoco__Billing_City__c Text(30) CITY bill_to.city

INS:

- From the proposal event for the external proposal sent

Client Reply twoco__Client_Reply__c Long Text Area(32768) status_comment

INS:

- From the proposal event for the external proposal sent

Contract terms twoco__Terms_and_Conditions__c Rich Text Area(32768) tac.content

INS:

- From the proposal event for the external proposal sent

Country twoco__Sell_To_Country__c Text(50) COUNTRY_D sell_to.country

INS:

- From the proposal event for the external proposal sent

Country twoco__Billing_Country__c Text(50) COUNTRY bill_to.country

INS:

- From the proposal event for the external proposal sent

CountryCode twoco__Sell_To_Country_Code__c Text(2) COUNTRY_D sell_to.country

INS:

- From the proposal event for the external proposal sent

CountryCode twoco__Billing_Country_Code__c Text(2) COUNTRY_CODE bill_to.country

INS:

- From the proposal event for the external proposal sent

Currency CurrencyIsoCode Picklist CURRENCY content.currency

INS:

- From the proposal event for the external proposal sent

Download PDF URL twoco__Download_PDF_URL__c URL(255) links[].pdf

INS:

- From the proposal event

- The pdf property of the link item in the links with the status sent or preview

Email twoco__Sell_To_Email_Address__c Email CUSTOMEREMAIL sell_to.email

INS:

- From the proposal event for the external proposal sent

Email twoco__Billing_Email_Address__c Email EMAIL_D bill_to.email

INS:

- From the proposal event for the external proposal sent

Expiration Date twoco__Expiration_Date__c Date/Time expiration_date

INS:

- From the proposal event for the external proposal sent

Has Net Terms twoco__Has_Net_Terms__c Checkbox ORDERFLOW content.terms

IPN:

- Checked if ORDERFLOW is PURCHASE_ORDER

INS:

- From the proposal event for the external proposal sent

Is Locked twoco__Is_Locked__c Checkbox locked

IPN:

- Set as Checked

INS:

- From the proposal event for the external proposal sent

Language twoco__Language__c Text(2) LANGUAGE content.language

INS:

- From the proposal event for the external proposal sent

Net Terms twoco__Net_Terms__c Number(10, 2) content.terms

IPN:

- For eCommerce offers set as 30

INS:

- From the proposal event for the external proposals

Offer ID twoco__Offer_id__c Text(100) proposal_id

INS:

- From the proposal event for the external proposals

Offer Name Name Text(80) COMPANY_D name

For eCommerce offers, set as NOW in the format %Y/%m/%d %H:%M:%S followed by COMPANY_D if set.

INS:

- From the proposal event for the external proposal sent

Original Offer Item twoco__Original_Offer_Item__c Lookup(Offer Item)

INS:

- For the proposal event for the external proposal sent the detected parent Offer Item for an amendment

Parent Offer twoco__Parent_Offer__c Lookup(Offer)

INS:

- For the proposal event for the external proposal sent the detected parent Offer for an amendment

Parent Opportunity twoco__Parent_Opportunity__c Lookup(Opportunity) The Opportunity to which the offer belongs
Phone twoco__Sell_To_Phone_Number__c Phone PHONE_D sell_to.phone

INS:

- From the proposal event for the external proposal sent

Phone twoco__Billing_Phone_Number__c Phone PHONE bill_to.phone

INS:

- From the proposal event for the external proposal sent

Preview twoco__Preview__c Checkbox Set as Not Checked
Proration Date twoco__Proration_Date__c Date/Time content.line_items[0].proration_date

INS:

- From the proposal event for the external proposal sent

Scope twoco__Scope__c Picklist scope

INS:

- From the proposal event for the external proposal sent

Sell To Contact twoco__Sell_to_Contact__c Lookup(Contact) The identified Sell To Contact of the associated Account
State twoco__Sell_To_State__c Text(30) STATE_D sell_to.state

INS:

- From the proposal event for the external proposal sent

State twoco__Billing_State__c Text(30) STATE bill_to.state

INS:

- From the proposal event for the external proposal sent

Status twoco__Offer_Status__c Picklist ORDERSTATUS status

IPN:

- Mapped ORDERSTATUS to Picklist values based on specific logic

INS:

- For the proposal event for the external proposal sent set as Opened or Sent

- For the proposal event for the cpq proposals set as received value

Time Zone twoco__Time_Zone__c Picklist TIMEZONE_OFFSET
Type twoco__Type__c Picklist type

IPN:

- For cases where a new subscription is created for eCommerce orders, set as New Acquisition

INS:

- From the proposal event for the external proposal sent

UI Access URL twoco__UI_Access_URL__c URL(255) links[].url

INS:

- From the proposal event

- The url property of the link item in the links with the status sent or preview

Use same contact for invoicing twoco__Use_this_address_for_delivery__c Checkbox Set as Checked if the Sell To Contact is the same as Bill To Contact
VAT Id twoco__Sell_To_Vat_Id__c Text(50) FISCALCODE sell_to.vat_code

IPN:

- Set only if IPN COUNTRY_D is not US

INS:

- From the proposal event for the external proposal sent

Version twoco__Version__c Number(10, 2) version

INS:

- From the proposal updated event

Zip twoco__Sell_To_Zip__c Text(20) ZIPCODE_D sell_to.zip

INS:

- From the proposal event for the external proposal sent

Zip twoco__Billing_Zip__c Text(20) ZIPCODE bill_to.zip

INS:

- From the proposal event for the external proposal sent

2CO Created Date twoco__X2CO_Created_Date__c Date/Time created_date

INS:

- From the proposal event for the external proposal sent

2CO Updated By twoco__X2CO_Updated_By__c Text(100) updated_by

INS:

- From the proposal event

2CO Updated Date twoco__X2CO_Updated_Date__c Date/Time updated_date

INS:

- From the proposal event

Salesforce object - Offer Item

Salesforce 2Checkout Description
Field Label Field Name Data Type IPN LCN INS API  
Billing Cycle Unit twoco__Billing_Cycle_Unit__c Text(20) IPN_LICENSE_REF[] content.line_items[].billing_cycle.unit Billing.BillingCycleFrequencyUnit

IPN:

- From the response of the REST API method GET https://api.2checkout.com/rest/6.0/subscriptions/<License ref>/

INS:

- From the proposal event for the external proposal sent

Billing Cycle Value twoco__Billing_Cycle_Value__c Number(10, 0)

IPN_LICENSE_REF[]

content.line_items[].billing_cycle.value Billing.BillingCycleFrequency

IPN:

- From the response of the REST API method GET https://api.2checkout.com/rest/6.0/subscriptions/<License ref>/

INS:

- From the proposal event for the external proposal sent

C-DAR twoco__CDAR__c Checkbox

CLIENT_DEAL_AUTO_RENEWAL

content.line_items[].client_deal_auto_renewal

INS:

- From the proposal event

Contract Renewal Period twoco__Contract_Renewal_Period__c Text(100) content.line_items[].next_contract_renewal_period

INS:

- From the proposal event for the external proposal sent

Currency twoco__Currency__c Text(100) content.currency

INS:

- From the proposal event for the external proposal sent

Currency CurrencyIsoCode Picklist content.currency

INS:

- From the proposal event for the external proposal sent

Current Billing Cycle EndDate twoco__Current_Billing_Cycle_EndDate__c Date/Time IPN_LICENSE_REF[] EXPIRATION_DATE_TIME Billing.CurrentBillingCycleEndDate

IPN:

- From the response of the REST API method GET https://api.2checkout.com/rest/6.0/subscriptions/<License ref>/

INS:

- From the proposal event for the external proposal sent

Custom Price/Unit twoco__Unit_Custom_Price__c Currency(16, 2) content.line_items[].discounted_price

INS:

- From the proposal event for the external proposal sent

Discount twoco__Discount__c Percent(3, 2) (content.line_items[].price - content.line_items[].discounted_price) / 100

INS:

- From the proposal event for the external proposal sent

Discount/Unit twoco__Discount_Amount__c Number(16, 2) content.line_items[].price - content.line_items[].discounted_price

INS:

- From the proposal event for the external proposal sent

End Date twoco__End_Date__c Date/Time CONTRACT_EXPIRATION_DATE_TIME
Immediate Action twoco__Immediate_Action__c Picklist content.line_items[].immediate_action

INS:

- From the proposal event for the external proposal sent

Lifetime twoco__Is_Lifetime__c Checkbox IPN_LICENSE_REF[]

content.line_items[].contract_period

content.line_items[].billing_cycle

Billing.NoOfBillingCycles

IPN:

- From the response of the REST API method GET https://api.2checkout.com/rest/6.0/subscriptions/<License ref>/

INS:

- From the proposal event for the external proposal sent

Line Item Price (incl. tax) twoco__Line_Item_Price__c Currency(16, 2)
List Price twoco__List_Price__c Currency(16, 2) content.line_items[].price * content.line_items[].quantity

INS:

- From the proposal event for the external proposal sent

List Price Type twoco__Price_Type__c Text(100) content.line_items[].price_type

INS:

- From the proposal event for the external proposal sent

M-DAR twoco__MDAR__c Checkbox MERCHANT_DEAL_AUTO_RENEWAL content.line_items[].merchant_deal_auto_renewal

INS:

- From the proposal event

No. of Billing Cycles twoco__Contract_Period__c Number(10, 0) IPN_LICENSE_REF[] content.line_items[].contract_period

IPN:

- From the response of the REST API method GET https://api.2checkout.com/rest/6.0/subscriptions/<License ref>/

INS:

- From the proposal event for the external proposal sent

Offer twoco__Offer__c Master-Detail(Offer) The parent Offer
Offer Item Name Name Text(80) content.line_items[].product_name

INS:

- From the proposal event for the external proposal sent

One Time Fee twoco__Is_One_Time_Fee__c Checkbox IPN_LICENSE_REF[]

content.line_items[].contract_period

content.line_items[].billing_cycle

Lifetime

IPN:

- From the response of the REST API method GET https://api.2checkout.com/rest/6.0/subscriptions/<License ref>/

INS:

- From the proposal event for the external proposal sent

Opportunity twoco__Opportunity__c Lookup(Opportunity) The parent Offer Opportunity
Parent Offer Line Item twoco__Parent_Offer_Line_Item__c Lookup(Offer Item) The parent Offer Item for amendments
Price Options twoco__Price_Options__c Long Text Area(32768) IPN_LICENSE_REF[] content.line_items[].price_options Billing.PriceOptions

IPN:

- From the response of the REST API method GET https://api.2checkout.com/rest/6.0/subscriptions/<License ref>/

- Mapped response value to Picklist values based on specific logic

INS:

- From the proposal event for the external proposal sent

Product twoco__Product__c Lookup(Product) The associated Product
Proration Type twoco__Proration_Type__c Picklist content.line_items[].amendment_scenario

INS:

- From the proposal event for the external proposal sent

Quantity twoco__Quantity__c Number(10, 0) content.line_items[].quantity

INS:

- From the proposal event for the external proposal sent

Start Date twoco__Start_Date__c Date/Time START_DATE
Subscription Code twoco__Subscription_Code__c Text(100) content.line_items[].subscription_reference
Subscription Status twoco__Subscription_Status__c Picklist IPN_LICENSE_REF[] STATUS

IPN:

- From the response of the REST API method GET https://api.2checkout.com/rest/6.0/subscriptions/<License ref>/

- Mapped response value to Picklist values based on specific logic

- Also can be set to Amended on the parrent Offer Item when needed based on the child amendment Offer Item subscription status

LCN:

- Mapped STATUS to Picklist values based on specific logic

INS:

- For the proposal event for the external proposal sent set as Pending Activation

Unit List Price twoco__Unit_List_Price__c Currency(16, 2) content.line_items[].price

INS:

- From the proposal event for the external proposal sent

VAT Amount twoco__VAT_Amount__c Currency(16, 2) Items[].Price.VAT

INS:

- From the proposal event for the external proposal sent

- From the corresponding item in the response of the REST API method PUT https://api.2checkout.com/rest/6.0/products/orders/0/

VAT Rate twoco__VAT_Rate__c Percent(3, 2) Items[].Price.VATPercent

INS:

- From the proposal event for the external proposal sent

- From the corresponding item in the response of the REST API method PUT https://api.2checkout.com/rest/6.0/products/orders/0/

Salesforce object - Billing Cycle

Salesforce 2Checkout Description
Field Label Field Name Data Type IPN LCN INS API  
2checkout Order ID twoco__X2checkout_Order_ID__c Text(9) REFNO

Billing Cycle Name Name Text(80)

IPN:

- Pattern

Billing cycle: <computed number>

Billing Cycle Number twoco__Billing_Cycle_Number__c Number(18, 0)

IPN:

- Computed number

Chargeback Reason Code twoco__Chargeback_Reason_Code__c Text(100) CHARGEBACK_REASON_CODE
Chargeback Resolution twoco__Chargeback_Resolution__c Text(100) CHARGEBACK_RESOLUTION
Currency CurrencyIsoCode Picklist CURRENCY
External Order Reference twoco__External_Order_Reference__c Text(100) REFNOEXT
Fraud Status twoco__Fraud_Status__c Picklist FRAUD_STATUS
Internal Purchase Order Number twoco__Internal_Purchase_Order_Number__c Text(100) SHOPPER_REFERENCE_NUMBER
Offer ID twoco__Offer__c Lookup(Offer) The parent Offer for the parent Offer Item
Offer Line Item ID twoco__Offer_Line_Item__c Master-Detail(Offer Item) The parent Offer Item
Opportunity ID twoco__Opportunity__c Lookup(Opportunity) The parent opportunity for the parent Offer for the parent Offer Item
Order Currency twoco__ORDER_CURRENCY__c Text(100) CURRENCY
Order Status twoco__Order_Status__c Picklist ORDERSTATUS

IPN:

- Can be set to Canceled on parent Offer Item when processing the child amendment Offer Item

Order Value twoco__ORDER_VALUE__c Number(16, 2) IPN_TOTAL[]
Payment Date twoco__Payment_Date__c Date PAYMENTDATE
Payment Method twoco__Payment_Method__c Text(100) PAYMETHOD
Payment Method Code twoco__Payment_Method_Code__c Text(100) PAYMETHOD_CODE
Purchase Date twoco__Purchase_Date__c Date SALEDATE
Refund Code twoco__Refund_Code__c Text(100) REFUND_REASON

Salesforce object - Product

Salesforce 2Checkout Description
Field Label Field Name Data Type IPN LCN INS API  
Active IsActive Checkbox

Always set to Checked for

External ID ExternalId Text(255) avangate_id AvangateId

API:

- For the manual sync or proposal event for the external proposals, from the corresponding item in the response of the REST API method https://api.2checkout.com/rest/6.0/products/

INS:

- From the product event

Is 2CO Enabled twoco__Is_2CO_Enabled__c Checkbox enabled Enabled

API:

- For the manual sync or proposal event for the external proposals, from the corresponding item in the response of the REST API method https://api.2checkout.com/rest/6.0/products/

INS:

- From the product event

Is 2CO Product twoco__Is_2CO_Product__c Checkbox

API:

- For the manual sync or proposal event for the external proposals, from the corresponding item in the response of the REST API method https://api.2checkout.com/rest/6.0/products/

INS:

- From the product event

Product Code ProductCode Text(255) product_code ProductCode

API:

- For the manual sync or proposal event for the external proposals, from the corresponding item in the response of the REST API method https://api.2checkout.com/rest/6.0/products/

INS:

- From the product event

Product Description Description Text Area(4000) short_description ShortDescription

API:

- For the manual sync or proposal event for the external proposals, from the corresponding item in the response of the REST API method https://api.2checkout.com/rest/6.0/products/

INS:

- From the product event

Product Family Family Picklist Alway set to SERVICES
Product Name Name Text(255) product_name ProductName

API:

- For the manual sync or proposal event for the external proposals, from the corresponding item in the response of the REST API method https://api.2checkout.com/rest/6.0/products/

INS:

- From the product event

Quantity Unit Of Measure QuantityUnitOfMeasure Picklist Always set to Each

 

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.

You cannot set an expiration date from the past.

 

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.

ChurnReasons Array
 

This payload can be sent only when the Subscription object (from above) will have RecurringEnabled set as TRUE. Possible values for this field are:
CHURN_REASON_NOT_SATISFIED_PRODUCT

CHURN_REASON_ENABLED_BY_MISTAKE

CHURN_REASON_PREFER_MANUAL

CHURN_REASON_ALREADY_RENEWED

CHURN_REASON_DONT_NEED

CHURN_REASON_WANT_PAUSE

CHURN_REASON_COVID

CHURN_REASON_HIGH_PRICE

CHURN_REASON_NOT_SATISFIED_SUPPORT

CHURN_REASON_EXTRAORDINARY

CHURN_REASON_OTHER

ChurnReasonOther String
  This field should have a value only if the ChurnReasons has the CHURN_REASON_EXTRAORDINARY or CHURN_REASON_OTHER values

 

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

Parameters Type/Description

Boolean

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

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReferenceTest = 'YOUR_SUBSCRIPTION_REFERENCE';

try{
    $retrievedSubscription = $client->getSubscription($sessionID, $subscriptionReferenceTest);
}

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

var_dump ($updatedSubscription);


$retrievedSubscription->RecurringEnabled = false;
$retrievedSubscription->SubscriptionEnabled = false;
$retrievedSubscription->ExpirationDate = '2026-12-12';

$churnReasons = ['CHURN_REASON_OTHER'];
$churnReasonOther = 'I refuse to continue the subscription';

try {
    $updatedSubscription = $client->updateSubscription($sessionID, $retrievedSubscription);
}
catch (SoapFault $e) {
    echo "updatedSubscription: " . $e->getMessage();
    exit;
}
var_dump("updatedSubscription", $updatedSubscription);

?>

 

Error handling for API 6.0

Overview

Learn how to tackle the common errors that may arise when using the placeOrder call via 2Checkout API.

Error codes for Order Object

Item: Product

Error code Description
ORDER_PRODUCTS_EMPTY No products have been provided.
ORDER_PRODUCT_RENEWAL_SUBSCRIPTION_REFERENCE_EMPTY Subscription reference cannot be empty.
ORDER_PRODUCT_RENEWAL_SUBSCRIPTION_REFERENCE_INVALID Subscription reference is invalid.
ORDER_PRODUCT_RENEWAL_SUBSCRIPTION_REFERENCE_NOT_FOUND Subscription reference is invalid.
ORDER_PRODUCT_RENEWAL_PERIOD_INVALID The renewal period is invalid.
ORDER_PRODUCTS_RENEWAL_NOT_ALLOWED Renewal is not allowed with multiple products.
ORDER_PRODUCT_CODE_INVALID Invalid product code.
PRODUCT_ERROR Invalid product id.
ORDER_PRODUCT_CODE_INVALID Requested product [%s] was not found.
ORDER_PRODUCT_PRICE_STRUCTURE_INVALID The price structure is not valid.
ORDER_PRODUCT_PRICE_AMOUNT_INVALID The price amount is not valid.
ORDER_PRODUCT_PRICE_TYPE_INVALID The price type is not valid
ORDER_PRODUCT_PRICE_TYPE_BASE_INVALID The price amount does not need to be set on the base price flow.
ORDER_PRODUCT_PRICE_TYPE_DEFAULT_INVALID The price amount does not need to be set on the default price flow.
ORDER_PRODUCT_PRICE_TYPE_CUSTOM_INVALID The price amount is mandatory to be set on the custom price flow.
ORDER_PRODUCT_INVALID Internal product validation error.
ORDER_PRODUCT_NAME_INVALID Name is mandatory when you set IsDynamic to TRUE.
ORDER_ITEMS_INVALID Invalid items. You cannot mix dynamic and catalog products.
ORDER_PRODUCT_IS_DYNAMIC_INVALID Invalid IsDynamic value. Use: TRUE or FALSE.
ORDER_PRODUCT_PURCHASE_TYPE_INVALID Invalid product purchase type. Accepted values: PRODUCT, SHIPPING, COUPON and TAX.
ORDER_PRODUCT_TANGIBLE_INVALID Invalid Tangible value. Use: TRUE or FALSE.
ORDER_ITEMS_QUANTITY_INVALID Item quantity must be between 1 and 99999.

 Item: Trial

Error code Description
INVALID_PRODUCT Invalid product ID.
PRODUCT_ALREADY_IN_CART Product already in cart.
INVALID_TRIAL_PERIOD The trial period needs to be greater than 0 days.
INVALID_TRIAL_PRODUCT Invalid trial product.

Item: Cross-sell

Error code Description
INVALID_CROSS_SELL_PRODUCT Invalid cross-sell product ID/Invalid cross-sell parent product code/Invalid cross-sell parent product ID/Invalid cross-sell products for a specified campaign.
PRODUCT_ALREADY_IN_CART Product already in cart.
PRODUCT_NOT_IN_CART The cross-sell master product is not already in the cart.
INVALID_CROSS_SELL_CAMPAIGN Invalid cross-sell campaign.
ORDER_ITEMS_CROSS_SELL_PARENT_DISABLED Parent product form cross-sell campaign is disabled.
ORDER_ITEMS_CROSS_SELL_CHILD_DISABLED Child product form cross-sell campaign is disabled.
ITEM_CROSS_SELL_INVALID CrossSell field is invalid.
ITEM_CROSS_SELL_PARENT_CODE_INVALID CrossSell parent code is invalid.
ITEM_CROSS_SELL_CAMPAIGN_CODE_INVALID CrossSell campaign code is invalid.
ITEM_CROSS_SELL_AUTOADDED_INVALID CrossSell 'AutoAdded' field is invalid.

Item: Price_options

Error code Description
INVALID_OPTIONS Your pricing has error: %s.
ORDER_ITEMS_PRICE_OPTIONS_NAME_EMPTY Item price options name is empty.
ORDER_ITEMS_PRICE_OPTIONS_OPTION_NAME_EMPTY Item price options option name is empty.
ORDER_ITEMS_PRICE_OPTIONS_OPTION_VALUE_EMPTY Item price options option value is empty.
ORDER_ITEMS_PRICE_OPTIONS_NAME_INVALID Invalid item price options name.
ORDER_ITEMS_PRICE_OPTIONS_INVALID Invalid item price options.
ORDER_ITEMS_PRICE_OPTIONS_OPTION_NAME_INVALID Invalid item price options option name.
ORDER_ITEMS_PRICE_OPTIONS_OPTION_VALUE_INVALID Invalid item price options option value.
ORDER_ITEMS_PRICE_OPTIONS_OPTION_SURCHARGE_INVALID Invalid item price options option surcharge.

Item: Price

Error code Description
PRICE_ERROR The price needs to be a decimal value.
PRODUCT_ERROR You need to add the product to the order before setting the price./Invalid product id.
CURRENCY_ERROR No currency is set for the current session.
ORDER_ITEMS_RECURRING_OPTIONS_CYCLE_UNIT_INVALID Invalid item recurring option cycle unit. Accepted values: DAY, WEEK, MONTH, YEAR.
ORDER_ITEMS_RECURRING_OPTIONS_CYCLE_LENGTH_INVALID Invalid item recurring option cycle length. Use integers.
ORDER_ITEMS_RECURRING_OPTIONS_CONTRACT_UNIT_INVALID Invalid item recurring option contract unit. Accepted values: DAY, WEEK, MONTH, YEAR, FOREVER.
ORDER_ITEMS_RECURRING_OPTIONS_CONTRACT_LENGTH_INVALID Invalid item recurring option contract length. Use integers.
ORDER_ITEMS_RECURRING_OPTIONS_CYCLE_AMOUNT_INVALID Item recurring option cycle amount must be zero or a positive value (INT or FLOAT).
ORDER_PRODUCT_PRICE_AMOUNT_TYPE_INVALID The price amount type is not valid.

Item: Refund

Error code Description
ORDER_REFUND_ORDER_REF_MISSING ORDER_REF missing or format incorrect.
ORDER_REFUND_ORDER_AMOUNT_MISSING ORDER_AMOUNT missing or format incorrect.
ERROR_CANCELLING_ORDER Error canceling order.
ORDER_ALREADY_CANCELED Order already canceled.
UNKNOWN_ERROR Unknown error.
ORDER_REFUND_INVALID_ORDER_REF Invalid ORDER_REF.
ORDER_REFUND_INVALID_ORDER_AMOUNT Invalid ORDER_AMOUNT.
ORDER_REFUND_LINE_ITEM_REFERENCE_MISSING ORDER_REFUND_LINE_ITEM_REFERENCE missing or format incorrect.
ORDER_REFUND_PRODUCTS_QTY_MISSING PRODUCTS_QTY missing or format incorrect.
ORDER_REFUND_INVALID_PRODUCTS_QTY Invalid PRODUCTS_QTY.
ORDER_REFUND_AMOUNT_MISSING AMOUNT missing or format incorrect.
ORDER_REFUND_AMOUNT_INVALID Invalid AMOUNT.
ORDER_REFUND_ALREADY_PLACED_TOTAL_REFUND You have already placed a Total refund for this order.
ORDER_REFUND_ALREADY_PLACED You have already placed a refund for this order.
ORDER_REFUND_ALREADY_HAVE_PENDING_REFUND_REQUEST You already have a pending refund request.
ORDER_REFUND_AMOUNT_EXCEEDED_MAXIMUM_REFUNDABLE_AMOUNT The maximum refundable amount for this order has been exceeded.
ORDER_REFUND_FAILED_DUE_TO_ORDER_CURRENT_STATUS You cannot place a refund request due to the order's current status.
ORDER_REFUND_FAILED_DUE_TO_PAYMENT_DETAILS You cannot place a refund request due to the order's payment details.
ORDER_REFUND_FAILED_DUE_TO_PERIOD_TO_REQUEST_REFUND_HAS_EXPIRED The allowed period to request a new refund for this order has expired.
ORDER_REFUND_MULTIPLE_NOT_SUPPORTED_BY_PAYMENT_TYPE Multiple refunds are not supported by this order's payment type.
ORDER_REFUND_NOT_SUPPORTED_FOR_CROSS_VENDOR_SALE Refunding not supported for this Cross Vendor Sale order.
ORDER_REFUND_TOTAL_NEGATIVE Order total is negative.
ORDER_REFUND_AMOUNT_NEGATIVE Order amount is negative.
ORDER_REFUND_ITEM_AMOUNT_NEGATIVE Order item amount is negative.
ORDER_REFUND_FAILED_DUE_TO_ORDER_APPROVAL_STATUS You cannot place a refund request due to the order's approval status.
ORDER_REFUND_MULTIPLE_REFUNDS_NOT_SUPPORTED Multiple refunds are not supported by this order's terminal.
ORDER_REFUND_PARTIAL_REVERSE_NOT_SUPPORTED Partial reverse is not supported.
ORDER_REFUND_INVALID_PRODUCT_TYPE Invalid product type. Refunds are available only for the following product types: REGULAR / BUNDLE / MEDIA / DOWNLOAD_INSURANCE / SHIPPING, but not for DISCOUNT.
ORDER_REFUND_FAILED_DUE_TO_OPEN_CHARGEBACK_DISPUTE You cannot request a refund because a chargeback dispute was open for the order.
ORDER_REFUND_INVALID_REASON Invalid REFUND_REASON.
ORDER_REFUND_LINE_ITEM_REFERENCES_NOT_FOUND ORDER_REFUND_LINE_ITEM_REFERENCES is incorrect or not part of Order.
ORDER_REFUND_FEATURE_MISSING You are not allowed to request refund.

Item: Mark_Shipped

Error code Description
ORDER_MARK_SHIPPED_ALREADY_MARKED_SHIPPED Sale already marked shipped.
ORDER_MARK_SHIPPED_NOT_SHIPPABLE Item not shippable.
ORDER_MARK_SHIPPED_STATUS_INVALID Order Status is not Payment Authorized.
ORDER_MARK_SHIPPED_AUTH_EXPIRED Payment authorization has expired. Reauthorize payment before marking shipped.
ORDER_MARK_SHIPPED_TOO_SOON Please wait 24 hours before trying to reauthorize again.
ORDER_MARK_SHIPPED_REAUTH_FAILED Failed to reauthorize payment.
ORDER_MARK_SHIPPED_INTERNAL_ERROR_REAUTH Failed to mark shipped but reauthorization succeeded.
ORDER_MARK_SHIPPED_INTERNAL_ERROR Failed to mark shipped.

Item: Shipping_Price

Error code Description
COUPON_CODES_INVALID The coupon codes format is invalid.
BILLING_DETAILS_COUNTRY_INVALID The billing country code is invalid.
DELIVERY_DETAILS_COUNTRY_INVALID The delivery country code is invalid.
PARAMETERS_INVALID The country code [%s] does not have a currency that is in your account's transactional currencies.
ITEMS_INVALID The shipping price can only be calculated for physical products.

Item: Billing_Details

Error code Description
ORDER_BILLING_DETAILS_COUNTRY_DYNAMIC_NOT_ALLOWED Functionality not available for your account.
ORDER_BILLING_DETAILS_EMPTY Billing details can not be used for delivery as they are empty.
ORDER_BILLING_EMAIL_EMPTY Email cannot be empty.
ORDER_BILLING_EMAIL_EMAIL_INVALID Email is not valid.
ORDER_BILLING_FIRST_NAME_EMPTY The First Name cannot be empty.
ORDER_BILLING_LAST_NAME_EMPTY The Last Name cannot be empty.
ORDER_BILLING_ADDRESS1_EMPTY The Address 1 cannot be empty.
ORDER_BILLING_CITY_EMPTY The City cannot be empty.
ORDER_BILLING_ZIP_EMPTY The Zip cannot be empty.
ORDER_BILLING_STATE_EMPTY The State cannot be empty.
ORDER_BILLING_DETAILS_COUNTRY_EMPTY The Country cannot be empty.
ORDER_BILLING_DETAILS_COUNTRY_INVALID The Country is not supported by the vendor.
ORDER_BILLING_DETAILS_STATE_EMPTY The State cannot be empty.
ORDER_BILLING_DETAILS_STATE_INVALID The State is not valid.
ORDER_BILLING_DETAILS_PHONE_EMPTY The Phone cannot be empty.
ORDER_BILLING_DETAILS_CPF_CNPJ_EMPTY The CPF/CPNJ cannot be empty.
ORDER_BILLING_DETAILS_CPF_CNPJ_INVALID The CPF/CNPJ is invalid.
ORDER_BILLING_DETAILS_COMPANY_EMPTY The Company cannot be empty.
ORDER_BILLING_DETAILS_GSTIN_EMPTY The GSTIN number cannot be empty.
ORDER_BILLING_DETAILS_GSTIN_INVALID The GSTIN number is invalid.
ORDER_BILLING_DETAILS_FISCAL_CODE_EMPTY The Fiscal Code cannot be empty.
ORDER_BILLING_DETAILS_TAX_OFFICE_EMPTY The Tax office cannot be empty.
ORDER_BILLING_DETAILS_TAX_OFFICE_INVALID The Tax office is not valid.
ORDER_BILLING_DETAILS_FISCAL_CODE_INVALID The Fiscal Code is not valid.
ORDER_BILLING_DETAILS_INVALID No billing details have been provided.
ORDER_BILLING_DETAILS_EMAIL_EMPTY The billing email cannot be empty.
ORDER_BILLING_DETAILS_PHONE_INVALID The Phone is invalid (10/11 digits expected).
ORDER_BILLING_DETAILS_TAX_OFFICE_INVALID TaxOffice length exceeds 50 characters.

Item: Delivery

Error code Description
ORDER_DELIVERY_EMAIL_EMPTY The Email cannot be empty.
ORDER_DELIVERY_EMAIL_EMAIL_INVALID The Email is not valid.
ORDER_DELIVERY_FIRST_NAME_EMPTY The First Name cannot be empty.
ORDER_DELIVERY_LAST_NAME_EMPTY The Last Name cannot be empty.
ORDER_DELIVERY_ADDRESS1_EMPTY The Address 1 cannot be empty.
ORDER_DELIVERY_CITY_EMPTY The City cannot be empty.
ORDER_DELIVERY_ZIP_EMPTY The Zip cannot be empty.
ORDER_DELIVERY_STATE_EMPTY The State cannot be empty.
ORDER_DELIVERY_DETAILS_COUNTRY_INVALID The country code is not valid for the current vendor.

Item: Payment_Method

Error code Description

ORDER_PAYMENT_METHOD_EMPTY

No payment method has been provided.
ORDER_PAYMENT_METHOD_INVALID The payment method is not supported by your account.
ORDER_PAYMENT_METHOD_PREVIOUS_ORDER_REFNO_EMPTY The previous order reference number cannot be empty.
ORDER_PAYMENT_METHOD_RETRY_INVALID This payment method is not supported for retrying this order.
ORDER_PAYMENT_METHOD_RESTRICTED The payment method is restricted for product.
ORDER_PAYMENT_METHOD_COUNTRY_INVALID The payment method is not available in the selected country.
ORDER_PAYMENT_METHOD_CURRENCY_INVALID The payment currency is not supported for selected payment method.
ORDER_PAYMENT_METHOD_NOT_ALLOWED Card processing is restricted. Your integration does not meet the requirements for handling sensitive card data.
ORDER_PAYMENT_METHOD_PREVIOUS_ORDER_EMAIL_INVALID The billing email is different from the one of the reference order.
ORDER_PAYMENT_METHOD_CC_VENDOR_3DS_RETURN_URL_EMPTY The PaymentDetails.PaymentMethod.Vendor3DSReturnURL can not be empty.
ORDER_PAYMENT_METHOD_CC_VENDOR_3DS_RETURN_URL_INVALID The PaymentDetails.PaymentMethod.Vendor3DSReturnURL is not valid.
ORDER_PAYMENT_METHOD_CC_VENDOR_3DS_CANCEL_URL_EMPTY The PaymentDetails.PaymentMethod.Vendor3DSCancelURL can not be empty.
ORDER_PAYMENT_METHOD_CC_VENDOR_3DS_CANCEL_URL_INVALID The PaymentDetails.PaymentMethod.Vendor3DSCancelURL is not valid.
ORDER_PAYMENT_METHOD_PAYPAL_EXPRESS_PROCESS_ERROR An error occurred while trying to place the order.
ORDER_PAYMENT_METHOD_PAYPAL_EXPRESS_INTERNAL_ERROR An error from Paypal Express gateway.
ORDER_PAYMENT_METHOD_DIRECT_DEBIT_PROCESS_ERROR An error occurred while trying to place the order.
ORDER_PAYMENT_METHOD_DIRECT_DEBIT_INTERNAL_ERROR Generic error.
ORDER_PAYMENT_METHOD_IDEAL_PROCESS_ERROR An error occurred while trying to place the order.
ORDER_PAYMENT_METHOD_IDEAL_INTERNAL_ERROR Generic error.
ORDER_PAYMENT_METHOD_WE_CHAT_PAY_PROCESS_ERROR An error occurred while trying to place the order.
ORDER_PAYMENT_METHOD_WE_CHAT_PAY_INTERNAL_ERROR Generic error.
ORDER_PAYMENT_METHOD_DIRECT_DEBIT_SWIFT_EMPTY The swift code cannot be empty.
ORDER_PAYMENT_METHOD_DIRECT_DEBIT_IBAN_EMPTY The IBAN cannot be empty or exceed 28 characters./The FirstName cannot be empty or exceed 30 characters./The LastName cannot be empty or exceed 30 characters.
ORDER_PAYMENT_METHOD_IDEAL_BANK_CODE_EMPTY The bank code cannot be empty.
ORDER_PAYMENT_METHOD_INVALID The payment method [%s] is not supported.
ORDER_PAYMENT_METHOD_ORDER_REFERENCE_INVALID Order reference number is required for [%s] payment method./Order reference number is invalid for subscription reference [%s].
PAYMENT_ERROR You cannot place a trial order using [%s] payment method.
PAYMENT_ERROR You cannot place a trial order without a payment method.
ORDER_PAYMENT_METHOD_CARD_MONTH_INVALID The expiration month is invalid.
ORDER_PAYMENT_METHOD_CARD_YEAR_INVALID The expiration year is invalid.
ORDER_PAYMENT_METHOD_CARD_DATE_INVALID The card has expired.
ORDER_PAYMENT_METHOD_CARD_PROCESS_ERROR Couldn't complete the payment validation process: Error processing the credit card transaction. Please contact the issuer bank for more details, or enter another card.
ORDER_PAYMENT_METHOD_CARD_PROCESS_ERROR Couldn't complete the payment validation process: Error processing the credit card transaction. Insufficient funds. Please charge your card account or enter another card.
ORDER_PAYMENT_METHOD_CARD_PROCESS_ERROR Couldn't complete the payment validation process: Access denied in payment gateway! The transaction cannot be finalized at this time. Please try to finalize the transaction in a few minutes.
ORDER_PAYMENT_METHOD_CARD_PROCESS_ERROR Couldn't complete the payment validation process: Error processing the credit card transaction. Please enter another card or try to finalize the transaction in a few minutes.
ORDER_PAYMENT_METHOD_CARD_PROCESS_ERROR 'Couldn't complete the payment validation process: <div align="left">Error processing the credit card transaction. Your credit card was not charged.<br><br>Possible cause: <li>your card is not active for online transactions<li>you have entered invalid or incomplete credit card details<li>a temporary error occurred while processing the payment<br><br><font color="000000">Recommendations:<br>Please enter another card or try to finalize the transaction in a few minutes. If you still get an error, please contact the issuer bank for more details by calling the number on the back of your card.</font></div>
ORDER_PAYMENT_METHOD_CARD_PROCESS_ERROR Couldn't complete the payment validation process: Error processing the credit card transaction. Expired card. Please contact the issuer bank for more details, or enter another card.
ORDER_PAYMENT_METHOD_CARD_PROCESS_ERROR Couldn't complete the payment validation process: Error processing the credit card transaction. No such card. The transaction can be finalized only after entering a valid credit card.
ORDER_PAYMENT_METHOD_CARD_PROCESS_ERROR Couldn't complete the payment validation process: Error processing the credit card transaction. You have entered an invalid CVV2 or CVC2.
ORDER_CURRENCY_CODE_EMPTY The currency code cannot be empty.
ORDER_CURRENCY_INVALID The currency [%s] is not supported by the vendor.
PAYMENT_DECRYPTION_FAILED Invalid key identifier.
TEST_ORDER_NOT_ALLOWED Test orders are not available for your account.
ORDER_PAYMENT_METHOD_CCID_INVALID Invalid CVV2/CVC2 code.
ORDER_PAYMENT_METHOD_CARD_HOLDER_INVALID Invalid name.
ORDER_PAYMENT_METHOD_CARD_NUMBER_INVALID Your card type [%s] does not match the card number [%s].
ORDER_PAYMENT_METHOD_CARD_CURRENCY_INVALID The provided currency [%s] is not supported with this card type. Supported currencies: [%s].
ORDER_REF_MISMATCH The reference number does not belong to a valid order.
ORDER_FRAUD_ERROR The reference number identifies an order that is not yet cleared by fraud.
ORDER_STATUS_ERROR The reference number identifies an order with an incorrect status.
PAYMENT_ERROR The referenced order has an unsupported payment method.
ORDER_PAYMENT_METHOD_CARD_INVALID  Forbidden. You've reached the maximum allowed number of orders with the same credit card.
ORDER_PAYMENT_METHOD_CARD_INVALID Invalid card number entered.
ORDER_PAYMENT_METHOD_CARD_INVALID Visa usually has 16 or 13 digits, but you entered 14.
ORDER_PAYMENT_METHOD_CARD_INVALID Unknown error!
ORDER_PAYMENT_METHOD_CARD_INVALID We don't accept %s cards for online processing.
ORDER_PAYMENT_METHOD_CARD_INVALID Card number is missing %s digit(s).
ORDER_PAYMENT_METHOD_CARD_INVALID The month isn't a string.
ORDER_PAYMENT_METHOD_CARD_INVALID Month has invalid format.
ORDER_PAYMENT_METHOD_CARD_INVALID Invalid expiration date entered or the card has expired.
PAYMENT_ERROR AutoApprove feature is not available for your account.
PAYMENT_ERROR Net payment terms has to be a number of days between [%d] and [%d].
ORDER_PAYMENT_METHOD_DIRECT_DEBIT_IBANSWIFT_INCORRECT Invalid IBAN: [%s] or SWIFT CODE: [%s].
ORDER_PAYMENT_METHOD_DIRECT_DEBIT_IBAN_INVALID Invalid IBAN: [%s].
ORDER_PAYMENT_METHOD_DIRECT_DEBIT_SWIFT_INVALID Invalid SWIFT code: [%s].
ORDER_PAYMENT_METHOD_PAYPAL_RETURN_URL_EMPTY The return URL can not be empty.
ORDER_PAYMENT_METHOD_IDEAL_RETURN_URL_EMPTY The return URL can not be empty.
ORDER_PAYMENT_METHOD_WE_CHAT_PAY_RETURN_URL_EMPTY The return URL can not be empty.
ORDER_PAYMENT_METHOD_EXTERNAL_RETURN_URL_EMPTY The return URL can not be empty.
ORDER_PAYMENT_METHOD_PAYPAL_RETURN_URL_INVALID The return URL is not valid.
ORDER_PAYMENT_METHOD_IDEAL_RETURN_URL_INVALID The return URL is not valid.
ORDER_PAYMENT_METHOD_WE_CHAT_RETURN_URL_INVALID The return URL is not valid.
ORDER_PAYMENT_METHOD_EXTERNAL_RETURN_URL_INVALID The return URL is not valid.
ORDER_PAYMENT_METHOD_IDEAL_BANK_CODE_INVALID Invalid bank code [%s].
INVALID_PAYMENT_METHOD This payment method is not available for your account.
INVALID_CC_TOKEN Invalid token.
INVALID_EES_TOKEN The token is not valid. In order to proceed with the place order a valid token is required.
ORDER_PAYMENT_METHOD_APPLE_PAY_TOKEN_INVALID Invalid payment data: Invalid token.
ORDER_PAYMENT_METHOD_INVALID The payment method [%s] is not supported.
PAYMENT_ERROR Company name is mandatory for Purchase Order.

Item: Payment_Details

Error code Description
ORDER_PAYMENT_DETAILS_INVALID No payment details have been provided/Free orders without payment details are not enabled for your account.

Item: Currency

Error code Description
ORDER_CURRENCY_CODE_EMPTY The currency code cannot be empty.
ORDER_CURRENCY_INVALID The currency [%s] is not supported by the vendor.

Item: Language

Error code Description
ORDER_LANGUAGE_EMPTY Language code cannot be empty.
ORDER_LANGUAGE_INVALID Language [%s] is not supported by current vendor settings.

Item: Affiliate

Error code Description
AFFILIATE_CODE_EMPTY The AffiliateCode parameter cannot be empty.
AFFILIATE_CODE_INVALID The AffiliateCode parameter is invalid.

Item: ExtraInformation

Error code Description
INVALID_RETRY_FAILED_PAYMENT_LINK The retry payment link is not a valid URL.
INVALID_RETRY_FAILED_PAYMENT_LINK The retry payment link has no parameter with placeholder [%s].

Item: Source

Error code Description
INVALID_SOURCE The provided source is empty.

Item: Gift_details

Error code Description
INVALID_GIFT_DETAILS Gift details require that FirstName, LastName, and Email be non-empty.
INVALID_GIFT_EMAIL The gift email [%s] is not valid.
PRODUCT_ERROR Cannot mark the order as a gift until there are products added to the cart.
PRODUCT_ERROR Cannot mark the order as a gift because there are products that are not available as gifts.

Item: Coupon

Error code Description
ORDER_COUPON_CODE_EMPTY The coupon code is empty.
ORDER_COUPON_CODE_INVALID The provided coupon [%s] is invalid.

Item: Promotion

Error code Description
ORDER_PRODUCT_PROMOTION_CODE_INVALID The provided promotion code [%s] is invalid.

Item: Additional_Field

Error code Description
ORDER_ADDITIONAL_FIELD_REQUIRED The order additional information field [%s] was not set, and it's marked as mandatory.

Item: Order_Product_Additional_Fields

Error code Description
ORDER_PRODUCT_ADDITIONAL_FIELD_REQUIRED Add the required product additional information fields [%s] for products [%s].
ORDER_PRODUCT_ADDITIONAL_FIELD_REQUIRED The product additional information field [%s] was not set for product [%s], and it\'s marked as mandatory

Item: SubscriptionCustomSettings

Error code Description
ORDER_ITEMS_SUBSCRIPTION_CUSTOM_SETTINGS_CYCLE_UNIT_INVALID Invalid item subscription custom settings cycle unit. Accepted values: DAY, MONTH.
ORDER_ITEMS_SUBSCRIPTION_CUSTOM_SETTINGS_CYCLE_LENGTH_INVALID Invalid item subscription custom settings cycle length. Use positive integers, or -1 when contract length is NULL.
ORDER_ITEMS_SUBSCRIPTION_CUSTOM_SETTINGS_CONTRACT_LENGTH_INVALID Invalid item subscription custom settings contract length. Use positive integers or NULL.
ORDER_ITEMS_SUBSCRIPTION_CUSTOM_SETTINGS_CONTRACT_LENGTH_FORBIDDEN Forbidden item subscription custom settings contract length. Use a value that is a multiple of the cycle length value.
ORDER_ITEMS_SUBSCRIPTION_CUSTOM_SETTINGS_CYCLE_AMOUNT_INVALID Item subscription custom settings cycle amount must be a positive value (INT or FLOAT).
ORDER_ITEMS_SUBSCRIPTION_CUSTOM_SETTINGS_CYCLE_AMOUNT_TYPE_INVALID Invalid item subscription custom settings cycle amount type. Accepted values: NET, GROSS.
ORDER_ITEMS_SUBSCRIPTION_CUSTOM_SETTINGS_CLIENT_DEAL_AUTO_RENEWAL_INVALID Invalid item subscription custom settings client deal auto-renewal.
ORDER_ITEMS_SUBSCRIPTION_CUSTOM_SETTINGS_MERCHANT_DEAL_AUTO_RENEWAL_INVALID Invalid item subscription custom settings merchant deal auto-renewal.

Other

Error code Description

ORDER_PHYSICAL_FEATURE_MISSING

You are not allowed to place orders with physical products.
ORDER_ERROR Couldn't process the order/Order reference is invalid.
GIFT_ORDER_NOT_ALLOWED Cannot place the order because order is marked as gift and product is not available as a gift.
TEST_ORDER_NOT_ALLOWED Test orders are not available for your account.
ORDER_CURRENCY_MISMATCH Order currency values must match.
ORDER_TOTAL_NEGATIVE Order total must be zero or a positive value.
ORDER_TEST_MODE_REQUIRED Test mode is required on test subscriptions.
BANNED_SHOPPER_IP The shopper is banned.
AUTHENTICATION_ERROR Authentication needed for this resource.

 

Promotions

Overview

Use the Promotion object via JSON-RPC API 4.0 to retrieve information on discounts/promotions you set up for your account.

Parameters

Parameters Type/Description

Promotion

Object

  Detailed below.

CouponCodes

Array of strings

 

Array of coupon/voucher codes when Coupon / Voucher type is Multiple. Otherwise, empty array.

ChannelType

String

 

Possible values:

  • ECOMMERCE
  • CHANNEL_MANAGER
  • ALL

CouponType

String

 

Possible values:

  • SINGLE
  • MULTIPLE

DiscountType

String

 

Possible values:

  • FIXED
  • PERCENT

Type

String

 

REGULAR

Discount

Int

 

The value of the discount. Example, for a $30 USD discount Avangate returns the value 30 and for a 25% price cut, Avangate returns 25.

Products

Array

 

Array of product codes for the products impacted by the promotion.

Name

String

 

Promotion name.

Description

String

 

Promotion description.

StartDate

String

 

Starting date. The date when you set the promotion to start. Is NULL for promotions that start immediately after they're created.

EndDate

String

 

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

MaximumOrdersNumber

Int

 

When the maximum number of orders is reached the promotion stops. 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 product, smaller than the maximum quantity you defined. Can be NULL if you want the promotion to apply to an unlimited number units. Any extra quantity added to the cart will be sold at full price.

InstantDiscount

Boolean

 

Selecting the instant discount option will auto-apply the discount for ALL the selected products for all shoppers, without the need to enter the discount coupon.

Coupon

String

 

The promotion/voucher for which you are extracting the information.

DiscountLabel

String

 

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

Enabled

Boolean

 

Can be TRUE if promotion is enabled, or FALSE if otherwise.

Currency

String

 

Currency code available for the default currency of FIXED promotions. Missing for PERCENT promotions.

Code

String

 

Unique, system-generated identifier Avangate associates with promotion campaigns.

PriceThreshold

Object

 

Limits discount use only when total order value (taxes included) exceeds the threshold you configure.

 

Amount

 Decimal

 

 

The minimum threshold you defined for the default currency.

 

Currency

String

 

 

Currency code available for the default currency of custom threshold settings

 

 

 

 

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