Skip to main content

SOAP code samples

Overview 

  1. Working code samples for JSON-RPC and SOAP are available in PHP for each documented method, including the clients you need to make API calls. You need to replace the dummy Merchant Code and Secret Key with those available in your Merchant Control Panel.
  2. Working code samples for REST are available for each documented scenario and method. Check out the REST reference for examples. To access code samples, select any scenario and click on the "Working example" link. Working code samples:

 

  • cURL
  • Java
  • JavaScript
  • Node.js
  • Perl
  • Python
  • PHP
  • Ruby
  • Go
  • C#
  • Visual Basic
  • Groovy
  • Objective-C
  • Swift

 

Copy payment info

Overview

Copy card-on-file data available in the 2Checkout system from a source subscription to an imported target subscription. 2Checkout uses the existing payment information to charge customers as a part of the recurring billing (renewal) process.

Use the copyPaymentInfo method.

Requirements

The imported target subscription and the source subscription must belong to the same customer. The 2Checkout system checks to make sure that the 2Checkout Customer Reference (an internal identifier) coincides with the customer accounts associated with the target and source subscriptions.

Availability

Please contact 2Checkout directly if you wish to take advantage of this feature.

How does this method work?

  1. Customer A purchases Subscription A using a VISA credit card and you import Subscription B for the same customer with no data or with an AMEX card.
  2. When 2Checkout renews Subscription A, it charges Customer A using the VISA, while using the AMEX (if the data was provided) for Subscription B charges.
  3. When you copy the payment data from Subscription A to Subscription B, the 2Checkout system uses the VISA credit card to renew both subscriptions according to their respective recurring billing cycles. 2Checkout charges customers during the recurring billing process for the imported target subscription using the payment method they used to purchase the source 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.

TargetSubscriptionReference

Required (string)

 

The 2Checkout Subscription Reference of the imported target subscription, to which 2Checkout copies the payment on file data associated with the source subscription.

SubscriptionReference

Required (string)

 

The 2Checkout Subscription Reference of the source subscription whose attached payment on file data 2Checkout copies to the target subscription.

Response

Parameter Type/Description

Boolean

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

Request

<?php

require ('PATH_TO_AUTH');

$TargetSubscription = 'FFAE3C9429';
$SourceSubscription = '9F4154733C';

try {
    $payInfo = $client->copyPaymentInfo($sessionID, $TargetSubscription, $SourceSubscription);
}
catch (SoapFault $e) {
    echo "payInfo: " . $e->getMessage();
    exit;
}
var_dump("payInfo", $payInfo);

 

Account Payouts

Overview

Retrieve the account balance from your current payout period, detailed for each billing currency.

You can also search for the historical transfers issued by 2Checkout for your account, and filter the results based on the payment date, method or invoice paid.

 

 

Pay partner invoice (card payment)

Overview

Pay a partner invoice that was set using setProforma. Works in conjunction with setProforma and setPaymentDetails. Call setProforma, then setPaymentDetails and payProforma in this specific order to pay for a partner invoice.

Requirements

This method requires that a specific partner be set using setPartner.

You also need to use setProforma to mark a partner invoice for payment, and specify the payment method with setPaymentDetails.

Parameters

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

Response

Parameter Type/Description
result Boolean
  True or false.

Request

<?php

require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner
require('PATH_TO_setProforma'); // setProforma example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/14Billing/00Capture_card_payment/00Set_partner_invoice
require('PATH_TO_setPaymentDetails'); // setPaymentDetails example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/14Billing/00Capture_card_payment/02Set_partner_invoice_payment_details

try {
    $ProformaPay= $client->payProforma($sessionID);
} catch (SoapFault $e) {
    Echo "ProformaPaid: " . $e->getMessage();
    exit;
}
var_dump ("ProformaPaid ", $ProformaPay);

Errors

Error Description

INVALID_PARTNER

No partner is set.

PAYMENT_PROFORMA

You must use setPaymentDetails first.

PAYMENT_PROFORMA

This is a paid partner invoice.

PAYMENT_ERROR

Authorization error.

 

Retrieve proposal by ID

Overview

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

Request Parameters

Request parameters for the getProposalById JSON-RPC APIv6 method
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";

$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'getProposalById';
$jsonRpcRequest->params = array($sessionID, $proposalID);
$jsonRpcRequest->id = $i++;

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

Response

The getProposalById call via JSON-RPC APIv6 returns the Proposal object.

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.

 

 

Retrieve product price

Overview

Get the price for a product in a new purchase scenario, based on the product ID, the pricing list it's assigned to, and specific pricing options.

Requirements

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

Parameters

Parameter Type/Description
sessionID Required (string)
  Session identifier, which is the output of the Login method. An exception will be thrown if the values are incorrect.
productId Required (string)
  The unique identifier of the product from your system.
pricingListCode Required (string)
  The unique identifier of the pricing list.
priceOptions Optional (StringArray)
  Array of pricing option codes. These identifiers mark the individual options inside pricing options configuration groups. Can be NULL.

Response

Parameter Type/Description
UnitPrice Object
  UnitPrice object.

Request

<?php

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

$productId = 'YOUR_PRODUCT_ID';
$pricingListCode = 'YOUR_PRICING_LIST_CODE';
$priceOptions = array(
'PRICE_OPTION_CODE_1',
'PRICE_OPTION_CODE_2'
);

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'getProductPrice',
'params' => array($sessionID, $productId, $pricingListCode, $priceOptions)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));

Errors

Error Description

INVALID_PARTNER

No partner is set.

PRODUCT_ERROR

Invalid product ID.

PARTNER_PRICING_LISTS_NOT_FOUND

There are no pricing lists with the provided code.

PRODUCT_NOT_FOUND

There is no active product with the provided ID in the given pricing list.

 

Assign price option group

Overview

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

Parameters

Parameters Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

PricingConfigurationCode

Required (string)

 

Unique, system-generated pricing configuration identifier.  

PriceOptionsGroupAssigned

Required (Object)

 

Details below.

 

Parameters Type/Description

PriceOptionsGroupAssigned

Object

Code

Required (string)

 

PricingOption Group identifier.

Required

Required (Object)

 

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

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$PricingConfigurationCode = 'YOUR_CODE';
$PriceOptionsGroupAssigned = new stdClass();
$PriceOptionsGroupAssigned->Code = 'USERSUSERS';
$PriceOptionsGroupAssigned->Required = TRUE;

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'assignPricingConfigurationOptionGroup',
'params' => array($sessionID, $PricingConfigurationCode, $PriceOptionsGroupAssigned)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));

?>

Place orders with dynamic product information

Overview

Use this object to create new orders and collect payments from shoppers using products with dynamic information. 

Purchase types available are PRODUCT, TAX, SHIPPING, and COUPON. The surcharge defined in the pricing option is used for calculating the order renewal price, when applicable.

You can find a list of common errors that may arise when using the placeOrder call via APIv6 here.

   This functionality is available only for merchants on the 2Sell and 2Subscribe accounts (PSP business model), for orders that are placed both through ConvertPlus/InLine ordering engines and API calls.

Supported payment methods

  1. Credit/Debit cards: Visa, Visa electron, MasterCard, Maestro, Amex, Discover, Dankort, Carte Bleue, JCB. 2Checkout supports local Brazilian cards.
  2. PayPal
  3. Free orders (no payment information required).
  4. 2Pay.js

How to test?

Place test orders with dynamic product information by following the instructions from this article.

Requirements

The product code must be sent as null. The order currency must match with the payment currency, otherwise, an error is thrown. The isDynamic parameter of the Items object must be true.

For credit card orders placed using API 5.0 or newer versions, you need to pass through additional parameters that support the 3D Secure flow. 3D Secure works by redirecting customers to pages provided by their banks, where they need to enter additional security tokens or passwords to trigger the completion of the charge. By using 3D Secure, you get additional protection from liability for fraudulent card payments, with customers having to go through an extra layer of authentication.

Send the following parameters as part of the PaymentMethod object:

Parameters Description
Vendor3DSReturnURL Required (string)
  URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized.
Vendor3DSCancelURL Required (string)
  URL address to which customers are redirected if the 3DS details were not validated or the order could not be authorized.
WSOrder String (optional)
 

The WSOrder parameter is used to control the website URL displayed in the email messages shoppers receive after they place an order. By default, 2Checkout reports the URL set as Homepage in the Account information area. Adding WSOrder to the buy-links for your products will cause the optional website address set by using the parameter to override and replace the Homepage URL in the email notifications sent to customers. The behavior is similar to the WS_ORDER parameter supported on checkout/cart pages and described here.

Limitations

Placing an order with both catalog and dynamic product information is not possible. Recurring options can be set only for purchase type PRODUCT and TAX.

Parameters

Name

Parameters Type/Description

Currency

Optional (string)

 

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

Country

Optional (string)

 

Shopper country. ISO 3166 two-letter code. Example: “us.”

Language

Optional (string)

 

ISO 639-1 two-letter code. Language used for the purchase process. Example: “en.”

ExternalReference

Optional (string)

 

Set external reference identifiers for orders. Enables you to replicate the functionality of the REF parameter included into Buy Links. Maximum 100 characters. If there is a need for longer references, you can apply an md5 hash for any string value, resulting in a 32 characters string. You can verify the hash after the order notification, on the client side.

Source

Optional (string)

 

The link source for the sales. Enables you to replicate the functionality of the SRC (separate link identifier) parameter when included into Buy Links. Use the SRC parameter to track sale sources.

 

Maximum length 255 characters.

CustomerReference

Optional (Int)

 

External customer ID you can attach to the customer.

Affiliate Object/Optional
                 AffiliateCode String/Required
  The affiliate unique code (as returned by the affiliates API methods).
                 AffiliateSource String/Optional
  The affiliate source.

MachineId

Optional (string)

 

Unique, system generated code for each unique customer, identifying returning customers.

Items

Required (array of objects)

 

Details below. 

 

Code

Optional (string)

 

 

Should be sent as NULL. Any other value is ignored.

 

Quantity

Required (integer)

 

 

Number of units purchased.

 

isDynamic

Required (bool)

 

 

Send TRUE for orders with dynamic product information.

 

Tangible

Required (bool)

 

 

Possible values:

  • FALSE for products delivered electronically.
  • TRUE for tangible products, that require physical delivery.
 

PurchaseType

Required (string)

 

 

Purchase types available are:

  • PRODUCT - item purchased by the customer. Can have pricing options and recurring properties attached.
  • TAX - additional handling fee added to the purchase.
  • SHIPPING - shipping fee applied to purchase.
  • COUPON - amount deducted from total order price. Send positive values.
 

PriceOptions

Optional (array of objects)

 

 

Array of price option groups.

   

Name

Optional (string)

   

 

Name of the pricing option group.

   

Options

Optional (array of objects)

   

 

Array of pricing options.

     

Name

Optional (string)
     

 

Pricing option name.

     

Value

Optional (string)
     

 

Pricing option code.

     

Surcharge

Optional (double)
     

 

Surcharge of the pricing option. For renewal orders, the renewal price includes the pricing option surcharge from the initial order. 

 

RecurringOptions

Optional (Object)

 

 

Contains recurring options.

   

CycleLength

Optional (int)

   

 

The length of the recurring billing cycle.

   

CycleUnit

Optional (string)

   

 

Unit of measuring billing cycles (years, months).

   

CycleAmount

Optional (int)

   

 

The amount to be billed on each renewal.

   

ContractLength

Optional (int)

   

 

The contact length for which the recurring option will apply.

   

ContractUnit

Optional

   

 

Unit of measuring contact length (years, months).

 

Name

Required (String)

 

 

Product name.

 

Price

Required (Object)

 

 

Details below.

   

Amount

Required (Int)

   

 

Amount of the product.

   

Type

Optional (string)

   

 

Send "CUSTOM" for dynamic pricing.

 

Trial

Optional (Object) – Can be NULL

 

 

Details below.

   

Period

Optional (integer)

   

 

The length of the trial subscription lifetime in days.

   

Price

Optional (double)

   

 

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

 

AdditionalFields

Optional (array of objects) – Can be NULL

   

AdditionalFieldSet

Optional (Object) – Can be NULL

   

 

Details below

     

Code

Optional (string)

     

 

Identifier code for the additional field.

     

Text

Optional (string)

     

 

Text displayed in the additional field.

     

Value

Optional (string)

     

 

Additional field value.

 

SubscriptionStartDate

Optional (string)

 

 

Specify the date time stamp when the subscription becomes active. Format 2016-07-02 22:22:22 (YYYY-MM-DD HH:mm:ss). Available for JSON-RPC and REST.

Send empty or NULL to activate subscriptions on the same date when customers purchase them.

You can exclude HH:mm:ss when sending the date and include only YYYY-MM-DD. In this case, 2Checkout uses 00:00:01. Default time zone GMT+02:00.

BillingDetails

Required (Object)

 

 

Details below. 

 

FirstName

Required (string)

 

 

Shopper name.

 

LastName

Required (string)

 

 

Shopper surname.

 

CountryCode

Required (string)

 

 

Shopper country. ISO 3166 two-letter code.

 

State

String/Optional – Required for US, Canada, Brazil, Turkey, India and Romania

 

 

The state in the shopper's country. Mandatory when you set the Billing Country to US, Canada, Brazil, Turkey, India and Romania. Use case insensitive utf8 strings for the full name, or just the two-letter code.

 

City

Required (string)

 

 

Shopper city.

 

Address1

Required (string)

 

 

Shopper address.

 

Address2

Optional (string)

 

 

Shopper address.

 

Zip

Required (string)

 

 

ZIP/ Postal code.

 

Email

Required (string)

 

 

Shopper email address.

 

Phone

Optional (string)

 

 

Shopper phone number. Mandatory when you set Brazil as the Billing Country. Can be NULL.

 

Company

Optional (string)

 

 

Company name. Can be null for end users. When present, you also need to provide the FiscalCode.

 

FiscalCode

Optional (string) – Required for Brazil

 

 

• For companies, it needs to be the VAT ID. 2Checkout will validate the value provided and throw an error if the VAT ID is invalid/incorrect when calling setPaymentDetails. When present, you also need to provide the Company name.

• Mandatory when you set Brazil as the Billing Country. For Brazilian customers it represents the Fiscal Code (CPF/CNPJ).

Mandatory when you set India as the Billing Country, and purchase is made by a Company.

• Can be NULL for end users.

 

TaxExemptionId

Optional (string)

 

 

Tax Exempt Certification id used to deduct taxes for US orders.

Example: 1b80eecc349v

DeliveryDetails

Required (Object)

 

Details below. 

 

FirstName

Required (string)

 

 

Shopper name from the delivery details.

 

LastName

Required (string)

 

 

Shopper surname from the delivery details.

 

CountryCode

Optional (string)

 

 

Shopper country. ISO 3166 two-letter code from the delivery details.

 

State

String/Optional – Required for US, Canada, Brazil, Turkey, India and Romania

 

 

The state in the shopper's country. Mandatory when you set the Billing Country to US, Canada, Brazil, Turkey, India and Romania. Use case insensitive utf8 strings for the full name, or just the two-letter code.

 

City

Optional (string)

 

 

Shopper city from the delivery details.

 

Address1

Optional (string)

 

 

Shopper address from the delivery details.

 

Address2

Optional (string)

 

 

Shopper address from the delivery details.

 

Zip

Optional (string)

 

 

ZIP/ Postal code from the delivery details.

 

Email

Optional (string)

 

 

Shopper email address from the delivery details.

 

Phone

Optional (string)

 

 

Shopper phone number from the delivery details. Mandatory when you set Brazil as the Billing Country. Can be NULL.

 

Company

Optional (string)

 

 

Company name from the delivery details. Can be null for end users. When present, you also need to provide the FiscalCode.

DeliveryInformation

Object / Optional

For products that require physical delivery, use this object to send the shipping method.

  ShippingMethod

Object

Details below

    Code String
  System-generated identified for your shipping method configuration.

PaymentDetails

Required (Object)

 

Adapt this object to the desired payment method.

 

Type

Required (string)

 

 

The payment method:

  • CC (credit/debit card - including local Brazilian cards).
  • ENCRYPTED_PAYMENT_DATA (client-side encryption)
  • PAYPAL
  • PAYPAL_EXPRESS
  • TEST (for test orders).
  • PREVIOUS_ORDER(place new orders using the reference of a previous order).
  • EXISTING_PAYMENT_DATA  (use a card one of your customers already used to purchase from your account).
  • WIRE – the placeOrder response includes Wire payment details.
  • CHECK – the placeOrder response includes Check payment details.
  • WE_CHAT_PAY (for WeChat payments).
  • IDEAL (for iDEAL payments).
  • PURCHASEORDER - use for orders with POs.
  • FREE – for 0 value orders for which you’re not requiring customers to provide payment details.
  • EES_TOKEN_PAYMENT (2Pay.js)
  • GOOGLE PAY

 

Currency

Required (string)

 

 

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

  RecurringEnabled Optional (boolean)
   

true – shopper checks the auto-renewal checkbox and 2Checkout charges subscription renewals using a recurring billing process.

false – shopper doesn’t check the auto-renewal checkbox.

 

PaymentMethod

Optional (object)

 

 

Object structure and parameters differ according to payment method selected and API method (placing orders (POST) vs. retrieving order data (GET)).

 

NULL for 0 value orders for which you’re not requiring customers to enter payment details.

 

 

CardPayment

Optional (object)

 

 

 

Details below. 

 

 

 

CardNumber

Required (string)

 

 

 

 

The credit/debit card number.

 

 

 

CardType

Required (string)

 

 

 

 

visa, visaelectron, mastercard, maestro, amex, discover, dankort, cartebleue, jcb, hipercard, elo

 

 

 

ExpirationYear

Required (string)

 

 

 

 

The year in which the card expires.

 

 

 

ExpirationMonth

Required (string)

 

 

 

 

The month in which the card expires.

 

 

 

HolderName

Required (string)

 

 

 

 

Cardholder name.

      Vendor3DSReturnURL Required (string)
        URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized.
      Vendor3DSCancelURL Required (string)
        URL address to which customers are redirected if the 3DS details were not validated or the order could not be authorized.

 

 

 

CCID

Optional (string)

 

 

 

 

Credit Card Identification - an extra ID printed on the card, usually a 3-4 digit number, the CVC2/CVV2.

      HolderNameTime Optional (float)
       

The interval of time in seconds in which shoppers enter their name in the HolderName field. An abnormally short interval is usually a red flag for fraud attempts.

Can be NULL, but not a negative number.

      CardNumberTime Optional (float)
       

The interval of time in seconds in which shopper enter their card number in the CardNumber field. An abnormally short interval is usually a red flag for fraud attempts.

Can be NULL, but not a negative number.

 

 

 

InstallmentsNumber 

Optional (Int)

 

 

 

 

Number of installments. Available only when customers un Brazil pay with Visa or MasterCard using Brazilian Real as the order currency. Use 1 or exclude the parameter for full payments. 

 

CustomerIP

Optional (string)

 

 

Shopper IP.

Promotions Optional (Array of strings)
  Array of promotion codes.

LocalTime

Optional (string)

 

Local shopper time in the following format: Y-m-d H:i:s.

This parameter can impact the fraud score of an order when it's missing, NULL or incorrectly formatted.

 

 

Customer IDs

Overview

The 2Checkout system creates Customer IDs by default for all subscriptions it generates.

Unique customer IDs

Customers purchasing products/subscriptions sold through the 2Checkout platform can be assigned a unique customer IDs that you control in addition to the unique 2Checkout customer IDs created and assigned automatically.

External Customer IDs and 2Checkout Customer IDs are complementary.

Customer IDs can be:

  • Unique alphanumeric ID (string) defined per-customer.
  • Unique numerical (integer) ID generated by the 2Checkout system automatically.

Create external customer ID 

When changing the Customer billing details of an account, you also have the option of providing the external customer ID if none exists.

You can enter any unique alphanumeric ID (string) as long as it's not already used as the external identifier of an existing Customer, in which case you'll receive the following error message: "The External ID you entered is used by another customer account. Please enter a new External ID and try again."

Edit external customer ID 

When changing the Customer billing details of an account, you also have the option of editing an existing external customer ID.

External references can be swapped for any unique alphanumeric ID (string) you wish as long as an existing customer account in the 2Checkout system isn't already using the same identifier.

Import customer IDs

When importing subscriptions, the 2Checkout system automatically generates subscriptions to match the data in the CSV file used for the importing process.

The existing importing functionality of the 2Checkout system was expanded to support external customer IDs. In this regard, you can specify an ExternalCustomerId for each of the subscriptions that you import.

Optional Fields

Description

Required

ExternalCustomerId

The identifier for the same customer using one or more subscriptions. ExternalCustomerId is stored into the 2Checkout system and can subsequently be used for management tasks impacting Customers.

NO

Importing a new subscription

Specify the desired ExternalCustomerId in the column of the CSV file when importing a new subscription to have the 2Checkout system create a new Customer Account with the identifier for that specific subscription.

Edit customer IDs

Use the subscription import functionality offered by the 2Checkout platform in order to edit customer IDs.

Specify a new ExternalCustomerId in the column of the CSV file when importing an existing subscription to have the 2Checkout system update the associated Customer account, replacing the old ID with the new identifier.

Customer IDs in LCNs and IPNs

AVANGATE_CUSTOMER_REFERENCE - Default customer numerical (integer) IDs generated automatically by the 2Checkout system.

EXTERNAL_CUSTOMER_REFERENCE - Unique customer alphanumeric (string) identifiers that you control.

The 2Checkout system creates the Avangate Customer ID (AVANGATE_CUSTOMER_REFERENCE) by default for successfully placed orders that include products generating subscriptions. AVANGATE_CUSTOMER_REFERENCE is always included in both IPN and LCN.

Unique customer identifiers (EXTERNAL_CUSTOMER_REFERENCE) that you control are only included in LCN and IPN provided that you set them up via:

  • The Buy Link using the CUSTOMERID parameter
  • Orders placed using the 2Checkout API 

In scenarios in which you don't provide a unique customer identifier, EXTERNAL_CUSTOMER_REFERENCE will be empty in both IPN and LCN when they're first sent out.

Adding a unique customer identifier after the order was finalized won't trigger the LCN on its own. However, the next time that the LCN is generated for updates impacting the license directly, the notification will also include the EXTERNAL_CUSTOMER_REFERENCE you added. The same behavior applies to scenarios in which you move a subscription under a specific customer.

Buy-link Customer ID Parameter

External customer ID in buy-links

Create new Customer accounts for subscriptions generated when shoppers purchase your products. You can use the CUSTOMERID (case sensitive) parameter to set external identifiers in the buy links of the products purchased by your customers. Note: Products need to have the renewal system enabled and a subscription generated as a part of the purchasing process for Customer accounts to be created or updated accordingly.

Add the CUSTOMERID parameter to a buy link generated using the Sales Links area of the Control Panel. For example, the following link:

https://secure.2checkout.com/order/checkout.php?PRODS=1234567

should be changed to

https://secure.2checkout.com/order/checkout.php?PRODS=1234567&CUSTOMERID=999999a

If the no existing Customer Accounts feature the 999999a identifier, then a new Customer Account will be created using the external reference you specified.

Attribute a subscription to an existing customer 

Aggregate subscriptions under the same Customer account if the products they're associated with are purchased by the same shopper by taking advantage of theCUSTOMERID (case sensitive) parameter added to buy links.

You can use and existing external customer ID for a Customer account already generated in the 2Checkout system to place new orders.

Let's assume that a customer account with the 999999a CUSTOMERID (external customer reference) was already created for one of your shoppers for a previous order. When the same shopper places a new order using the 2Checkout platform, the subscriptions generated will automatically be grouped under the same Customer account provided that the purchase is done using a buy link which features &CUSTOMERID=999999a.

For example, the following link:

https://secure.2checkout.com/order/checkout.php?PRODS=1234999

should be changed to

https://secure.2checkout.com/order/checkout.php?PRODS=1234999&CUSTOMERID=999999a

to ensure that any new subscriptions generated will be aggregated under the existing Customer accounts with the 999999a identifier.

Place orders using the Avangate Customer Reference (ID) AV_CUSTOMERID

The 2Checkout system generates default customer numerical (integer) IDs automatically for all orders containing products that feature subscriptions. Once created, Avangate customer references can be used for new acquisitions aggregating new subscriptions under an existing Customer account.

Note: Avangate customer references are spawned automatically by the 2Checkout system. While you're able to use them to place new orders for existing customers, you can't set your own Avangate customer references. However, you can create and edit External customer references according to your needs. External Customer IDs and Avangate Customer IDs can coexist.

Existing system-generated IDs can serve to group new subscriptions under already created Customer accounts, by using the AV_CUSTOMERID (case sensitive) parameter in the Buy Links for orders.

Assume that a Customer account with the 123456789 AV_CUSTOMERID (internal Avangate customer reference) was already created for one of your shoppers for a previous order. When the same shopper places a new order using the 2Checkout platform, the subscriptions generated will automatically be grouped under the same Customer account provided that the purchase is done using a buy link which features &AV_CUSTOMERID=123456789. All subscriptions generated as a result of this order will automatically be grouped under the customer featuring the 123456789 system generated ID.

Note: AV_CUSTOMERID can only be used for new acquisitions made by existing customers, which have already had an internal Avangate customer reference attributed to them.

If parameters for both an Avangate Customer ID and an External Customer ID are used in the Buy Link for the same order, the internal Avangate customer reference will take precedence over the external identifier (that will be ignored by the system. )

 

Customer reference scenarios

Avangate Customer ID 

(internal, system-generated customer reference) 

is used

External Customer ID 

(external customer reference) is used

Result

NO

(new order without AV_CUSTOMERID in the Buy Link)

NO

(new order without CUSTOMERID in the Buy Link)

New customer account is generated using the order billing details.

New Avangate customer reference is also created for the account.

NO

(new order without AV_CUSTOMERID in the Buy Link)

YES

(new order with CUSTOMERID in the Buy Link)

New customer account is generated using the order billing details.

New Avangate customer reference is also created for the account.

The customer account will feature the External customer reference provided.

YES

(new order with AV_CUSTOMERID in the Buy Link)

YES

(new order with CUSTOMERID in the Buy Link, but identifier is either new or different than the one featured by the customer account for which the Avangate customer reference was provided)

Subscriptions generated are automatically assigned to the customer account featuring the Avangate customer reference provided in the Buy Link.

YES

(new order with AV_CUSTOMERID in the Buy Link)

NO

(new order without CUSTOMERID in the Buy Link)

Subscriptions generated are automatically assigned to the customer account featuring the Avangate customer reference provided in the Buy Link.

YES

(new order with AV_CUSTOMERID in the Buy Link)

YES

(new order with CUSTOMERID in the Buy Link, and the identifiers is the same as the one featured by the customer account for which the Avangate customer reference was provided)

Subscriptions generated are automatically assigned to the customer account featuring the Avangate customer reference provided in the Buy Link.

NO

(new order without AV_CUSTOMERID in the Buy Link)

YES

(new order with CUSTOMERID in the Buy Link, and the identifiers used is an External customer reference for and existing customer account)

Subscriptions generated are automatically assigned to the customer account featuring the External customer reference provided in the Buy Link.

Network Cross-selling

The Customer ID used in the buy link is limited to the customers of the vendor which owns the shopping cart. Subscriptions from third-party 2Checkout vendors will not be associated with the same customer ID as that of the main vendor. 

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