Skip to main content

Expose merchant information for 2CO shopping cart

Overview

Disclaimer: the following method is intended for internal purposes only.

Use the getMerchantInforamtion method for retrieving vendor information required by the 2CO shopping cart into a single call.

This API method is protected through a special authentication header that the 2CO cart should sent. Click here to learn more about the X - header authentication.

Requirements

Authenticate using the special authentication header.

Response

Info Description
Company name Merchant company name.
Commercial name Merchant commercial name.
Demo flag Y if the vendor status is Pending, else P if the vendor has the "test orders" package active, otherwise N.
Forced currency code 3-letter code.
Shopping cart customization Shows possible cart customizations.
Payment methods Merchant available payment options.
Override line item limit -
Order auth time Minutes into days (how long it takes for the order to become complete).
3DS status true if vendor has Use3DSecure = NO, false otherwise.
Currencies Merchant available currencies.
Countries Merchant available ordering countries.
Languages Merchant available ordering languages.
Promotions

Promotions defined on merchant account.

Secret key Merchant account secret key.
Shipping methods Shipping methods defined on merchant account.

Request

<?php

function callRPC($Request, $hostUrl, $Debug = false) {
    $curl = curl_init($hostUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HTTPPROXYTUNNEL, false);
    curl_setopt($curl, CURLOPT_PROXY, '');
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Accept: application/json',
        'X-Avangate-Authentication: type="private" ver="2" app="2co-shopping-cart" merchant="RDGM" date="2018-01-31T13:57:44+00:00" hash="0m3ULy6dZ2xUI8CFtU0ersCootdf6wz8Z1qxN28FdXI="'
    ));

    curl_setopt($curl, CURLOPT_COOKIE, '');
    $RequestString = json_encode($Request);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);

    if ($Debug) {
        var_dump($RequestString);
    }
    $ResponseString = curl_exec($curl);
    if ($Debug) {
        var_dump($ResponseString);
    }

    if (!empty($ResponseString)) {
        $Response = json_decode($ResponseString);
        if (isset($Response->result)) {
            return $Response->result;
        }
        if (!is_null($Response->error)) {
            var_dump($Request->method, $Response->error);
        }
    } else {
        return null;
    }

    return null;
}

$host = 'http://api.avangate.com/soap/5.0';


try {
    $merchantInformation= $client->getMerchantInformation($sessionID);
}
catch (SoapFault $e) {
    echo "MerchantInformation: " . $e->getMessage();
    exit;
}

var_dump("merchantInformation", $merchantInformation);


 

Express Payments Checkout

Overview

Use the Express Payments Checkout flow to minimize billing data entry for your shoppers, depending on the selected payment method, enabling you to further streamline the available single page checkout flows. This flow is particularly optimized to facilitate high volumes of payments via PayPal. 

2Checkout recommends that you test the compatibility of existing shopping cart templates with the 'Express payments checkout' flow to ensure smooth purchase experiences for customers.

Availability

The Express Payments Checkout is available for all account types on both business models (PSP & MoR). 

Requirements

Use a currency parameter in the buy-link, preferably EUR or USD when pre-selecting PayPal as the payment method for the Express payments checkout, to ensure that the ordering process uses a PayPal supported currency.

If shoppers are geo-located in a market using a currency not supported by PayPal, the 2Checkout system automatically switches the currency to Euro (EUR), but only in scenarios in which PayPal is the pre-selected method for the Express payments checkout.

Express payments checkout flow 

The Express payments checkout flow modifies the shopping cart design by positioning the payment methods selector area above the billing details section. 

PayPal

In scenarios in which you use PayPal as the pre-selected payment method for the Express payments checkout flow, the cart displays a streamlined Billing Information area. Customers are only required to select the currency for the transaction that can be either EUR or USD.

express checkout_2.png

Cards and other payment methods

By default, the payment methods list features four visible items. Users can click on the Select other methods link to access an extensive list of payment methods, initially hidden. Note: These are all payment methods activated for your account.

The order in which items are listed in this area is optimized by the 2Checkout system to reflect the popularity of payment methods in specific geographies worldwide. This causes the list to vary from market to market according to the location of shoppers.

express checkout_1.png

Express payments checkout links query parameters

You can build buy-links for the Express payments checkout flow manually. Use the parameters described below either with your custom domain or with https://secure.2checkout.com/order/checkout.php:

Parameter Description

NODATA = 1

Use in conjunction with PAY_TYPE=PAYPAL to trigger the Express payments checkout flow with PayPal which will circumvent 2Checkout checkout and redirect customers directly to PayPal. Expected behavior: Shoppers click on a Buy Link using the NODATA=1 andPAY_TYPE=PAYPAL parameters and are redirected to PayPal, rather than be taken to the 2Checkout shopping cart (checkout.php).

PAY_TYPE=PAYPAL

PayPal - pre-selected payment method for the order. It needs to be used in conjunction with the DESIGN_TYPE=1 parameter to trigger the Express payments checkout flow with PayPal.

CURRENCY (optional

Preselect the billing currency to be used in the transaction.

CLEAN_CART (optional)

Set this parameter to 1 to reset the cart contents or to ALL to reset the cart session. Use this parameter to remove products from the current cart session. Note: CLEAN_CART does remove production options or custom prices from the current cart session.

DESIGN_TYPE (optional)

Value = 1. When DESIGN_TYPE=1 is used in Buy Links the parameter changes the layout of the shopping cart template interface, positioning the payment methods selector in a more prominent position, above the billing details area.

  Value = 2. When DESIGN_TYPE=2 is used in Buy Links customers are redirected to their PayPal account, where they log in and confirm the payment. After payment confirmation, they are redirected to the shopping cart to confirm the billing and delivery data and enter their VAT ID.

Here's an example of such a link:

https://secure.2checkout.com/order/checkout.php?PRODS=1234567&QTY=1&COUPON=4066_100&CLEAN_CART=ALL

Generate an Express payments checkout flow link

  1. Navigate to Generate links under Setup.
  2. Select the Express payments checkout flow option in the list of purchase flows available under the Link options area.
  3. Select one or more products and configure advanced options, if needed.
  4. Scroll down to the bottom of the page and click on the Generate link button.
  5. The 2Checkout system builds a link such as the following:
https://secure.2checkout.com/order/checkout.php?PRODS=1234567&DESIGN_TYPE=1

FAQs:

1. Are free orders supported?

For free orders (with zero value) 2Checkout authorizes a minimum charge, for example, $1 when USD is the currency used for PayPal account validation purposes. 2Checkout subsequently returns the money to the shopper.

2. Can CARD=1 and CARD=2 parameters be used with the Express Payments Flow?

The Express payments flow supports both CARD=1 and CARD=2 parameters. 

Place upgrade partner orders

Overview

Purchase upgrades in addition to new licenses and subscription renewals. The 2Checkout platform enables you to offer partners upgrades to:

  • A different subscription/product;
  • A newer version of the current subscription/product;
  • A distinct licensing option of the same subscription/product.

Requirements

  • It's mandatory to associate upgrades to the same price list as the original products (subscriptions/licenses), and to assign them to partners to provide access. Products that are not part of price lists assigned to partners will not be available as upgrade options.
  • Upgrades are only available for active subscriptions/licenses. As long as expired licenses/subscriptions are still in their grace period (featuring the Past due status), upgrading them is a valid option.
  • When defining the product which will act as the upgrade make sure to also generate a subscription under the Renewal tab. Products can only be upgraded to offerings for which a subscription was generated, when ordering on behalf of your partners. If the upgrade is not a subscription, select none as the Renewal interval. This creates a lifetime license.

Place partner upgrade orders

  1. Go to Orders & customers -> Place partner order.
  2. Select the partner for which you're ordering upgrades, either by typing the name in the Select partner box, or by using the drop down menu available. Alternatively, provided that you already placed orders on behalf of your partners, a list of Last used partners will be available in this area, and clicking on a name will automatically select it.
  3. Select Upgrade to move to the next stage.
  4. Search for subscriptions/licenses you want to upgrade. The results returned for the search include only active, upgradable subscriptions/licenses previously purchased by the selected partner. Expired or disabled subscriptions/licenses, as well as those for which you haven't defined an upgrade, will not be listed here. Upgrades need to be ordered individually, one at a time, unlike prolonging subscriptions, where you can bulk renew a number of selected items. The reason for this is the fact that each product subscription/license can have different upgrade options, requiring you to customize each item individually. However, once you add an upgrade to cart, you can continue doing so for more subscriptions/products. You'll be able to add to cart and order as many upgrades as you wish, but you have to do it one by one. The quantity/number of units of the upgrade is locked and cannot be modified, unlike additional options you configured.
  5. Editing functionality for upgrade orders involves options such as adding more upgrades, remove added items one by one or all at once, and communicate with your partner through comments. You can even edit the specific details of a subscription/license already added to cart, if you would like to modify the options selected initially, for example.
  6. Step 4: Add extra margin/discount options to decrease the cost of an upgrade for your partner. Extra margins and discounts are entirely optional and completely under your control.
    • Discount - Apply a discount to the product(s) value in this order. The discount is deducted from the total price of the products before partner margin is applied.
    • Extra margin - Offer an extra margin to your partner only for this order. The extra margin is deducted from the total price of the products after discount and partner margin are applied.
  7. Place the order. Hit the Place order button to place an upgrade order once all the details are final.
  8. Order confirmation. Orders placed by you on behalf of your partners are confirmed automatically, regardless of the order confirmation settings of the partner account.
  9. Attach end user information. For upgrades, the 2Checkout system is designed to copy the end user information attached to the original subscription/license. However, when such data is not available, you'll need to provide it for the order to move to the delivery/fulfillment stage (if they are required according to the Partner commercial settings). 2Checkout needs at least the email address of partners/shoppers to deliver keys for orders that require end user information.
  10. Attach reseller information. Reseller information is also copied automatically from the original subscription/licenses as a part of the upgrade process. Similarly, when such data is not available, you'll need to provide it for the order to move to the delivery/fulfillment stage, if the reseller information is required according to that partner's commercial settings.
  11. Pay partner invoices. Partner invoices can be generated manually or automatically, depending on your partner account settings. If the order is placed without any available credit, or your partners do not enjoy a credit limit - they will first need to pay the partner invoice that gets generated automatically when the order is confirmed, and only then will the process advance to the delivery/fulfillment stage. To manually issue a partner invoice, go to Partner invoices under Orders & customers.
  12. Click the item in the list of available orders on the left hand side of the page to add them to the partner invoice you're generating, and click Preview.
  13. Click Save to create the partner partner invoice. On the next screen you'll have the option to notify your partner of the newly generated partner invoice or to cancel it if necessary.
  14. Delivery/fulfillment: When delivery/fulfillment is handled by 2Checkout, not required or has been confirmed by you, the system will give green light to deliveries immediately for order that are paid in full or placed within available credit. Fulfillment for partner orders guidance is available here.

Error messages

UPGRADE_PRICELIST_UNAVAILABLE

Upgrade is not available for this license because the product is no longer available in the initial price list. Please revise the price settings for this product.

UPGRADE_TO_PRODUCT_NOT_IN_LIST

Upgrade is not available for this license because the upgrade options set for this product are not part of the initial purchase price list. Please revise the price settings for this product.

UPGRADE_LICENCE_DISABLED

License is disabled.

UPGRADE_TO_PRODUCTS_NO_RENEWAL Upgrade is not available because subscriptions are not being generated for any of the upgrade options.

Electronic delivery and payment receipt

Use the variables in the list below to customize the Electronic delivery and payment receipt shopper email according to your needs. Check the 'Mandatory' column to see the variables that are required in your customized version of the e-mail.

Variable name Description Test value Mandatory
ADDITIONAL_PRODUCT_INFO Additional product-level fulfillment information set in the Avangate Control Panel Additional delivery information for this product. No
ADDRESS1 First section of the billing address [123, Main Street] No
ADDRESS1_D First section of the delivery address [123, Main Street] No
ADDRESS2 Second section of the billing address 0 No
ADDRESS2_D Second section of the delivery address 0 No
ALLOW_MYACCOUNT_PROMO Include or exclude myAccount information in the email body 1 No
APPROVAL Issuer (bank) payment idetifier 0 No
ATTACHMENT Indicates whether or not you configured the product keys to be sent as an email attachment. Possible values:
TRUE if the email contains an attachment
FALSE if the email doesn't contain an attachment
0 No
AVANGATE_COMPANY_NAME Avangate company name Avangate No
AVANGATE_LOGO Avangate logo URL https://secure.avangate.com/images/e...endor_logo.png Yes
AVANGATE_WEBSITE Avangate website http://www.avangate.com Yes
AVANGATE_ON_BANK_STATEMENT_GENERIC This is mandatory content you need to keep in your emails, given Avangate acts as Reseller / Merchant of Record for online purchases on your website. The charge on your bank statement will appear as Avangate. Yes
AVS_MATCH Gateway AVS 0 No
BANK_STATEMENT Account statement descriptor 0 No
BANK_STATEMENT_DESCRIPTOR Account statement descriptor 0 No
BASE_URL Merchant's full host https://secure.avangate.com No
BUSINESS_COMPANY Avangate company name Avangate No
BUSINESS_HOTLINE Avangate support phone +31 88 0000008 No
BUSINESS_HOTLINEUS Avangate US hotline number +1 (650) 963-5701 / (888) 247-1614 No
BUSINESS_SUPEMAIL Avangate support email address support@avangate.com No
BUSINESS_WEBSITE Avangate website http://www.avangate.com No
CARD_LAST_DIGITS Last 4 digits of the card used to perform the payment 1234 No
CBANKACCOUNT Shopper's bank account used on the billing information 0 No
CBANKNAME Shopper's bank name used on the billing information 0 No
CITY Shopper's city used on the billing information Anytown No
CITY_D Shopper's city used on the delivery information Anytown No
CODES Product keys to be delivered to the shopper. Each item of the array has two values: key and description  0 No
CODES[index1].description Product key description. Key description No
CODES[index1].key Product key. 123-ABC-1key-example No
COMMERCIALNAME Merchant's commercial name [Software Company Name] No
COMPANY Shopper's company name used on the billing information [Customer company] No
COMPANY_D Shopper company name used on the delivery information. If no delivery information is available. no company name is displayed. [Customer company] No
COUNTRY Shopper's country used on the billing information [U.S.A] No
COUNTRY_D Shopper's country used on the delivery information [U.S.A] No
CURRENCY Order billing currency USD Yes
CURRENCY_ORIGINAL Original order currency (applicable to refunds) 0 No
CUSTOMEREMAIL Shopper's email address used on the billing information example@customer-email.com No
CVV2_MATCH Gateway CVV2 check response 0 No
DISPLAY_MY_ACCOUNT_INFO Include or exclude myAccount information in the email body 1 No
DOWNLOAD_INSURANCE

Indicates whether or not the purchase includes Download Insurance Service. Possible values

  • TRUE
  • FALSE
0 No
DOWNLOAD_LINK_DELIVERY Indicates whether or not a download link is available. Possible values:
TRUE
FALSE
1 No
EMAIL Shopper email address used on the delivery information. If no delivery information is available. the billing information is used. example@customer-email.com No
ENCRYPTED_MERCHANT_CODE Encrypted merchant code 0 No
FIRSTNAME Shopper's first name used on the billing information [John  
FIRSTNAME_D Shopper's first name used on the delivery information [John No
FIRST_NAME_BILLING Shopper's first name used on the billing information John Yes
FIRST_NAME_DELIVERY Shopper's first name used on the delivery information John No
FISCALCODE Shopper's fiscal code used on the billing information 0 No
GATEWAY_ERROR_CODE Gateway error code GW_PROCESSING_ERROR
See the full list of Possible Values
No
GATEWAY_ERROR_MESSAGE Reason why the transaction failed. (e.g. Invalid card, insufficient funds) Error processing the card transaction. The card account has not been debited. Card data is invalid or incomplete. No
GENERALTOTAL Total order price 135.2 No
GLOBALDISCOUNT Order total discount 8.33 No
HAS_RENEWAL_PRODUCTS Flag that indicates whether at least one product has renewal settings 0 No
HAVEPAYMENTRCPT Signals that the mail includes a payment receipt 1 No
INT_REF Global Collect internal reference 0 No
IS_RENEWAL Flag that indicates whether at least one product has renewal settings 0 No
LANGUAGE Order language (abbreviated) selected by shopper en No
LASTNAME Shopper's last name used on the billing information Doe] No
LASTNAME_D Shopper's last name used on the delivery information Doe] No
LAST_NAME_BILLING Shopper's last name used on the billing information Doe Yes
LAST_NAME_DELIVERY Shopper's last name used on the delivery information Doe No
LICENSE_TYPE Type of subscription generated by the purchase product 0 No
MERCHANT_COMMERCIAL_NAME Merchant's commercial name Software Company Name No
MERCHANT_SUPPORT_EMAIL Merchant support email address support@software-company-website.com No
MERCHANT_SUPPORT_PHONE Merchant support phone number 888-xxx-xxxx  
MOREINFO Additional product-level fulfillment information set in the Avangate Control Panel [Additional delivery information for this product.] No
MORE_EMAIL_INFO 0 0 No
MY_ACCOUNT_LOGIN_EMAIL Email address used by shopper to login/signup to myAccount example@customer-email.com No
MY_ACCOUNT_LOGIN_URL Avangate myAccount login/sign-up URL secure.sofware-company-website.com/myaccount/?lang=en Yes
NAMES_OF_PRODUCTS Names of all products in the order, comma separated 0 No
ORDERDATE Order placement date [2016-07-12] No
ORDER_AMOUNT Total order price 135.2 Yes
ORDER_AMOUNT_ORIGINAL Original order value (applicable to refunds) 0 No
ORDER_DATE Order placement date 42563 Yes
ORDER_DATE_STANDARD_FORMAT Standard format used for the order placement date 0 No
ORDER_FLOW Purchase flow used to place the order 0 No
ORDER_REFERENCE_NUMBER Order reference number 9xxxxxx Yes
ORDER_STATUS Order status 0 No
ORDER_WEBSITE Website where the shopper placed the order http://www.software-company-website.com Yes
PAYMENT_METHOD English name for the payment method used Visa/MasterCard/Eurocard Yes
PAYMENT_TYPE_INFO English payment method name. Includes last four card digits (if applicable). 0 No
PAYTYPESTR English name for the payment method used [Visa/MasterCard/Eurocard] No
PHONE Shopper's phone number used on the billing information 0 No
PHONE_D Shopper's phone number used on the delivery information [555-555-555] No
PRODUCTID Product ID number 0 No
PRODUCTNAME Product name [Test product name] Yes
PRODUCTQTY Purchased product quantity 0 No
PRODUCTS[index1].DISCOUNT Product discount value per product line 0 No
PRODUCTS[index1].ID Product ID number 1001 No
PRODUCTS[index1].INFO Additional product information defined by merchant when generating buy links Product info 1 No
PRODUCTS[index1].IS_TRIAL Indicates whether this is a trial product 1 No
PRODUCTS[index1].LICENSE_TYPE Type of purchased subscription TRIAL No
PRODUCTS[index1].PCODE Product code. [P_CODE_1] No
PRODUCTS[index1].PID Product ID number 1001 No
PRODUCTS[index1].PNAME Product name [Test product name 1] No
PRODUCTS[index1].PRICE Product unit price 100 No
PRODUCTS[index1].PRODUCTNAME   0 No
PRODUCTS[index1].PRODUCT_OPTIONS[index2].OptionText Ignore internal var. 0 No
PRODUCTS[index1].PROMONAME Name of the promotion applied to the product 0 No
PRODUCTS[index1].QUANTITY Purchased product quantity 1 No
PRODUCTS[index1].SHORT_DESCRIPTION Short product description 0 No
PRODUCTS[index1].TOTAL Total gross price per product line (before applying discounts) 120 No
PRODUCTS[index1].TOTAL_PRICE Total net price per product line (before applying discounts) 100 No
PRODUCTS[index1].TRIAL_PERIOD Product trial period. 7 No
PRODUCTS[index1].UNIT_PRICE Product unit price 100 No
PRODUCTS[index1].VAT VAT/Sales tax value per product line 20 No
PRODUCTS_DATA[index1].IdProduct Product ID number 0 No
PRODUCTS_DATA[index1].PRODUCT_SHORT_DESCRIPTION Short product description 0 No
PRODUCTS_NO Number of products in cart 0 No
PRODUCT_DATA[index1].CODES[index2].description   0 No
PRODUCT_DATA[index1].CODES[index2].key   0 No
PRODUCT_DATA[index1].DOWNLOAD_LINK   # No
PRODUCT_DATA[index1].HAS_CODES_ATTACHED   0 No
PRODUCT_DATA[index1].HAS_DOWNLOAD_LINK   1 No
PRODUCT_DATA[index1].MORE_EMAIL_INFO   Additional product information No
PRODUCT_DATA[index1].NAME   Test product name 1 No
PRODUCT_DATA[index1].PRODUCT_OPTIONS   0 No
PRODUCT_DATA[index1].PRODUCT_OPTIONS[index2].OptionText   0 No
REFNO Order reference number [9xxxxxx] No
REGISTRATIONNUMBER Shopper's registration number used on the billing information 0 No
RETRYLINK Payment retry link 0 No
RETRY_LINK Payment retry link 0 No
SELLERWEBSITE Website where the shopper placed the order http://www.software-company-website.com No
SHIPPING Shipping fee amount 0 No
SHIPPING_FEE Shipping fee amount 0 No
SHOPPER_ADDRESS_1_BILLING First section of the billing address 123, Main Street No
SHOPPER_ADDRESS_1_DELIVERY First section of the delivery address 123, Main Street No
SHOPPER_ADDRESS_2_BILLING Second section of the billing address 0 No
SHOPPER_ADDRESS_2_DELIVERY Second section of the delivery address 0 No
SHOPPER_CITY_BILLING Shopper's city used on the billing information Anytown No
SHOPPER_CITY_DELIVERY Shopper's city used on the delivery information Anytown No
SHOPPER_COMPANY_BILLING Shopper's company name used on the billing information Customer company No
SHOPPER_COMPANY_DELIVERY Shopper company name used on the delivery information. If no delivery information is available. no company name is displayed. Customer company No
SHOPPER_COUNTRY_BILLING Shopper's country used on the billing information U.S.A. No
SHOPPER_COUNTRY_DELIVERY Shopper's country used on the delivery information U.S.A. No
SHOPPER_EMAIL_ADDRESS_DELIVERY Shopper email address used on the delivery information. If no delivery information is available. the billing information is used. example@customer-email.com No
SHOPPER_STATE_BILLING Shopper's state used on the billing information Anystate No
SHOPPER_STATE_DELIVERY Shopper's state used on the delivery information Anystate No
SHOPPER_ZIP_CODE_BILLING Shopper's ZIP code used on the billing information 12345 No
SHOPPER_ZIP_CODE_DELIVERY Shopper's ZIP code used on the delivery information 12345 No
STATE Shopper's state used on the billing information Anystate] No
STATE_D Shopper's state used on the delivery information Anystate] No
SUBTOTAL The order amount without vat and shipping 112.67 No
TECHEMAIL Merchant support email address support@software-company-website.com No
TECHPHONE Merchant support phone number [888-xxx-xxxx] No
TOTALEQUIV The order amount converted to all the merchant's currencies 0 No
TOTAL_DISCOUNT Total order discount 8.33 No
TOTAL_VAT Total order VAT 12 No
UPLOADLINK File upload link 0 No
UPLOAD_LINK File upload link 0 No
USER_EMAIL Email address used by shopper to login/signup to myAccount example@customer-email.com No
USER_TOKEN Shopper token for Avangate myAccount access xxxxxxxxxxxx No
VALIDATION_CODE Global Collect validation code 0 No
WEBSITE Website where the shopper placed the order http://www.software-company-website.com No
ZIPCODE Shopper's ZIP code used on the billing information 12345 No
ZIPCODE_D Shopper's ZIP code used on the delivery information [12345 No

API Requests

Overview

Perform easy account management via API Requests. The 2Checkout API portfolio contains extended capabilities that can help you automate processes as creating products or promotions, placing orders (both with catalog and dynamic product information), issuing refunds, retrieving the shipping price for an order, handling subscriptions, and many others.

 

 

Remove products

Overview

Use deletePromotionProducts to remove products from an existing promotion.

Parameters

Parameter Type/Description

promotionCode

Required (string)

 

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

promotionProducts

Required (object)

 

Code

Required (string)

 

 

System generated product code.

 

pricingConfigurationCode

Required (string)

 

 

System generated pricing configuration code.

 

pricingOptionCodes

Required (array of strings)

 

 

Pricing option codes that you control.

Response

Parameter Type/Description
Status Boolean
  True or False

Request

<?php

require ('PATH_TO_AUTH');

$promotionCode = 'MY_PROMO_CODE_1';

// Define the first product to remove from the promotion
$newProduct1 = new stdClass;
$newProduct1->Code = '';
$newProduct1->PricingConfigurationCode = '';
$newProduct1->PricingOptionCodes = ['',''];

// Define another product to remove from the promotion
$newProduct2 = new stdClass;
$newProduct2->Code = '';
$newProduct2->PricingOptionCodes = [''];

$productPromotion = [$newProduct1, $newProduct2];

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

Create an upsell campaign

Overview

Use the createUpSellCampaign method to create an upsell campaign via JSON-RPC API 6.0.

Request parameters

Parameters Type Required/Optional Description

Name

String

Required

Name of campaign, max 500 characters.

StartDate

String

Optional

The date when the up-sell campaign starts, in the YYYY-MM-DD format. Can be NULL (starts immediately after enabling).

EndDate

String

Optional

The date when the up-sell campaign ends, in the YYYY-MM-DD format. Can be NULL (ends immediately after disabling).

DisplayForManualRenewals

Boolean/Integer

Required

Flag to control if the campaign will be displayed for manual subscription renewal orders. Can be set as true/false/0/1.

Discount

Object

Required

Discount definition object, details below:

      Type

String

Required

Type of discount. Can be FIXED or PERCENT.

      Value

Integer

Required

Percentage discount value (PERCENT discount only).

      Values

Array of objects

Required

List of currency discounts (FIXED discount only), details below:

            Currency

String

Required

Code of Currency for the related amount.

            Amount

Integer

Required

Discount amount value for the related currency.

      DefaultCurrency

String

Required

Code of default Currency (FIXED discount only).

PrimaryProduct

Object

Required

Main (primary) product object, details below:

      Code

String

Required

The code of the product that the recommendation is made for.

      Quantity

Integer

Required

The quantity for the primary product. Can be 0 (standing for any quantity).

      PriceOptions

Array of objects

Optional

Price options list for the primary product, details below:

            Code

String

Required

Price option group code.

            Options

Array of objects

Optional

Price options list, details below:

                  Code

String

Required

Price option code.

                  Value

Integer

Optional

Price option value (for scale interval price option group only).

RecommendedProduct

Object

Required

Recommended product object, details below:

      Code

String

Required

The code of the recommended product.

      Quantity

Integer

Required

The quantity for the recommended product. Can be 0 (standing for “match quantity” setting).

      PriceOptions

Array of objects

Optional

Price options list for the recommended product, details below:

            Code

String

Required

Price option group code.

            Options

Array of objects

Optional

Price options list, details below:

                Code

String

Required

Price option code.

                Value

Integer

Optional

Price option value (for scale interval price option group only).

Enabled

Boolean/Integer

Required

Sets the campaign enabled or disabled. Can be set as true/false/0/1.

Description

Array of objects

Required

List of campaign language descriptions, details below:

      Language

String

Required

Code of the language.

      Text

String

Required

The text of the description in the associated language.

Response parameters

Parameters Type Description

UpSell

Object

Object containing information related to the upsell campaigns, including product information and discount settings.

Request sample

<?php
require ('PATH_TO_AUTH');

$upsell = new \stdClass();

$upsell->Name = 'December 2020 upsell campaign’;
$upsell->StartDate = '2020-12-21';
$upsell->EndDate = '2020-12-25';
$upsell->DisplayForManualRenewals = false;

// setup percent discount
$discountPercent = new \stdClass();
$discountPercent->Type = 'PERCENT';
$discountPercent->Value = 5;

// setup fixed discount
$discountFixed = new \stdClass();
$discountFixed->Type = 'FIXED';
$discountValues = [
    'USD' => 10,
    'EUR' => 8,
    'TRY' => 80,
    'RUB' => 1100,
];
$dv = [];
foreach ($discountValues as $curr => $amt) {
    $disc = new \stdClass();
    $disc->Currency = $curr;
    $disc->Amount = $amt;

    $dv[] = $disc;
}
$discountFixed->Values = $dv;

// assign discount
$upsell->Discount = $discountPercent;
# OR
# $upsell->Discount = $discountFixed;


// setup primary product
$primaryProduct = new \stdClass();
$primaryProduct->Code = $productCode;
$primaryProduct->Quantity = 1;
$ppPriceOptionGroup1 = new \stdClass();
$ppPriceOptionGroup1->Code = 'OPTGRP2';
$ppPriceOptionGroup1Option = new \stdClass();
$ppPriceOptionGroup1Option->Code = 'OptGrp2Code2';
$ppPriceOptionGroup1->Options = [$ppPriceOptionGroup1Option];

$ppPriceOptionGroup2 = new \stdClass();
$ppPriceOptionGroup2->Code = 'interval_scale_grp1';
$ppPriceOptionGroup2Option = new \stdClass();
$ppPriceOptionGroup2Option->Code = 'interval_scale_grp1-1-10';
$ppPriceOptionGroup2Option->Value = '6';
$ppPriceOptionGroup2->Options = [$ppPriceOptionGroup2Option];

$primaryProduct->PriceOptions = [$ppPriceOptionGroup1, $ppPriceOptionGroup2];
$upsell->PrimaryProduct = $primaryProduct;

// setup recommended product
$recommProduct = new \stdClass();
$recommProduct->Code = $recProductCode;
$recommProduct->Quantity = 0; // stands for “match quantity” 
$rpPriceOptionGroup1 = new \stdClass();
$rpPriceOptionGroup1->Code = 'CHECKB_LIST';
$rpPriceOptionGroup1Option1 = new \stdClass();
$rpPriceOptionGroup1Option1->Code = 'chk1';
$rpPriceOptionGroup1Option2 = new \stdClass();
$rpPriceOptionGroup1Option2->Code = 'chk3';
$rpPriceOptionGroup1->Options = [$rpPriceOptionGroup1Option1, $rpPriceOptionGroup1Option2];
$recommProduct->PriceOptions = [$rpPriceOptionGroup1];
$upsell->RecommendedProduct = $recommProduct;

$upsell->Enabled = true;

// setup languagte descriptions / texts
$enDescription = new \stdClass();
$enDescription->Language = 'EN';
$enDescription->Text = 'Buy <!--{RECOMMENDED_PRODUCT_NAME}--> for just <!--{RECOMMENDED_PRODUCT_PRICE}--> until Dec 25th';
$upsell->Description = [$enDescription];

$jsonRpcRequest = new \stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'createUpsellCampaign';
$jsonRpcRequest->params = [$sessionID, $upsell];
$jsonRpcRequest->id = $i++;

$upsellResponse = callRPC($jsonRpcRequest, $host);

 

ConvertPlus Buy-Links Signature for Dynamic Products

Overview

You can generate links for dynamic products outside the Merchant Control Panel, using the ConvertPlus parameters explained in this article. Some of the ConvertPlus buy-link parameters require a signature, to prevent any interference in the ordering process. Optional parameters also require a signature if they are included in the generated buy-link.

 

ConvertPlus parameters that require a signature

Parameter Description
return-url URL to which customers are redirected after their finalized purchase. Learn more about Redirect URL on this article.

return-type

The return method used for redirecting your customers after a successful sale. Possible values:

  • Link in the Thank You page
  • Header Redirect
expiration

Buy link expiry date. The link becomes invalid after the date from this parameter. Send as a UTC timestamp.

Example: 

1537549421 

order-ext-ref Use this parameter to set an external reference to the order.
item-ext-ref Set product identifier for your dynamic products. You can send multiple values separated by semicolon ;. 
customer-ref The 2Checkout system generates default customer numerical (integer) IDs automatically for all orders of products that feature subscriptions. Can be used for new acquisitions aggregating new subscriptions under an existing Customer account.
customer-ext-ref The external customer reference.
currency Preselected billing currency 2Checkout uses to charge your customers.
prod

The name of the dynamic product. For multiple products, send them separated by a semicolon.

Example: name1;name2;name3.

price

For dynamic products, enter the product price.

For multiple dynamic items, send the values separated by a semicolon.

Example: price1;price2;price3.

qty

The number of units (quantity) for each product in checkout, separated by a semicolon;. Do not use spaces or blanks. Example: qty=2;1.

qty works in conjunction with prod, based on their respective order. The first value of the qty parameter controls the number of units for the products whose identifier is in the first position of the prod parameter. 

Example: https://secure.2checkout.com/checkou...rchant=2COLNC&prod=6FD08E61B5;E2932D0DE2&qty=4;3

type

The type of dynamic product. Possible values:

  • digital
  • physical
  • shipping
  • tax

If type is empty or not send, the default line item is considered product.

For multiple dynamic items, send the values separated by a semicolon.

opt Defines the product pricing options.

 

URL formating rules:

 

":" is considered a pair separator

  • 1 product with 1 price option with 1 value (includes scale option type)
    • prod=code1&opt=gr1:val1
  • 1 product with 1 price option with multiple values
    • prod=code1&opt=gr1:val1:val2

 

"," is considered a value separator

  • 1 product with 2 price options with 1 value each
    • prod=code1&opt=gr1:val1,gr2:val2
  • 1 product with 2 price options with multiple values each
    • prod=code1&opt=gr1:val1:val2,gr2:val3:val4

 

";" is considered a parameter separator between products

  • 2 products with 1 price option containing 1 value
    • prod=code1;code2&opt=gr1:val1;gr2:val2
  • 2 products with 1 price option containing multiple values
    • prod=code1;code2&opt=gr1:val1:val2;gr2:val3:val4
  • 2 products with 2 price options containing 1 value each
    • prod=code1;code2&opt=gr1:val1,gr2:val2;gr3:val3,gr4:val4
  • 2 products with 2 price options containing multiple values each
    • prod=code1;code2&opt=gr1:val1:val2,gr2:val3:val4;gr3:val5:val6,gr4:val7:val8
description For dynamic products, set a description that is displayed in the checkout page. The description field is displayed only for the 'One column with payment buttons' template. The description will not be visible in the default template.
recurrence

For dynamic products, set product recurring options.

Send multiple dynamic items separated by a semicolon.

Example: period1:unit1;period2:unit2;

 

Possible values for units:

  • DAY
  • WEEK
  • MONTH
  • YEAR
  • FOREVER

*This parameter is conditioned by two other parameters: duration and renewal-price.

duration For dynamic products, set the duration of the recurrence.
renewal-price For dynamic products, set the price that should be applied to the renewal order.

ConvertPlus parameters to be included in the signature - general rules

  1. General parameters included in the signature, regardless of the type of checkout (catalog products, dynamic products, renewal, unfinished payment): return-urlreturn-typeexpirationorder-ext-refcustomer-refcustomer-ext-ref.
  2. Parameters to be included in the signature for dynamic products buy-links: currencyprod, priceqtytypeoptdescriptionrecurrencedurationrenewal-price,  item-ext-ref.
  3. Parameters to be included in the signature for manual renewal buy-links: prodqtyopt.
  4. Parameters to be included for on-the-fly pricing for catalog products: prodpriceqtyopt, coupon.
  5. The parameter to be included in order to lock the cart for catalog products: lock.
  6. Parameters to be included when an approved URL is set: in this case, all parameters will be included in the signature, when redirected after successful completion of a sale.

Build the ConvertPlus signature

To sign a ConvertPlus buy-link, you need to follow these steps:

  1. Sort the parameters that require a signature alphabetically.
  2. Serialize the parameters and append to them the length of their values.
  3. Concatenate the resulting values.
  4. The serialized value is then encrypted with your Buy Link Secret Word using the HMAC method (algorithm sha256).
  5. The resulting value is added to the buy link under the signature parameter

Example

Let's consider the following parameters:

  •     merchant = 'MCODE'
  •     dynamic = '1'
  •     prod = 'Software'
  •     price = 10
  •     currency = 'USD'
  •     qty = 1
  •     type = 'digital'
  •     expiration = 1893456000

The regular buy-link will have the following structure:

https://www.2checkout.com/checkout/buy?merchant=2COLRNC&dynamic=1&prod=Software&price=10currency=USD&qty=1&type=digital&expiration=1893456000 

This link is missing one last parameter, a signature.

Let's take a look at the list of parameters that require a signature:

  •     merchant = '2COLRNC'
  •     dynamic = '1'
  •     prod = 'Software' <-- SIGNATURE REQUIRED
  •     price = 10        <-- SIGNATURE REQUIRED
  •     currency = 'USD'        <-- SIGNATURE REQUIRED
  •     qty = 1             <-- SIGNATURE REQUIRED
  •     type = 'digital'         <-- SIGNATURE REQUIRED
  •     expiration = '1893456000' <-- SIGNATURE REQUIRED

We extract only those parameters:

  •     prod = 'Software'
  •     price = 10
  •     currency = 'USD'
  •     qty = 1
  •     type = 'digital'
  •     expiration = 1893456000

Sort the parameters alphabetically

  •     currency = 'USD'
  •     expiration = 1893456000
  •     price = 10
  •     prod = 'Software'
  •     qty = 1
  •     type = 'digital'

Serialize the values

To serialize a value, you need to prepend to it the number of letters or digits a value has. For example, the currency parameter has the 'USD' value that will be serialized as '3USD', where 3 is the number of letters that make up the value. The value of the price parameter is '10', so the serialized value will be '210', where 2 is the number of digits that make up the value.

In case a value uses special characters, to serialize it, you need to prepend to it the number of bytes in the string, also known as the UTF-8 string length. To count the bytes in the string, you can use an online bytes counter. For example, if the prod parameter has the 'ελληνικά' value, this will be serialized as '16ελληνικά' and not as '8ελληνικά', due to the use of special characters, where '16' is the number of bytes in the string.

  •     currency = '3USD'
  •     expiration = 101893456000  
  •     price = 210
  •     prod = '8Software'
  •     qty = 11
  •     type = '7digital'

Concatenate the values

    '3USD1018934560002108Software117digital'

Encrypt using your Secret Word

The serialized value is then encrypted using the HMAC method.

    - the algorithm used is sha256

    - the key used when encrypting is the merchant secret word (in this example, the secret word is 'secret_wordbuylink')

This outputs a 64 character string:

c2225743f22e3b698b2f31052e35ec7602b787c804eaac1e0cd127a9a06b5762

Add the string in the buy-link

https://secure.2checkout.com/checkout/buy?merchant=2COLRNC&dynamic=1&prod=Software&price=10&currency=USD&qty=1&type=digital&expiration=1893456000&signature=c2225743f22e3b698b2f31052e35ec7602b787c804eaac1e0cd127a9a06b5762

Set grace period

Overview

Use the setSubscriptionGracePeriod method to set a custom grace period for an Active or Past Due subscription. This method changes per-subscription end user data and not customer details.

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. Needs to belong to an Active or Past Due subscription.

subscriptionGracePeriod

Required (int)

 

The number of days for the grace period, during which time, customers can still renew/upgrade expired subscriptions. During the grace period, subscriptions feature the Past Due status.

 

Can be NULL. When NULL, the grace period for a subscription is the same as that you defined in the per-product or per-account grace period settings. You can use this to set a custom grace period for a subscription.

 

Use 0 to remove the grace period from a subscription.

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';
$gracePeriod = YOUR_GRACE_PERIOD;

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

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

Retrieve order fields

Overview

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

Parameters

Parameters Type/Description

sessionID

Required (string)

 

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

Request

<?php

require ('PATH_TO_AUTH');

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

?>

Response

Parameters Type/Description

AdditionalFields

Array of orders

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