Skip to main content

Retrieve subscriptions

Overview

Extract information on your account’s subscriptions. Use the searchSubscriptions method to retrieve details about your account’s subscriptions, based on a set of filters.

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.

searchBy

Optional (Object)

 

Unique, system-generated subscription identifier.

 

SubscriptionSearchOptions Parameters Type/Description

CustomerEmail

Optional (string)

 

Customer email address. Can be NULL.

ExactMatchEmail Optional (Boolean)
 

Force search by email to perform exact match; recommended to keep this option set to true in order to avoid matching similar email addresses from multiple customers.

DeliveredCode

Optional (string)

 

Activation key/code. Can be NULL.

AvangateCustomerReference

Optional (int)

 

System-generated customer reference. Can be NULL.

ExternalCustomerReference

Optional (string)

 

External customer reference that you control. Can be NULL.

Aggregate

Optional (boolean)

 

true - search will work across all your aggregated 2Checkout accounts.

false - default value. You limit the search to the account whose details you used for authentication.

Can be NULL.

SubscriptionEnabled

Optional (boolean)

 

true for enabled subscriptions.

false for disabled subscriptions.

Can be NULL.

RecurringEnabled

Optional (StringArray)

 

true – 2Checkout charges customers using recurring billing for subscriptions.

false – customers need to make manual payments to renew their subscriptions.

Can be NULL.

ProductCodes

Optional (StringArray)

 

Product identifier that you control. Can be NULL.

CountryCodes

Optional (string)

 

Country code (ISO 3166 two-letter code). Can be NULL.

PartnerCode Optional (string)
  Can be NULL.

PurchasedAfter

Optional (string)

 

YYYY-MM-DD. Subscription search interval start. You can search for subscriptions purchased between the dates you set using PurchasedAfter and PurchasedBefore. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

PurchasedBefore

Optional (string)

 

YYYY-MM-DD. Subscription search interval end. You can search for subscriptions purchased between the dates you set using PurchasedAfter and PurchasedBefore. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

ExpireAfter

Optional (string)

 

YYYY-MM-DD. Search subscriptions set to expire after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

ExpireBefore

Optional (string)

 

YYYY-MM-DD. Search subscriptions set to expire before a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

ModifiedAfter Optional (string)
  YYYY-MM-DD HH-MM-SS. Search subscriptions modified after a specific date.
ModifiedBefore Optional (string)
  YYYY-MM-DD HH-MM-SS. Search subscriptions modified before a specific date.

RenewedAfter

Optional (string)

 

YYYY-MM-DD. Search subscriptions renewed after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

RenewedBefore

Optional (string)

 

YYYY-MM-DD. Search subscriptions renewed before a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

NotificationAfter

Optional (string)

 

YYYY-MM-DD. Search subscriptions for which the 2Checkout system sent out notifications after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

NotificationBefore

Optional (string)

 

YYYY-MM-DD. Search subscriptions for which the 2Checkout system sent out notifications before a specific date Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

Type

Optional (string)

 

trial - trial subscriptions.

regular - all generated subscriptions that are not trials.

regularfromtrial - subscriptions generated from a trial conversion.

Can be NULL.

TestSubscription

Optional (boolean)

 

true

false, depending on whether you want to include test subscriptions in the search or not. Can be NULL.

LifetimeSubscription

Optional (boolean)

 

true – evergreen subscriptions.

false - subscriptions with a limited recurring billing cycle, typically no larger than 36 months.

Can be NULL.

Page

Optional (int)

 

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

Can be NULL.

Limit

Optional (int)

 

Number of results (subscriptions) displayed per page. Default value is 10.

Can be NULL.

Response

Parameters Type/Description

Subscription

Array of objects

Request

<?php

require ('PATH_TO_AUTH');

$SubscriptionSearch = new stdClass();
$SubscriptionSearch->CustomerEmail  = 'example@email.com';
$SubscriptionSearch->DeliveredCode = null;
$SubscriptionSearch->AvangateCustomerReference = null;
$SubscriptionSearch->ExternalCustomerReference = null;
$SubscriptionSearch->Aggregate = false;
$SubscriptionSearch->SubscriptionEnabled = null; //true false null
$SubscriptionSearch->RecurringEnabled = null; // true - autorenewal, false - manual renewal, null = both(default)
$SubscriptionSearch->ProductCodes = null; //array('Product_Code1', 'Product_Code2');
$SubscriptionSearch->CountryCodes = null;//array ('au')
$SubscriptionSearch->PartnerCode = null;
$SubscriptionSearch->PurchasedAfter = null;
$SubscriptionSearch->PurchasedBefore = null;
$SubscriptionSearch->ExpireAfter = null;
$SubscriptionSearch->ExpireBefore = null;
$SubscriptionSearch->LifetimeSubscription = null;
$SubscriptionSearch->Type = 'regular'; //'trial', 'regular', 'regularfromtrial'
$SubscriptionSearch->TestSubscription = null; // true, false, null = both(default) $SubscriptionSearch->Page = 1;$SubscriptionSearch->Limit = 25;
$SubscriptionSearch->Page = 1;
$SubscriptionSearch->Limit = 10;

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

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

Create a new customer

Overview

Use the createCustomer method to add the details of a customer entity into the 2Checkout system. By default, customer status is Inactive until you assign a specific subscription to the customer. Following that action, customer status reflects the status of the attached subscription(s).

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.

Customer

Object

Response

2CheckoutCustomerReference

Int

 

System-generated customer reference.

Request


<?php
$host   = "https://api.2checkout.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
    'location' => $host . "/soap/4.0/",
    "stream_context" => stream_context_create(array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false
        )
    ))
));

function hmac($key, $data)
{
    $b = 64; // byte length for md5
    if (strlen($key) > $b) {
        $key = pack("H*", md5($key));
    }
    
    $key    = str_pad($key, $b, chr(0x00));
    $ipad   = str_pad('', $b, chr(0x36));
    $opad   = str_pad('', $b, chr(0x5c));
    $k_ipad = $key ^ $ipad;
    $k_opad = $key ^ $opad;
    return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
$now          = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash   = hmac($key, $string);
try {
    $sessionID = $client->login($merchantCode, $now, $hash);
}
catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage();
    exit;
}
$newCustomer = new stdClass();
$newCustomer->2checkoutCustomerReference = null;
$newCustomer->ExternalCustomerReference = 'ThisIsATestReference123456';
$newCustomer->FirstName = 'NewCustomer';
$newCustomer->LastName = 'NewCustomerLastName';
$newCustomer->Company = null;
$newCustomer->FiscalCode = null;
$newCustomer->Address1 = 'Address';
$newCustomer->Address2 = null;
$newCustomer->City = 'LA';
$newCustomer->Zip = '90210';
$newCustomer->CountryCode = 'us';
$newCustomer->Phone = null;
$newCustomer->Fax = null;
$newCustomer->Email = 'newcustomer@email.com';
$newCustomer->ExistingCards = null;
$newCustomer->Enabled = null;
$newCustomer->Trial = null;
$newCustomer->Language = 'en';
try {
    $newCustomerInfo = $client->createCustomer($sessionID, $newCustomer);
}
catch (SoapFault $e) {
    echo "newCustomerInfo: " . $e->getMessage();
    exit;
}
var_dump("newCustomerInfo", $newCustomerInfo);

Add promotion sources

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
$sources = ['source1', 'source2']; // array of sources to add to the promotion

$response = Client::addPromotionSources($promotionCode,$sources); // Set the promotion discount to the existing promotion
var_dump($response);

Search proposals

Overview

Use the searchProposals method via SOAP APIv6 to find a specific proposal or quote.

Request parameters

Request parameters for the searchProposals method via SOAP APIv6
Parameters Type Required/Optional Description
sessionId String Required Unique 2Checkout session ID code.
Name String Optional Proposal name.
Email String Optional The bill to or sell to email.
CreatedBy String Optional The unique external system user identifier.
ModifiedBy String Optional The unique external system user identifier.
Source String Optional The source from where the proposal was created.
CreatedAfter String Optional The UTC date and time in ISO 8601 format.
CreatedBefore String Optional The UTC date and time in ISO 8601 format.
ModifiedAfter String Optional The UTC date and time in ISO 8601 format.
ModifiedBefore String Optional The UTC date and time in ISO 8601 format.
Locked Boolean Optional

Retrieve proposals that are locked or not.

Possible values:

  • True
  • False
Offset Integer Required The offset at which the proposals should be returned. Default value: 0.
Limit Integer Required The maximum number of proposals to return. Default value: 10.
LinkId String Optional The link id for any status.

Request sample

<?php

require ('PATH_TO_AUTH');

$searchParameters = new stdClass();
$searchParameters->Name = "My Proposal Name";
$searchParameters->Email = "example@email.com";
$searchParameters->CreatedBy = "createUser";
$searchParameters->ModifiedBy = "modifyUser";
$searchParameters->Source = "MERCHANT_API";
$searchParameters->CreatedAfter = "2020-01-01T00:00:00+00:00";
$searchParameters->CreatedBefore = "2020-12-31T23:59:59+00:00";
$searchParameters->ModifiedAfter = "2020-01-01T00:00:00+00:00";
$searchParameters->ModifiedBefore = "2020-12-31T23:59:59+00:00";
$searchParameters->Locked = false;
$searchParameters->Offset = 0;
$searchParameters->Limit = 10;

try {
    $results = $soapClient->searchProposals($sessionID, $searchParameters);
    echo "Search results: </br>", 
    var_dump($results);
}
catch (SoapFault $e) {
    echo "Could not search proposals: " . $e->getMessage();
    exit;
}

Response

The searchProposals call via SOAP APIv6 returns a list of proposal objects.

 

ConvertPlus Default Layout Update

Overview

We are continuously working on enhancing our products and services to help you convert every purchase into a satisfied customer and maximize your revenue no matter where you are selling. That is why we have made minor changes with a significant impact on your conversion rates to the Convert Plus shopping cart.

Based on the latest A/B test results aimed at boosting the in-cart conversion rates, we’ve updated the existing ConvertPlus default template and performed the following changes:

  • Adjusted fonts, colors, buttons, and form fields
  • Added coupons & display promotion in the shopping cart
  • Displayed the product short description in the shopping cart
  • Updated the billing flow & payment method selection

 

Recommended resources

Availability

Changes apply to the following cart templates:

  • ConvertPlus - default template
  • Custom ConvertPlus templates (based on the ConvertPlus default template), customized via the Merchant Control Panel cart editor or via 2Checkout Professional Services

Some of the UI changes also apply to the ConvertPlus templates ("One column with payment buttons", "2Checkout Marketplace Shopping Cart"), and InLine cart templates in order to offer you a consistent checkout flow.

Workflow

All templates from all categories listed above are updated automatically with no input from your side. Also, all existing simple and advanced customizations are applied to the updated templates (if any).

ConvertPlus Layout Updates

Overall look & feel: adjustments of fonts, colors, buttons, form fields

By displaying your customers’ favorite payment methods, you reassure them that they can proceed with the purchase:

  • We’ve refreshed the overall look and feel of the shopping cart and made it highlight the most important fields in a clean and simple way, for improved customer experience.
  • We’ve updated the payment method field by adding badges of the most popular credit card networks, depending on the area in which your customer is located.

convertplus_layout_update_1_new.png

Product short description and promotion field

The products' short descriptions and the promotion field are clearly displayed in the updated template to improve the checkout flow experience of your shoppers. 

  • We’ve added product description in the summary section
  • We’ve optimized the display of the coupon code link and made it less intrusive 

convertplus_layout_update_2.png

Billing and payment information section

The billing section is one of the most important in the checkout flow. Your customers need to feel safe when adding their personal information.

  • We’ve updated the billing information section, made the security code pop-up tooltip more comprehensive, and added simplified, easy to understand graphics.

convertplus_layout_update_3.png

Payment Confirmation Page

Every transaction is seamless and secure, so your customers can have a smooth transition to the final step of the purchase funnel, the “Payment Confirmation Page”. 

  • We’ve updated the elements on the payment confirmation page, so customers can be reassured that their payment was processed securely and successfully.

convertplus_layout_update_4.png

Sell Smart with Convert Plus

With a seamless look and feel, Convert Plus is 2Checkout’s most optimized ordering engine. Built by using the most advanced technologies, our ordering engine is maximizing customer input during the payment process and increases your cart's conversion rates, no matter what market you are targeting.

Feel free to reach us at supportplus@2checkout.com for any question related to the Convert Plus update.

IPN parameters

Overview

Depending on your IPN settings, notifications contain all or a subset of the available parameters.

2Checkout sends IPN parameters exemplified in this article.

   2Checkout continues to add new IPN parameters on an ongoing basis. To include additional information in the notifications, enable the new parameters in the IPN settings page, in your Merchant Control Panel.
   Some parameters might behave differently depending on the payment method. For example, parameter MESSAGE_TYPE behaves differently on the SEPA Direct debit the flow, therefore the values for the parameters received are different than those in the table below.
Parameter values for the Credit card flow: "ORDERSTATUS": "PAYMENT_RECEIVED" / "MESSAGE_TYPE": "APPROVED".
Parameter values for the SEPA Direct debit flow: "ORDERSTATUS": "PAYMENT_RECEIVED" / "MESSAGE_TYPE": "PROCESSING".

 IPN Parameters

Parameter Description Type/Length
GIFT_ORDER

Allows shoppers to gift the subscription/product acquired to the recipient specified using the delivery details during the purchase process. Possible values:

  • 0 – Not a gift order.
  • 1 – Gift order. The subscription/product is a gift.
Integer/1
SALEDATE Y-m-d H:i:s. The datetime stamp when shoppers place orders (e.g.: 2008-06-22 19:33:28) (e.g.: 2013-12-01 01:00:24) String/19
PAYMENTDATE Y-m-d H:i:s. The datetime stamp when payment processors authorize a transaction for an order 2Checkout approved (e.g.: 2008-06-22 14:30:24) (e.g.: 2013-12-01 01:00:24) String/19
COMPLETE_DATE Y-m-d H:i:s. The datetime stamp when orders reach Complete status (2Checkout received payments and marked the order as fulfilled, if necessary). (e.g.: 2008-06-22 14:41:30) (e.g.: 2013-12-01 01:00:24) String/19
REFNO Unique, system-generated 2Checkout order reference. Integer/9
REFNOEXT The order reference code (max. 100 chars) you control. You can attach an external reference number to orders during the purchase process. String/100
SHOPPER_REFERENCE_NUMBER The internal reference number your customers assign to orders during the checkout process. Customers using Purchase Orders (POs) as the payment method during the ordering process have the option of setting identifiers for their orders to track and manage purchases in their own system. String/255
ORIGINAL_REFNOEXT

Available for subscription renewals.

Array of REFNOEXT (the external order reference - max. 100 chars) values set for the initial orders when the subscriptions were first acquired.

String/100
ORDERNO Order counter (numeric, incremental). Visible in your account in the Order search area. Integer
ORDERSTATUS

Current order status. Possible values are:

• PENDING - Order placed, waiting bank authorization.

• PAYMENT_AUTHORIZED – The bank authorized the payment.

• SUSPECT – 2Checkout is reviewing the order having flagged it as a potential fraud attempt. Note: Not available by default. Contact 2Checkout directly to start receiving this order status.

• INVALID – Invalid Billing/Delivery information.

• COMPLETE – 2Checkout marked the order as complete.

• REFUND – 2Checkout refunded the money paid back to the shopper. 2Checkout can only refund complete orders.

• REVERSED – 2Checkout reversed a transaction and released the money back to the customer. 2Checkout can only reverse authorized orders that never reach the complete status.

• PURCHASE_PENDING – Sent for orders placed using Purchase Orders after you approve the PO. 2Checkout is waiting for the customer to make the payment.

• PAYMENT_RECEIVED – 2Checkout sends this notification when it received payment for orders with offline payment methods such as bank/wire transfer.

• CANCELED - The 2Checkout system sends out notifications when:

  • 2Checkout representatives cancel eStore orders (only for orders that are not authorized/paid, otherwise a reverse or refund action is required).
  • Partner (Channel Manager) orders you cancel yourself.

• PENDING_APPROVAL - 2Checkout has yet to approve this order.

String/22
PAYMETHOD Order payment method. String/255
PAYMETHOD_CODE

Payment method code.

Possible values:

CCVISAMC Visa/MasterCard/Eurocard
WIRE Wire transfer
CCAMEX American Express
CCDINERS Diners Club
CCJCB JCB
CC_APPLE_PAY Apple Pay
PAYPAL PayPal
VENDOR2VENDOR Vendor to vendor
PURCHASE_ORDER Purchase order
DISCOVER Discover/Novus
CHECK Check
DIRECT_EBANKING DIRECTebanking.com
CARTE_BLEUE Carte Bleue
FREE Payment not required
ALIPAY 支付宝 (Alipay)
DIRECT_DEBIT Direct Debit
GIROPAY Giropay
IDEAL iDEAL
WEBMONEY Webmoney
PAYNEARME Cash at 7-Eleven/Family Dollar/ACE
WIRE_ARMS_RS Bank/Wire transfer - Channel Manager
CCVISAMC_ARMS_RS Visa/MasterCard/Eurocard - Channel Manager
CCAMEX_ARMS_RS American Express - Channel Manager
PAYPAL_ARMS_RS PayPal - Channel Manager
CHECK_ARMS_RS Check - Channel Manager
BOLETO Boleto/Pix
DANKORT Dankort
ACH ACH
CC_INSTALLMENTS Installments
DIRECT_DEBIT_UK Direct Debit UK
UNIONPAY UnionPay
TRIALPAY TrialPay Checkout
CCELO Elo Card
CCHIPERCARD Hipercard
OPPOHJOLA OP-Pohjola
NORDEA Nordea
DANSKE Danske
TRUSTLY Trustly
WE_CHAT_PAY WeChat Pay
TRUSTPAY Trustpay
SKRILL_WALLET Skrill Wallet
NETELLER Neteller
String/250
CARD_TYPE

Shopper card type. When shoppers use multiple cards, 2Checkout includes the type of the last card used in the IPN - e.g. "Visa".

Empty for non-card transactions.

String/255
CARD_LAST_DIGITS

The last 4 digits of the shopper credit/debit card. When shoppers use multiple cards, 2Checkout includes the last four digits of the last card used in the IPN - e.g. "Visa".

 Empty for non-card transactions.

String/4
CARD_EXPIRATION_DATE MM/YY. Card expiration month and the year. String/5
FX_RATE Value of the exchange rate locked when the order reaches the Complete status. Includes the 2Checkout markup. Float Number/100
FX_MARKUP 2Checkout exchange rate markup.  Float Number/100
PAYABLE_AMOUNT Net profit in payout currency. Float Number/100
PAYOUT_CURRENCY Your account's default payout currency. String/3
SHIPPING_TRACKING_NO The tracking number requested as optional information when the order was marked as shipped. String
SHIPPING_COMMENTS Additional information requested as optional when the order was marked as shipped. String
SHIPPING_TRACKING_URL The Tracking URL defined when creating a shipping method. String
SHIPPING_METHOD_NAME Name of the shipping method used during the order. String
SHIPPING_STATUS

Order shipment status. Possible values:

  • TRUE - for shipped orders
  • FALSE - for orders that are not shipped
String
CHARGEBACK_RESOLUTION

Chargeback status information. Possible values:

· OPEN (chargeback is in progress)

· WON (chargeback won by you)

· LOST (chargeback won by the customer)

· ACCEPTED (you agreed to repay the value of the order to the customer)

· NONE (no chargeback initiated for the order)

To manage chargeback notifications navigate to Control Panel Dashboard →Integrations → Webhooks and API, and click on the IPN settings tab.

In the General IPN Settings section, under Triggers, make sure to check the boxes next to the following options:

· chargeback open (2Checkout sends an IPN when shoppers open a chargeback dispute).

· chargeback closed - (2Checkout sends an IPN when the parties involved resolve a chargeback dispute).

Also, check the checkbox next to the CHARGEBACK_RESOLUTION parameter featured in the Response tags area.

String/8
CHARGEBACK_REASON_CODE

Identifier for the chargeback dispute reason from the 2Checkout system. Empty for orders with no chargeback dispute initiated.

Possible values:

  • MERCHANDISE_NOT_RECEIVED - Order not fulfilled/not delivered
  • NOT_AS_DESCRIBED - Product(s) not as described/not functional
  • DUPLICATE_TRANSACTION - Duplicate order
  • FRAUD / NOT_RECOGNIZED - Fraud/Order not recognized
  • CREDIT_NOT_PROCESSED - Agreed refund not processed
  • NOT_RECOGNIZED - New/renewal order not recognized
  • AUTHORIZATION_PROBLEM - Authorization problem
  • INFO_REQUEST - Information request
  • UNKNOWN - Unknown
  • CANCELED_RECURRING - Recurring payment was canceled
String/24
TEST_ORDER

Possible values:

• 1 - for test orders

• 0 - for real orders

Integer/1
GATEWAY_RESPONSE Forwards the payment gateway response received as a part of the card authorization process. Contact 2Checkout directly if the GATEWAY_RESPONSE parameter is not available in the list under the Notification Details area on the IPN settings page. Log into your Control Panel account and access this link to download a list of all gateway responses. String/255
IPN_ORDER_ORIGIN

Source of the order placed. Possible values:

  • Automatic Billing 
  • WEB 
  • Mobile
  • API
String/17
REFUND_REASON

Refund reason.

Possible value can be one of the refund reasons defined in the platform:

  • Chargeback
  • Duplicate order
  • Not satisfied with the product
  • Product not received
  • Unwanted auto-renewal
  • Technical issue with the product
  • Other
  • No reason

If you have set your own refund reasons, the value corresponds to the reasons selected in the refund process from your customized reasons.

Click here to learn how to customize your refund reasons.

String
FRAUD_STATUS

Possible values:

  • APPROVED for orders with a low fraud risk that passed the fraud screening.
  • DENIED for orders with high score risk that were automatically rejected by the fraud engine.
  • UNDER REVIEW for orders with a high fraud risk that require manual review and approval before the charge can be collected.
  • PENDING for orders that are yet to enter the fraud screening.
String/12
MESSAGE_ID The number generated incrementally for each sequence of message type sent to a seller. Integer
MESSAGE_TYPE

The name of the event triggering the notification.

 

MESSAGE_TYPE possible values Trigger name (according to Merchant Control Panel)
PENDING Pending orders.
PROCESSING Orders waiting to be processed by 2Checkout system.
APPROVED Authorized and approved orders (sent before electronic delivery).
AUTH Authorized and approved orders (sent after electronic delivery).
APPROVED_DELIVERY Order approved for delivery.
COMPLETE Completed orders.
ORDER_UNDER_REVIEW Orders under 2Checkout review.
SHOPPER_INVOICE Invoice generated.
SUSPECT Fraud suspect.
CANCELED Canceled orders.
CHARGEBACK_OPEN Chargeback open.
CHARGEBACK_CLOSED Chargeback closed.
REFUND Reversed and refund orders.
PURCHASE_PENDING Approved
PURCHASE_REJECTED_BY_VENDOR Rejected
PURCHASE_COMPLETE Completed
PURCHASE_EXPIRED_NOT_PAID Expired, not paid
PURCHASE_CANCELED_TIMEOUT Canceled
PENDING_APPROVAL_ORDER_FOR_PARTNER Pending approval orders from partners.
VENDOR_APPROVED Approved orders from partners.
DELIVERED_ORDER_FOR_PARTNER Delivered orders from partners.

 

String
VENDOR_CODE Unique merchant identifier generated by the 2Checkout system. String
PROPOSAL_ID The unique identifier of the proposal generating the order. Can be found in Order additional information as text.  String

 

 

 

CUSTOMER BILLING INFORMATION Type/Length
FIRSTNAME Customer first name String/40
LASTNAME Customer last name String/40
COMPANY Company Name String/40
REGISTRATIONNUMBER Company registration number String/50
FISCALCODE Company VAT ID / Tax ID String/50
CBANKNAME Company bank name String/40
CBANKACCOUNT Company bank account String/50
ADDRESS1 Address String/100
ADDRESS2 More address information String/100
CITY City String/30
STATE State/County String/30
ZIPCODE Zip code String/30
COUNTRY Country String/50
COUNTRY_CODE Country code String/2
PHONE Phone number String/40
FAX Fax number String/40
CUSTOMEREMAIL Customer email address String/40

 

CUSTOMER DELIVERY INFORMATION Type/Length
FIRSTNAME_D First name String/40
LASTNAME_D Last name String/40
COMPANY_D Company name String/50
ADDRESS1_D Address String/100
ADDRESS2_D Extra address information String/100
CITY_D City String/30
STATE_D State/County String/30
ZIPCODE_D Zip code String/20
COUNTRY_D Country String/50
COUNTRY_D_CODE Country code String/2
PHONE_D Telephone number String/40
EMAIL_D Email address for delivery String/80
IPADDRESS Customer IP address String/250
IPCOUNTRY Country name, based on the user IP address String/50

 

CUSTOM ORDER INFORMATION Type/Length
TIMEZONE_OFFSET The time zone you selected or the default GMT+02:00 time zone of the 2Checkout system. String/9
CURRENCY

Currency used in order.

Possible values:

• USD 
• EUR 
• GBP

Depending on your account settings, other currencies might be available.

String/3
CUSTOM_PRICE 

Array of strings. Allows you to see how the custom price is calculated and is included in the IPN message you receive after an order. It contains the following variables: 

  • Product ID
  • License code   
  • TYPE – Possible values: 
    • GROSS 
    • NET  
    • empty 
  • SOURCE_NAME – Possible values: 
    • the name of the promotion name for SOURCE_TYPE set to PROMOTION 
    • the name of the campaign for SOURCE_TYPE set to CHURN_CAMPAIGN or ENROL_CAMPAIGN 
    • empty for any other value of SOURCE_TYPE 
  • SOURCE_TYPE – Possible values: 
    • GROSS  
    • NET  
    • empty  
    • SYSTEM 
    • CPANEL 
    • API 
    • IMPORT 
    • PROMOTION 
    • CHURN_CAMPAIGN
    • ENROL_CAMPAIGN
    • ASSISTED_SALE 
    • PRICING_CONFIGURATION 
    • DYNAMIC_PRODUCT 
    • n/a 
  • DISCOUNT_VALUE – The amount of the discount 
  • DISCOUNT_TYPE – Possible values: 
    • PERCENT 
    • FIXED 
  • DISCOUNT_CURRENCY –Possible values: 
    • 3 letter currency code of the discount for DISCOUNT_TYPE set to FIXED 
    • empty for any other DISCOUNT_TYPE 

Example :


[CUSTOM_PRICE] => Array

(

[31029265] => Array

(

[H17120HBAY] => Array

(

[AMOUNT] => 80

[TYPE] => NET

[CURRENCY] => USD

[SOURCE_NAME] => custom price regular

[SOURCE_TYPE] => PROMOTION

[DISCOUNT_VALUE] => 20

[DISCOUNT_TYPE] => FIXED

[DISCOUNT_CURRENCY] => USD

)


)


)

 

String/255
LANGUAGE

Payment interface language. Current possible values:

  • ar العربية Arabic
  • bg български език Bulgarian
  • cs Česky Czech
  • da Dansk Danish
  • de Deutsch German
  • el Ελληνικά Greek
  • en English
  • es Español Spanish
  • fa فارسی Persian
  • fi Suomi Finnish
  • fr Français French
  • he Hebrew עִבְרִית
  • hi Hindi
  • hr Hrvatski jezik Croatian
  • hu Magyar Hungarian
  • it Italiano Italian
  • ja 日本語 Japanese
  • ko 한국어 Korean
  • nl Nederlands Dutch
  • no Norsk Norwegian
  • pl Polski Polish
  • pt Português Portuguese
  • pt-br Português do Brasil Brazilian Portuguese
  • ro Română Romanian
  • ru Русский Russian
  • sk Slovenčina Slovak
  • sl Slovène Slovenian
  • sr Serbian
  • sv Svenska Swedish
  • th ไทย Thai
  • tr Türkçe Turkish
  • zh 中文 Chinese Simplified(Cantonese)
  • zy 繁体中文 Chinese Mandarin Traditional

String/2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

String/5

ORDERFLOW

The type of ordering flow used for placing the order. Available values:

• PURCHASE_ORDER (when customers use a Purchase Order).

• REGULAR (default, with the exception of scenarios in which customers use POs).

String/30
IPN_PID[] Array of products identifiers, within current order, from 2Checkout system (unique, system-generated product reference codes). Array of Integers
IPN_PNAME[] Array with products names. Array of Strings
IPN_PCODE[] Array with the reference codes you configure and control for products. (seller reference) Array of Strings/100
IPN_INFO[] Array with extra information for each product within current order. Array of Strings/100
IPN_QTY[] Array with the number of units purchased. Array of Integers/3
IPN_PRICE[] Array with prices for each product (excluding tax), with dot as float separator. Array of Float Numbers
IPN_VAT[] Array with the tax values for each product. Array of Float Numbers
IPN_VAT_RATE[] Array with the tax rate as percentages for each product. Array of Float Numbers/100
IPN_VER[] Array with the version of each product. Array of Strings/50
IPN_DISCOUNT[] Array with discount values within a promotion, including taxes. Array of Float Numbers
IPN_PROMONAME[] Array with names you configured for promotions. Array of Strings/100
IPN_SKU[] Array with product SKU codes. Array of Strings/255
IPN_LICENSE_PROD[] Array with unique, system-generated product references for which 2Checkout generates subscription for a purchase (either new subscriptions or renewals). Array of Integers/11
IPN_LICENSE_TYPE[]

Array with the type of subscription purchased for each product. Possible values:

• REGULAR (new license)
• RENEWAL (renewal for an old license) 
• UPGRADE (an upgrade to an existing license) 
• TRIAL

Array of Strings/7
IPN_LICENSE_REF[] Array with unique, system-generated subscription references. You can use them to build renewal links. Array of Strings/10
IPN_LICENSE_EXP[] Array with subscription expiration dates. Array of Strings/19
IPN_LICENSE_ADDITIONAL_INFO Array with license additional information Array of Strings
IPN_DELIVEREDCODES[] Array with codes delivered to customers when using 2Checkout Delivery. Array of Strings/256
IPN_DOWNLOAD_LINK Download link delivered to customers. String/50
IPN_BUNDLE_DETAILS_1234_PID Array with the unique identifiers of the products included in the bundle, where 1234 represents the 2Checkout product ID. Array of Integers/11
IPN_BUNDLE_DETAILS_1234_PNAME Array with the names of the products included in the bundle, where 1234 represents the 2Checkout product ID. Array of Strings/155
IPN_BUNDLE_DETAILS_1234_PCODE Array with the codes you control of the products included in the bundle, where 1234 represents the 2Checkout product ID. Array of Strings/100
IPN_BUNDLE_DETAILS_1234_QTY Array with the quantity of the products included in the bundle, where 1234 represents the 2Checkout product ID. Array of Integers/3
IPN_BUNDLE_DETAILS_1234_SKU Array with the SKUs of the products included in the bundle, where 1234 represents the 2Checkout product ID. Array of Strings/255
IPN_BUNDLE_DETAILS_1234_PGROUP Array with the group IDs of the products included in the bundle, where 1234 represents the 2Checkout product ID. Array of Integers/11
IPN_BUNDLE_DETAILS_1234_PGROUP_NAME Array with the names of the products included in the bundle, where 1234 represents the 2Checkout product ID. Array of Strings/100
IPN_BUNDLE_DELIVEREDCODES_1234[] Array with delivery information for each product included in the bundle. Array of Strings/30
IPN_ORDER_COSTS[] Array with DIS and Backup Media costs per each product in the order (in the order currency). Array of Float Numbers
IPN_PCOMMISSION[] Affiliate product commission, using dot (.) as float separator. Array of Float Numbers
IPN_TOTAL[] Partially total on order line (including taxes), using dot (.) as float separator. Array of Float Numbers
IPN_TOTALGENERAL Total transacted sum, including shipping and VAT, using dot (.) as float separator, expressed in the same currency as the CURRENCY field. Float Number
IPN_PROMO_IDCODE[] Promotion code automatically generated by adding a new promotion. Array of Float Number
IPN_PARTNER_MARGIN_PRODUCTS_PERCENT[] Percentage configured as margin for partners. Array of Float Number
IPN_SHIPPING Shipping costs, expressed in the same currency as the CURRENCY field, using dot (.) as float separator. Float Number
IPN_GLOBALDISCOUNT Global order discount. It is an optional field that is sent only for values greater than 0. Float Number
IPN_COMMISSION 2Checkout commission, using dot (.) as float separator. Float Number
IPN_CUSTOM_TEXT[] Array with all the custom fields texts set per order. For example: "Do you agree with the return policy?". Array of Strings
IPN_CUSTOM_VALUE[] Array with all client input corresponding for the text. For example: "Yes". Array of Strings
IPN_CUSTOM_1234_TEXT[] Array with all the custom fields texts set per product, where1234 represents the product ID. Array of Strings
IPN_CUSTOM_1234_VALUE[] Array with all client input corresponding for the text, where 1234 represents the product ID. Array of Strings
IPN_PRODUCT_OPTIONS_1234_TEXT[]

Array with the names of all the price options, where 1234 represents the 2Checkout product ID.

For usage scale pricing option groups, 2Checkout returns the name of the pricing options as well as the number of units of metered resources consumed by the customer. Format: 'PricingOptionsGroupName: NumberOfUnitsConsumed', for example 'GBs: 100'.

Array of Strings/250
IPN_PRODUCT_OPTIONS_1234_VALUE[]

Array with unique codes set up for the pricing option groups, where1234 represents the product ID.

In the case of usage scale pricing options groups, 2Checkout return both the unique code of the group as well as the number of units of metered resources consumed by the customer. Format: 'UniqueCode: NumberOfUnitsConsumed', for example 'meteredGBs: 100'.

Array of Strings/250
IPN_PRODUCT_OPTIONS_1234_OPTIONAL_VALUE[]

Array with optional codes (unique for pricing option group), where 1234 represents the product ID.

In the case of usage scale pricing options groups, 2Checkout returns both the unique code of the group as well as the number of units of metered resources consumed by the customer. Format: 'UniqueCode: NumberOfUnitsConsumed', for example 'meteredGBs: 100'.

Array of Strings/250
IPN_PRODUCT_OPTIONS_1234_PRICE[]

Array with all prices corresponding to each option (prices are in the order currency), where 1234 represents the product ID.

In the case of usage scale pricing options groups, it will return the price of the metered resources consumed by the customer in the order currency.

Array of Float Numbers
IPN_PRODUCT_OPTIONS_1234_OPERATOR[]

Array with all price operators corresponding to each price option, where 1234 represents the product ID 
Possible values:

• ADD 
• SUBSTRACT

Array of Strings/9
IPN_PRODUCT_OPTIONS_1234_USAGE[]

Designed to differentiate usage pricing options groups from non-usage pricing options groups.

Possible values:

• PREPAID - for orders involving products with pricing options groups of the following type: Radio, Dropdown, Checkbox and Scale (but without a metered cost component (usage scale pricing)). 
• POSTPAID - for orders involving products with a metered cost component (usage scale pricing).

String/8
IPN_REFERRER The last URL accessed by the shopper before landing in the 2Checkout cart. String/255
IPN_LINK_SOURCE The link source for the sales. The SRC parameter used to track every sale point generator. String/255
IPN_RESELLER_ID Affiliate ID that referred the sale. Integer/9
IPN_RESELLER_NAME Affiliate name String/50
IPN_RESELLER_URL Affiliate website String/100
IPN_RESELLER_COMMISSION Affiliate total commission, using dot(.) as float separator. Float Number
IPN_LICENSE_LIFETIME[]

Array indicating the products shoppers purchased opting for the lifetime/evergreen option.

Possible values:

• YES = lifetime subscription
• NO

Array of Strings/3
IPN_PARTNER_CODE

Possible values:

  • Empty = ecommerce order
  • Partner code
String/255
2CHECKOUT_CUSTOMER_REFERENCE Default customer numerical (integer) IDs generated automatically by the 2Checkout system. Read more here. Integer/11
EXTERNAL_CUSTOMER_REFERENCE Unique customer alphanumeric (string) identifiers that you control. Read more here. String/255
REFUND_TYPE

This parameter, sent along with the notifications provided for orders placed in the 2Checkout system, offers additional info for refunds processed. REFUND_TYPE describes the type of the refund, total or partial. As such, the parameter can have two possible values:

  • TOTAL – 2Checkout paid back the entire sum paid for the initial order.
  • PARTIAL – 2Checkout paid back only a percentage of the amount paid for the initial order.

REFUND_TYPE is empty for orders that are not refunds.

String/7
IPN_PARTNER_MARGIN_PERCENT Percentage configured as margin for partners. Float Number
IPN_PARTNER_MARGIN Value deducted from the cost of orders, corresponding to the margin configured for partners. Float Number
IPN_EXTRA_MARGIN Value deducted from the cost of the order corresponding to the extra margin offered to a partner for the purchase. Float Number
IPN_EXTRA_DISCOUNT The value deducted from the cost of the order, corresponding to the extra discount offered to the partner for the purchase. Float Number
IPN_COUPON_DISCOUNT The value of the discount deducted from the cost of the order, corresponding to the promotion coupon used by the partner for the purchase. Float Number
IPN_EXTERNAL_REFERENCE Array with seller reference code for order products (seller reference). Array of Strings
IPN_PROMOCODE Promotion codes for the above IPN_DISCOUNT. Array of Float Numbers
IPN_PGROUP Product group ID. Array of Strings
IPN_PGROUP_NAME Product group name. Array of Strings
IPN_LICENSE_START Array with product subscription start dates. Date/14
IPN_SHIPPING_TAX Shipping tax expressed in the same currency as the CURRENCY field. Number
TAX_OFFICE Tax office code (IPN_CODE_TAX_OFFICE) String
IPN_PROMOTION_CATEGORY[]

Array with the category of the promotions you configured and are included in the order.

Possible values:

  • CROSS_SELLING
  • UPSELL
  • PROMOTION
Array of Strings
VALIDATION INFORMATION  
IPN_DATE IPN notification date in the YmdHis format. (ex: 20081117145935) (ex: 20131201010024) Date/14
HASH

Calculated HMAC_MD5 signature based on the sent IPN fields and the secret key.

(Note: This parameter won't be used anymore for IPN validation as of 15th of August, 2024.)

String/32
SIGNATURE_SHA2_256 Calculated HMAC_SHA2_256 signature based on the sent IPN fields and the secret key. String/64
SIGNATURE_SHA3_256 Calculated HMAC_SHA3_256 signature based on the sent IPN fields and the secret key. String/64
IPN_PURCHASE_ORDER_INFO   Order status and details for Purchase order acquisitions. String
IPN_ORIGINAL_LINK_SOURCE[] Array of IPN_LINK_SOURCE (link source, the SRC parameter) values for the initial orders when the subscriptions were first acquired. Available for subscription renewals. String
CUSTOM_FIELDS Additional order fields (dynamic variables). In your Merchant Control Panel, navigate to Setup - Ordering options - Additional order fields. String

InLine Checkout ordering engine

Overview

InLine Checkout acts as an iframe that opens on your website, enabling you to receive payments without redirecting your customers to a third party checkout.

Integrate InLine Checkout and:

  • Offer your customers the possibility of purchasing using mobile devices with a responsive cart design, which renders well on a variety of devices and screen sizes.
  • Improve your localization strategy, with a cart translated into 29 languages, and +130 transactional currencies for displaying the price.
  • Minimize the customer effort during the purchase by passing the collected billing/shipping information to InLine Checkout.

InLine Checkout integrates ideally with shopping cart applications that collect customer billing and shipping information, allowing you to pass that information over to the cart and minimize customer's efforts during the payment process.

 

However, you can easily switch to a Multi-Step InLine Checkout flow if some of your customers would rather stick to a step-by-step payment process and fill-in their order details on separate cart pages.

inline checkout.jpg

Availability

InLine Checkout is available for accounts that have ConvertPlus enabled on their account. Contact 2Checkout for activation.

Features

We are continuously working on improving the InLine Checkout experience. Read here the full list of features supported by the InLine Checkout.

Dynamic product information

InLine Checkout enables you to receive payments without having products defined in your 2Checkout Control Panel. Send the product information dynamically to InLine Checkout, and receive payments without the need for a product catalog in 2Checkout.

How to integrate InLine Checkout

To integrate InLine Checkout with your shopping cart, follow the steps below.

1. Generate and insert the JavaScript code in your eCommerce website by following these steps:

  • Go to Setup Generate links area
  • Click the InLine Checkout tab.
  • Copy the JavaScript code snippet generated by our platform (see the code sample below) and paste it into your eCommerce website (you can paste it either inside the <head> tag or inside the page body right before the closing </body> tag of your HTML page)

You can choose one of the scripts below according to your preferred cart-flow length:

One-Step InLine:

<script> 

    (function (document, src, libName, config) { 

        var script             = document.createElement('script'); 

        script.src             = src; 

        script.async           = true; 

        var firstScriptElement = document.getElementsByTagName('script')[0]; 

        script.onload          = function () { 

            for (var namespace in config) { 

                if (config.hasOwnProperty(namespace)) { 

                    window[libName].setup.setConfig(namespace, config[namespace]); 

                } 

            } 

            window[libName].register(); 

        }; 


        firstScriptElement.parentNode.insertBefore(script, firstScriptElement); 

    })(document, 'https://secure.2checkout.com/checkout/client/twoCoInlineCart.js', 'TwoCoInlineCart',{"app":{"merchant":"XXXXXX","iframeLoad":"checkout"},"cart":{"host":"https:\/\/secure.2checkout.com","customization":"inline-one-step"}}); 

</script> 

Multi-Step InLine:

<script> 

    (function (document, src, libName, config) { 

        var script             = document.createElement('script'); 

        script.src             = src; 

        script.async           = true; 

        var firstScriptElement = document.getElementsByTagName('script')[0]; 

        script.onload          = function () { 

            for (var namespace in config) { 

                if (config.hasOwnProperty(namespace)) { 

                    window[libName].setup.setConfig(namespace, config[namespace]); 

                } 

            } 

            window[libName].register(); 

        }; 

        firstScriptElement.parentNode.insertBefore(script, firstScriptElement); 

    })(document, 'https://secure.2checkout.com/checkout/client/twoCoInlineCart.js', 'TwoCoInlineCart',{"app":{"merchant":"XXXXXX","iframeLoad":"checkout"},"cart":{"host":"https:\/\/secure.2checkout.com","customization":"inline"}}); 

</script> 

Your merchant code (you can find it in your merchant Control Panel, Dashboard → Integrations → Webhooks and API → API section) is automatically added by the system when you generate the JavaScript code library shown above, in the XXXXXXX string.

After you integrate the InLine Checkout JavaScript code in your HTML page, you get access to the library that allows you to add products, control billing and shipping details, and start the checkout process (see the JavaScript API reference here).

2. Add a buy button on your website.

  • Navigate to the merchant Control Panel → Setup → Generate links
  • Click on the InLine Checkout tab
  • Select a product from the drop-down list in the 'Select one or more products' section 
  • Provide the desired quantity in the “Quantity settings” section 
  • Click on the Generate code button at the bottom of the page 
  • Copy the link and paste it into your HTML page

3. Start the Checkout process. Starting the checkout process will display the payment overlay and the inline cart on your website.

Sample request

The below request represents a basic use of InLine Checkout, that allows your users to finalize purchases directly from your website via a secure payment form.

TwoCoInlineCart.setup.setMerchant('merchantCode'); // your Merchant code

TwoCoInlineCart.products.add({
    code: 'the-2co-product-code',
    quantity: 3
}); // add products to cart

TwoCoInlineCart.cart.checkout(); // start checkout process

Set return method in InLine Cart

Overview

Use the Cart object in order to set the return method of the InLine cart by calling theTwoCoInlineCart.cart.setReturnMethod({url, type})method.

Use case

  1. Add an HTML link or button on your page like the one below.
  2. Create a JavaScript click handler to execute the Inline Client desired methods.
  3. Use theTwoCoInlineCart.products.add( {code, quantity, options})method to prepare your catalog product.
  4. In order to set currency use TwoCoInlineCart.cart.setCurrency(currency-code).
  5. In order to define the return method callTwoCoInlineCart.cart.setReturnMethod({url, type}).
  6. You can see below a signature token request payload for this example. A success response contains a JSON with the property “signature“ which needs to be used at the next step to set the signature using the TwoCoInlineCart method.
{
    "merchant": "AVLRNG",
    "currency": "USD",
    "products": [
        {
            "code": "74B8E17CC0"
        }
    ],
    "return-method": {
        "type": "redirect",
        "url": "http://my-test-site.com/return-url"
    }
}

The above payload will generate the signature c05c712e7c14a23a425b799d39c7304bcc1715c6e903513da57f47fc164b93f9.

7. Use the TwoCoInlineCart.cart.setSignature('c05c712e7c14a23a425b799d39c7304bcc1715c6e903513da57f47fc164b93f9') method to set the signature.

8. Use theTwoCoInlineCart.cart.checkout()method to show the cart on your page.

Sample request

HTML

<a href="#" class="btn btn-success" id="buy-button">Buy now!</a>

Javascript

window.document.getElementById('buy-button').addEventListener('click', function() {
  TwoCoInlineCart.cart.setCurrency('USD');
  TwoCoInlineCart.products.add({
    code: "74B8E17CC0"
  });
  TwoCoInlineCart.cart.setReturnMethod({
    type: 'redirect',
    url : 'http://my-test-site.com/return-url'
  });
  TwoCoInlineCart.cart.setSignature('c05c712e7c14a23a425b799d39c7304bcc1715c6e903513da57f47fc164b93f9');
  TwoCoInlineCart.cart.checkout();
});

Demo

After setting the return method in the InLine cart using the above method, your cart should look like this:

 

Retrieve a promotion

Overview

Use the getPromotion method to extract information on a promotion you set up for your account.

Parameters

Parameters Type/Description

sessionID

Required (string)

 

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

PromotionCode

Required (string)

 

System-generated identifier Avangate associated with promotion campaigns.

Response

Promotion

Object

Request

<?php

$host   = "https://api.avangate.com";
$client = new SoapClient($host . "/soap/4.0/?wsdl", array(
    'location' => $host . "/soap/4.0/",
    "stream_context" => stream_context_create(array(
        'ssl' => array(
            'verify_peer' => false,
            'verify_peer_name' => false
        )
    ))
));


function hmac($key, $data)
{
    $b = 64; // byte length for md5
    if (strlen($key) > $b) {
        $key = pack("H*", md5($key));
    }
    
    $key    = str_pad($key, $b, chr(0x00));
    $ipad   = str_pad('', $b, chr(0x36));
    $opad   = str_pad('', $b, chr(0x5c));
    $k_ipad = $key ^ $ipad;
    $k_opad = $key ^ $opad;
    return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}

$merchantCode = "YOURCODE123"; //your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key          = "SECRET_KEY"; //your account's secret key available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$now          = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')

$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash   = hmac($key, $string);

try {
    $sessionID = $client->login($merchantCode, $now, $hash);
}

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

$PromotionCode = '123456789c'; //case sensitive
 
try {
    $Discount = $client->getPromotion($sessionID, $PromotionCode);
} 
catch (SoapFault $e) {
    echo "Discount: " . $e->getMessage();
    exit;
}
 
var_dump("Discount", $Discount);

?>

Subscription renewal notifications

Overview

Use the setRenewalNotificationStatus method to subscribe or unsubscribe shoppers from subscription renewal notifications.

Parameters

Parameters Type/Description

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.

status

Required (boolean)

 

true – enable subscription renewal notifications.

false – disable subscription renewal notifications.

Response

Parameters Type/Description

Boolean

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

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$status = false;

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

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

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