Skip to main content

Search products

Overview

Use the searchProducts method to extract information about the subscription plan/products you configured for your account.

Pagination

Use pagination to decrease the request loading time, while better handling the returning responses.

Pagination works on all the search methods existing on 2Checkout API 6.0. The default pagination behavior is to display page 1 with 10 results. The maximum number of items displayed on a single page is 200.

To use pagination, include the Pagination object inside the search method call, using the parameters below:

Parameters Type/Description
Pagination Object
  Details below.
  Page Int
    Set the number of pages that should be returned.
  Limit Int
    Set a limit for the number of results that should be returned.

 

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.

SearchOptions

Object

 

Name

Optional (string)

 

Product name. Can be NULL.

 

Codes

Optional (StringArray)

 

Array of product codes.

 

Types

Optional (StringArray)

 

Array of the values representing the type of products. Possible values:

  • REGULAR
  • BUNDLE

Leave empty to have all product types returned to the search.

Can be NULL. If NULL, 2Checkout returns both regular and bundle products.

 

Enabled

Optional (boolean)

 

True or false. Can be NULL.

 

GroupName

Optional (string)

 

The name of the group that the product is associated with.

Can be NULL.

                                                          Pagination Object
 

                                                          Limit

Optional (integer)

 

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

Can be NULL.

 

                                                          Page

Optional (integer)

 

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

Can be NULL.

 

OrderBy

Object

 

Defines the order of the returned results.

 

Field

Optional (string)

 

The name of the field to order the results by. Allowed values: 'ProductStatus', 'ProductName', 'ProductCode', 'UpdateDatetime', 'AvangateId'. Can be NULL.

 

Direction

Optional (string)

 

Sort results ascending or descending. Allowed values:

  • asc
  • desc (default)

Can be NULL (defaults to desc).

 

Request Example

<?php

require ('PATH_TO_AUTH');

$SearchOptions = new stdClass();
$SearchOptions->Name = '2Checkout Subscription'; //Product name
$SearchOptions->Types = array ('REGULAR', 'BUNDLE'); //product type (standalone), regular or bundle
$SearchOptions->Enabled = True;
//$SearchOptions->GroupName = '';
$SearchOptions->Pagination = new stdClass();
$SearchOptions->Pagination->Page = 1;
$SearchOptions->Pagination->Limit = 10;

try {
    $ProdSearch = $client->searchProducts($sessionID, $SearchOptions);
}

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

var_dump("Query", $ProdSearch);

?>

Response Parameters

Parameter Type/Description

Product

Object

 

 

Legal customization requirements

Overview

2Checkout is the Merchant of Record for orders performed and payments processed using our platform. From a legal standpoint, this means we are responsible for the information provided to your shoppers via the emails sent, on your behalf, through our platform.

Consequently, there are several mandatory requirements to account for when customizing your emails. These requirements depend on the type of emails sent. 2Checkout emails generally fall into two categories:

  • Transactional emails. According to CAN-SPAM rules, these emails facilitate an already agreed-upon transaction or update the customer about ongoing transactions. They usually contain order, payment, or customer-specific information.
  • Marketing (commercial content) emails. According to CAN-SPAM rules, these emails advertise or promote commercial products or services.

Check the documentation available here to see the emails in each category.

Email requirements

Do not remove mandatory information when you customize the content of your emails.

Transactional email requirements

  • Always include the reference to 2Checkout acting as Merchant of Record in Transactional emails (optional for Marketing emails). The structure we recommend using is the one in our default templates: “2Checkout acts as an authorized reseller of <Your Company Name> online products and services.” Localized versions are available for all default templates.
  • Show 2Checkout support information in all Transactional emails. This includes the access link to the shopper myAccount along with the email address needed to log in. Keep in mind that we are the ones offering order and payment support, so make sure you provide shoppers with access to all support channels. This weighs a lot in turning them into loyal, long-term customers.
  • Display merchant (your company) support information in all Transactional emails. This includes support email and phone numbers. This is critical to your shoppers when they need additional product/subscription information, troubleshooting services, or access modifications.

Marketing email requirements

  • Include an unsubscribe option in all Marketing emails. Make it as clear, explicit, and simple to use as possible. We recommend keeping/including an unsubscribe link at the bottom of your message. You can use the UNSUBSCRIBE_LINK variable that takes the shopper to an unsubscribe page.
  • Gmail and Yahoo updated their requirements for bulk senders making it mandatory to have one-click unsubscribe option in the header. This means that all emails with the exception of order confirmation, payment receipts, electronic delivery, access links and others will have an unsubscribe option in the header. 
    • The current unsubscribe mechanism ensures that the unsubscribe scope is limited to either a specific sale, lead or subscription. Take for example the case where you have configured 5 manual renewal reminders. The shopper receives the first manual renewal reminder and clicks on the “unsubscribe” link. The shopper will no longer receive any manual renewal reminders for that subscription renewal, but he would still be eligible to get the same type of reminder for other subscription(s) and even for the next renewal of the same subscription.
    • The below platform emails will have the one-click unsubscribe option in the header:
      • Abandoned cart (lead management)
      • Affiliate newsletter
      • Free trial download expiration
      • Manual renewal reminder
      • Recurring payment failed (Direct Debit)
      • Recurring payment failed (dunning notification)
      • Recurring payment failed (instant payment methods)
      • Unfinished payment (Direct Debit)
      • Unfinished payment (lead management)
      • Unfinished payment (Purchase order)

Shared requirements

  • Always display the 2Checkout logo in either the header or the footer of the email. Make sure it is visible and distinctive against other elements. You can use the 2CHECKOUT_LOGO variable that shows the image at optimal dimensions.
  • The subject line of your emails needs to be reflective of the content they communicate. Choose a relevant subject line to ensure your shoppers will continue opening emails sent on your behalf and keep these emails out of the spam folder.
  • The content of your emails should always be related to the event triggering the email. For instance, build the Payment receipt email to include information on purchased products or subscriptions, quantities, unit prices, taxes, discounts, and total price, billing, and delivery information. Abandoned cart notifications should include a link to the abandoned cart, that the shopper can use to finalize the order.

Orders with installments

Overview

Avangate supports local Brazilian Visa, MasterCard and AMEX credit / debit cards limited to national purchases in the local currency BRL (Brazilian Real)

Requirements

  1. Installments are available only for:
    • Brazilian customers
    • Local Visa, MasterCard or AMEX cards
    • Non-recurring transactions
  2. Minimum installment threshold is 5 BRL. Maximum number of installments is 6.
  3. Mandatory information for payments also includes shopper phone number and  Fiscal Code (CPF/CNPJ).

Do local BR cards with / without installments require an addendum to my contract?

Yes. Please contact Avangate for activation.

How does it work?

  1. Create the Order object.
  2. Validate the number of installments available based on total order value. 
  3. Place the order specifying the number of installments. 

Funds collection for installment payments

2Checkout pays you in full, regardless of the number of installments (this is covered directly by the banks). 

 

Overview

Introduction

Use JSON/RPC to invoke methods of version 3.0 of the Avangate API. JavaScript Object Notation remote procedure call protocol is a lightweight data-interchange format. 

Workflow

  1. Use the following URL: https://api.avangate.com/rpc/3.0/
  2. Authenticate using the login method and create a session (connection).
  3. Throughout the lifetime of the session (max 10 minutes) you can invoke all Avangate API methods. To invoke methods you need to send a request to Avangate. Read more on the request object below.
  4. The Avangate system provides responses for all requests. Read more on the response object below.

 

Request

Invoke remote methods by sending requests to Avangate. Request contain single objects serialized using JSON. Read request properties below.

{
    "jsonrpc": 2.0,
    "id": < intidentifier >,
    "method": "<methodName>",
    "params": [ < parametersarray > ]
    }

Request object

jsonrpc

required (String)

 

The version of the JSON-RPC protocol. Needs to be 2.0.

id

required (Int)

 

A mandatory identifier you control used to identify the request and the response. Use only integers.

method

required (String)

 

The name of the method invoked. Case sensitive.

params

optional (Object)

 

An object containing the parameters valid for invoking the method used.

Parameters structure:

  • Provide RPC call parameters by-position using an Array. (structured value)
  • by-position: include all parameters into an Array. Put values in the order expected by Avangate.
  • At this point Avangate doesn’t support by-name parameters.

Response

When the method invocation completes, Avangate replies with a response. The response is a single object serialized using JSON. There are two types of response, with the properties detailed below.

Valid

 

 {
    "id": < intidentifier > ,
    "jsonrpc": 2.0,
    "response": { < return object > }
                }

 

jsonrpc

required (String)

 

The version of the JSON-RPC protocol. Needs to be 2.0.

id

required (Int)

 

A mandatory identifier you control used to identify the request and the response. Use only integers.

response

required on success only (Object)

 

Provided on success (Avangate does not provide it if there is an error invoking the method). Actual value depends on the method invoked.

Invalid

{
    "id": < intidentifier >,
    "jsonrpc":2.0,
    "error":{
        "code": < interrorcode >,
        "message":"<error message>"
            }
    }

 

jsonrpc

required (String)

 

The version of the JSON-RPC protocol. Needs to be 2.0.

id

required (Int)

 

A mandatory identifier you control used to identify the request and the response. Use only integers.

error

required on error only (Object)

 

  • Code - Integer identifying the error.
  • Message - Error description (string).

 

Custom Price Change

Overview

2Checkout automatically sends out the custom price change email to provide shoppers with information about a change in their subscription price. It notifies shoppers that the subscription price has been changed by the service provider.

The custom price change email template is available for customization in the Merchant Control Panel.

Availability

All 2Checkout accounts.

What is the purpose of this email?

2Checkout sends the custom price change email for all shoppers with active subscriptions.

Email content

The email provides detailed information on the content of the subscription and billing cycle:

  1. Subscription details.
  2. Billing cycle and new billing cycle information.
  3. Billing amount details.

Sample

Email Body

Dear [% $LAST_NAME %] [% $FIRST_NAME %],
Please be informed that the next billing amount for your subscription to [% $PRODUCT_NAME %] has been changed by a representative of [%$COMMERCIALNAME%]:

New billing amount: [% $NEW_PRICE.amount %] [% $NEW_PRICE.currency %]
[%if $NEXT_BILLING_DATE %]Next billing date: [% $NEXT_BILLING_DATE %]
[%/if%]
Previous billing amount: [% $OLD_PRICE.amount %] [% $OLD_PRICE.currency %]
Price validity: [%if $NEXT_CIRCLES == false%]all future subscription renewals.
[%else%]the next [% $NEXT_CIRCLES %] subscription renewal(s) from now on, after which the previous billing amount will be charged.
[%/if%]

To manage your subscription, please access your [% $PAYMENT_PARTNER %] myAccount at:
[% $MYACCOUNT_URL %]

For further information regarding this price update, please contact [% $SELLER_COMPANY %][%if $SUPPORT_EMAIL%] at: [% $SUPPORT_EMAIL %][%/if%]
[%if $SUPPORT_WEB%]

Sample Image

subscription price change.JPG

Order session contents

Overview

Retrieve the current cart session content, and learn insights about your customers actions in cart.

You can obtain the VAT or sales TAX based on current cart items, prefill the customer information based on the subscription reference, or get the price applied in cart by using the API method from below.

 

Retrieve a lead

Overview

Use the getLead method to retrieve leads created in the 2Checkout systems by fetching the lead code.

Request Parameters

Parameters Required Type/Description

LeadCode

Optional

String/Array of strings. Retrieves all leads based on their unique identification code (system-generated).

 

 

Email

Optional

String. A valid email address used by the customer

Type

Optional String. Must be one of the existing types of leads:
  • New
  • Used
  • UsedSuccess
  • Stopped
  • NotStopped

StartDate

Optional String. The start date of the interval; format must be yyyy-mm-dd.

EndDate

Optional String. The end date of the interval; format must be yyyy-mm-dd.

ProductCode 

Optional

String/Array of strings. Searches for all leads containing the product code.

Language

Optional String. The language of the shopper cart; ISO 639-1 two-letter code.

Country

Optional String. The customers billing country; ISO 3166 two-letter code.

GeneratedFrom 

Optional String. API, shopping cart, ConvertPlus. Display the leads based on the source where they were created – via API or via the 2Checkout ordering engines.

Request Example

<?php

require ('PATH_TO_AUTH');

$jsonRpcRequest = array (
    'method' => 'getLead',
    'params' => array($sessionID, '60E6C4B574'),
    'id' => $i++,
    'jsonrpc' => '2.0'
);

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

Response Example

class stdClass#18 (14) {
  public $LeadCode =>
  string(10) "60E6C4B574"
  public $GeneratedFrom =>
  string(3) "API"
  public $CartId =>
  string(11) "CartIdValue"
  public $Currency =>
  string(3) "EUR"
  public $Language =>
  string(2) "BG"
  public $ExternalReference =>
  string(18) "REST_API_3CHECKOUT"
  public $MachineId =>
  string(6) "123asd"
  public $LocalTime =>
  string(19) "2019-11-05 16:48:28"
  public $Items =>
  class stdClass#19 (1) {
    public $0 =>
    class stdClass#20 (15) {
      public $Code =>
      string(10) "04C26C50F8"
      public $Quantity =>
      string(1) "2"
      public $SKU =>
      NULL
      public $Name =>
      string(5) "softy"
      public $Description =>
      NULL
      public $IsDynamic =>
      bool(false)
      public $Tangible =>
      bool(false)
      public $PurchaseType =>
      string(7) "PRODUCT"
      public $PriceOptions =>
      NULL
      public $RecurringOptions =>
      class stdClass#21 (5) {
        public $CycleLength =>
        NULL
        public $CycleUnit =>
        NULL
        public $CycleAmount =>
        NULL
        public $ContractLength =>
        NULL
        public $ContractUnit =>
        NULL
      }
      public $RenewalInformation =>
      class stdClass#22 (1) {
        public $SubscriptionReference =>
        NULL
      }
      
      }
      public $MarketingCampaigns =>
      class stdClass#23 (3) {
        public $Type =>
        string(2) "23"
        public $ParentCode =>
        string(1) "m"
        public $CampaignCode =>
        string(2) "23"
      }
      public $Price =>
      class stdClass#24 (2) {
        public $Amount =>
        string(2) "20"
        public $Type =>
        string(6) "CUSTOM"
      }
      public $AdditionalFields =>
      NULL
      public $SubscriptionStartDate =>
      string(19) "2019-11-05 16:48:28"
      }
  
  public $BillingDetails =>
  class stdClass#25 (12) {
    public $FirstName =>
    string(8) "Customer"
    public $LastName =>
    string(9) "2Checkout"
    public $Phone =>
    NULL
    public $Company =>
    NULL
    public $FiscalCode =>
    string(8) "32423423"
    public $Email =>
    string(22) "customer@2checkout.com"
    public $Address1 =>
    string(12) "Test Address"
    public $Address2 =>
    NULL
    public $City =>
    string(2) "LA"
    public $Zip =>
    string(5) "12345"
    public $CountryCode =>
    string(2) "RO"
    public $State =>
    string(2) "CA"
  }
  public $DeliveryDetails =>
  class stdClass#26 (12) {
    public $FirstName =>
    string(8) "Customer"
    public $LastName =>
    string(9) "2Checkout"
    public $Phone =>
    NULL
    public $Company =>
    NULL
    public $FiscalCode =>
    string(8) "32423423"
    public $Email =>
    string(22) "customer@2checkout.com"
    public $Address1 =>
    string(12) "Test Address"
    public $Address2 =>
    NULL
    public $City =>
    string(2) "LA"
    public $Zip =>
    string(5) "12345"
    public $CountryCode =>
    string(2) "RO"
    public $State =>
    string(2) "CA"
  }
  public $DeliveryInformation =>
  class stdClass#27 (1) {
    public $ShippingMethod =>
    class stdClass#28 (1) {
      public $Code =>
      string(5) "sdfsd"
    }
  }
  public $PaymentDetails =>
  class stdClass#29 (4) {
    public $Type =>
    string(2) "CC"
    public $Currency =>
    string(3) "EUR"
    public $PaymentMethod =>
    class stdClass#30 (2) {
      public $RecurringEnabled =>
      bool(false)
      public $CardPayment =>
      class stdClass#31 (1) {
        public $InstallmentsNumber =>
        string(2) "23"
      }
    }
    public $CustomerIP =>
    string(7) "1.2.3.4"
  }
  public $Promotions =>
  array(1) {
    [0] =>
    string(0) ""
  }
}

 

Update product

Overview

Use the updateProduct method to update the configuration of a subscription plan/product you already configured for your account. 

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.

Product

Required (object)

 

Use this object to configure your subscription plans/products.

 

You can update/edit all parameters, except the following:

  • AvangateID
  • ProductType

Exceptions

When updating a subscription plan/product, you also update its PricingConfigurations. However, you cannot modify:

  • The pricing configuration CODE.
  • The PricingSchema from DYNAMIC to FLAT or vice versa.  

Request

<?php

require ('PATH_TO_AUTH');

$ProductCode = 'NewProdCodeAPI12345';

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

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

$myProduct->ProductName = 'Edited_From_API_Again';

var_dump ($myProduct);

try {
    $NewSubscriptionPlan = $client->updateProduct($sessionID, $myProduct);
}

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

var_dump("UpdatedProductInfo", $NewSubscriptionPlan);

?>

Response

bool(true)

 

Pricing configuration

Overview

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

Pricing configuration object

Parameters Type/Description
Name String
  Pricing configuration name.
Code String
  System-generated identifier. Read-only.
Default Boolean
  True for the default pricing configuration
BillingCountries Array of strings
 

ISO codes of the countries assigned to the pricing configuration.

Empty unless a pricing configuration has specific countries assigned.

PricingSchema String
 

DYNAMIC – With a base price

FLAT – Without a base price

PriceType String
 

Possible values:

• NET

• GROSS

DefaultCurrency String
  The ISO code of the default currency for the pricing configuration.
Prices Object
  Details below.
  Regular Array of objects
    Details below.
    Amount Int
      The price of the product. Use -1 to delete it.
    Currency String
      ISO code of the currency for the product price.
    MinQuantity Int
      The minimum quantity of volume discounts. Default is 1.
    MaxQuantity Int
      The maximum quantity of volume discounts. Default is 99999.
    OptionCodes Array of objects
      Details below.
      Code String
        System generated pricing options group code (you can also configure it) that the 2Checkout system uses to calculate product prices for pricing configurations without a base price.
      Options StringArray
        The pricing options group option code you configured that the 2Checkout system uses to calculate product prices for pricing configurations without a base price.
  Renewal Array of objects
    Details below.
    Amount Int
      The price of the product. Use -1 to delete it.
    Currency String
      ISO code of the currency for the product price.
    MinQuantity Int
      The minimum quantity of volume discounts. Default is 1.
    MaxQuantity Int
      The maximum quantity of volume discounts. Default is 99999.
    OptionCodes Array of objects
      Details below.
PriceOptions Array of objects
  Details below.
  Code String
    System generated pricing options group code (you can also configure it) that the 2Checkout system uses to calculate product prices for pricing configurations without a base price.
  Required Boolean
   

true – you set the price options group as required during the purchase process.

false - you did not set the price options group as required during the purchase process.

 

 

Next renewal price

Overview

Use the methods below to set or retrieve information related to the next renewal price to be charged on a customer's subscription.

 

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