Skip to main content

Retrieve an order

Overview

Use the getOrder method to retrieve details on a specific order placed with dynamic product information, or catalog products, using its unique, system generated reference.

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.

orderReference

Required (string)

 

Order reference number of older order, which is already approved/paid.

skipPartnerOrders Optional (boolean)
 

Default value = TRUE. 

Decides if the partner orders should be retrieved or not. By default, they are skipped and instead of returning the partner order according to the orderReference, it will return the master order.

Response

Parameters Type/Description

Order information

Object (orders with catalog products)

Order information Object (orders with dynamic product information)

Request 

<?php

require ('PATH_TO_AUTH');

$orderReference = 'YOUR_ORDER_REFERENCE';
$skipPartnerOrders = 'FALSE';

$jsonRpcRequest = array (
'method' => 'getOrder',
'params' => array($sessionID, $orderReference, $skipPartnerOrders),
'id' => $i++,
'jsonrpc' => '2.0'
);

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

 

 

Increase subscriber retention

Overview

As we are going through a crisis period, 2Checkout is dedicated to helping your business grow, and minimize the effects the global economic slowdown might have on the eCommerce environment. Check out our Voluntary Churn Prevention tools below, which can help you access new markets, retain your customers, and offer subscribers just what they need right now.

Offer subscribers alternatives to extend or cancel subscriptions. Be transparent! 

Some of your subscribers will want to cancel their existing subscriptions for various reasons (to temporarily reduce costs or simply because they are not using your services at the moment). Winning back these customers will cost you time and money, so it is recommended you offer them some alternatives to canceling their subscriptions. 

  • Offer discounts during the churning process to entice price-sensitive subscribers to stay. Activate a churn prevention campaign, and make discounts attractive enough to secure a purchase.  
  • Offer subscribers the option to pause subscriptions instead and then have these automatically resume at a specific date without reacquisition costs, using the pause a subscription option from your Control Panel, or by using the pauseSubscription API method.
  • Extend the subscription duration and ask subscribers to re-enable automatic renewal right after they cancel it, to minimize the chances of them churning. You can extend subscriptions by:
  • Allow subscribers to downgrade to basic plans by using custom downgrade links.  

Don’t wait until your subscribers cancel. Be proactive about it!

You shouldn’t wait until a customer cancels a subscription to address the situation. We’ve outlined several measures you can take to ensure support to your most loyal customers: 

  • Extend subscription expiration for upcoming renewals by a couple of months is advisable for annual subscriptions that are due to expire in the coming period. This is done by:
  • Temporarily cut down renewal prices to reduce cost pressure for subscribers. You can do this by:
  • Upgrade customers for free so they make the best of your product during these times. To make it easy to revert after this period, you can create a temporary plan to upgrade to with the same price as your low-end plan and have a subscription set to upgrade to that, instead of your main upgrade plan.  
  • Upgrade individual subscriptions by:
    • using the Upgrade button on the "Subscription Details" page in the Merchant Control Panel. Make sure to apply a 100% discount code so that your customers get the upgrade for free
    • using custom upgrade links (not available in ConvertPlus)
    • via API using the setSubscriptionUpgrade method 
  • Communicate the value of your product appropriately with your customers through email communications going out from the 2Checkout platform (renewal notifications and unfinished payment notifications for recurring charges) or through additional marketing automation sequences you have on winning back customers. 

Don’t assume why subscribers are churning. Know it!

If your subscribers eventually do end up churning, it is important that you are able to distinguish which subscribers churned because of the pandemic and which churned because of other reasons. To help you make that distinction we added “Coronavirus” as a cancelation reason in our subscription cancelation feedback form, part of our churn prevention campaign capability. You can see what the reasons for churn are using the churn prevention feedback report, and act only on those subscriptions which you see fit. 

For any additional information on how to use any of these features, reach out to our Merchant Support Team or your account manager.

 

Apple Pay

Overview

As of 2020, there were 230 million global Apple Pay users or 48% of active iPhones had activated Apple Pay, out of which international accounts for 85%, and the U.S. for 15%. ​The number of transactions exceeded 10 billion in 2019 and registered 70% of global card payment volumes.

Apple Pay is available in 20 countries spread across the globe and provides an easy and secure way to make payments via iOS apps, watchOS apps, and websites on Safari. Nonprofits can accept donations within their apps and websites with Apple Pay. 

Availability

Apple Pay is available for MoR business model accounts using all or any of our ordering engines (hosted shopping cart, ConvertPlus, and InLine). 
For PSP business model, Apple Pay is available for activation only if your contract country is the United States.

Benefits

  • Seamless payment experience. Shoppers are finalizing orders with minimum effort, with only a few clicks.
  • Cross-platform support. The checkout experience is consistent across many platforms and devices: computers, tablets, or smartphones. 
  • Enhanced security. Shoppers benefit from a frictionless checkout experience by using Face ID, Touch ID, or double-clicking Apple Watch, while the payment information is sent by Apple Pay in a tokenized form. Shoppers can quickly and securely provide their payment, shipping, and contact information to check out. 

Requirements

Shoppers need to use a device that supports Apple Pay (check the full list of devices in the FAQ section below). 

Apple Pay is available only for a selected list of countries.

To display the Apple Pay buy button in the cart include the "DESIGN_TYPE = 2" parameter in your buy links. See more information about the Express payments checkout flow here. This parameter does not apply to the ConvertPlus ordering engine.

Pricing

2Checkout does not apply any cost to orders paid via Apply Pay. Your incoming orders will be commissioned based on the credit card method used during the purchase (Visa/MasterCard).

Workflow

  1. When the shopper enters the cart, the Apple Pay button is displayed along with the other Payment options.
  2. The shopper clicks on the Buy with Apple Pay button on the checkout page.
  3. The Apple Pay payment sheet opens on top of the checkout page.
  4. The shopper selects one of the cards associated with their iCloud account and verifies the billing/shipping information.
  5. Simultaneously, a confirmation request will be sent to the registered mobile device iPhone, iPad, or iWatch.
  6. The shopper authorizes the payment by using Face ID, Touch ID, or double-clicking on the Apple Watch.
  7. Payment is confirmed and the order is finalized with the information retrieved from the shopper's iCloud account.
  8. The 2Checkout 'Thank You' page will be displayed once the purchase is successfully finalized.

 

Picture2.png

FAQs

1. What devices are supported by Apple Pay? 

Apple Pay is available on the following devices:

  • iPhone & iPad: iPhone X, 8/8 Plus, iPhone 7/7 Plus, iPhone 6S/6S Plus, iPhone 6/6 Plus, iPad Air 2, iPad mini 3, iPad mini 4, iPad Pro with iOS 10 or later installed
  • Mac: All the Macs with macOS Sierra or later installed but only available via an iPhone X, 8/8 Plus, iPhone 7/7 Plus, iPhone 6S/6S Plus, iPhone 6/6 Plus, iPhone SE, or an Apple Watch/Apple Watch Series 2 and only via Safari.
  • Users with iPhone 5, 5C and 5S can use the service through an Apple Watch, activated with a passcode.

2. How can I find out if Apple Pay is available in my country?

Check here the list of countries where Apple Pay is available.

3. What card networks are available in Apple Pay?

Supported networks: Visa, Mastercard.

4. Does Apple Pay work on other devices (other than Apple devices)?

No. It works only with Apple devices with Safari web browser.

5. Will pop-up blockers prevent the Apple Pay window from being displayed?

No. As the popup is generated by the browser it will not be blocked.

6. Does Apple Pay support automatic renewal?

Yes, orders placed via Apple Pay can be automatically renewed, according to the subscription settings.

7. Can refunds or chargebacks be processed for orders placed via Apple Pay?

A: Yes, as Apple Pay is an express flow for orders placed through credit cards, automatic refunds can be issued, and customers can open disputes from their bank.

Partner product download

Overview

Manage download files for your products directly into Partner Control Panel.

Benefits

  • Improve partner communication, educating them about the products within their assigned pricing lists.
  • Automate and streamline access to your product files, making it easier for your partners to distribute them to end-users.

You can enable download links for partners either per product or per file. 

Enable product files

Follow the steps below to provide access to a product file.

Method 1

  1. Go to Setup → Products.
  2. Click Edit on a specific product.
  3. Go to the Fulfillment tab. The option is only available for products for which you're delivering a file for download.
  4. Scroll down to the Product File area.
  5. Enable the Display to partners in their Partner Control Panel option.

Method 2

  1. Go to Setup → Fulfillment.
  2. Click the Product Files tab.
  3. Identify the file to share with your partners.
  4. Click Edit.
  5. Scroll down to the Available products for this file section.
  6. Check the box next to the Partners option.
  7. Click Update settings.

Once you have enabled this feature, your partners receive immediate access to product files. The Partner Control Panel is updated with direct links to product files (all of which are available for download). Direct links to your products are displayed in Dashboard → Resources → Products, under the Download file column.

Partners can take advantage of direct access to product download files to enhance the shopping experience for their buyers. Shoppers will be able to download the files directly from the servers partners/vendors choose for hosting.

Subscription

Overview

Retrieve information and manage subscriptions for your account. Subscriptions can be retrieved starting with 5 minutes after their orders are generated in the 2Checkout system.

Object parameters

Parameters Type/Description

SubscriptionReference

String

 

Unique, system-generated subscription identifier.

StartDate

String

 

Subscription start date(YYYY-MM-DD) - StartDate is mandatory when importing subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the StartDate you provide must be in accordance with your custom configuration.

ExpirationDate

String

 

Subscription expiration date(YYYY-MM-DD) - ExpirationDate is mandatory when importing subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the ExpirationDate you provide must be in accordance with your custom configuration.

RecurringEnabled

Boolean

 

Possible values:

TRUE – recurring billing/automatic subscription renewals enabled

FALSE– recurring billing/automatic subscription renewals disabled

SubscriptionEnabled

Boolean

Possible values:

TRUE –subscription enabled

FALSE–subscription disabled

Product

Required (object)

 

The product for which Avangate generated the subscription. Details below.

 

ProductCode

String

 

 

Unique product identifier that you control.

 

ProductId

Int

 

 

Unique, system-generated product identifier.

 

ProductName

String

 

 

Product name.

 

ProductQuantity

Int

 

 

Ordered number of units.

 

ProductVersion

String

 

 

Product version.

 

PriceOptionCodes

Array

 

 

The product options codes the customer selected when acquiring the subscription. Pricing options codes are case sensitive.

EndUser

Object

 

The end user of the subscription. Details below.

 

Person

Object

 

 

FirstName

String

 

 

 

End user's first name

 

 

LastName

String

 

 

 

End user's last name

 

 

CountryCode

String

 

 

 

End user country code [ISO3166-1 Alpha 2].

 

 

State

String

 

 

 

End user state.

 

 

City

String

 

 

 

End user city.

 

 

Address1

String

 

 

 

End user first address line.

 

 

Address2

String

 

 

 

End user second address line.

 

 

Zip

String

 

 

 

End user zip code.

 

 

Email

String

 

 

 

End user email address.

 

 

Phone

String

 

 

 

End user phone number.

 

 

Company

String

 

 

 

Company name.

 

Fax

String

 

 

End user fax.

 

Language

String

 

 

Language [ISO639-2] the Avangate system uses for communications.

SKU

String

 

Stock keeping unit you defined.

DeliveryInfo

Object

 

The object contains information about the delivery/fulfillment made to the customer.

 

Description

String

 

 

Delivery description.

 

Codes

Array of objects

 

 

Code

String

 

 

 

Activation key/license code of the first order from this subscription. Use getSubscriptionHistory method if you want to retrieve the activation keys/license codes for all orders belonging to a subscription.

 

 

Description

String

 

 

 

Code description for dynamic lists from your key generator. 

 

 

ExtraInfo

Object

 

 

 

Info set by your key generator for dynamic lists only.

 

 

 

CodeExtraInfo

Object

 

 

 

Type

String

 

 

 

Label

String

 

 

 

Value

String

 

 

File

Array of objects

 

 

 

Content

String

 

 

 

 

Content of the file (base64 encoded).

 

 

 

ContentLength

Int

 

 

 

 

File size.

 

 

 

Filename

String

 

 

 

 

The name of the delivered file.

 

 

 

FileType

String

 

 

 

 

The type of the delivered file.

ReceiveNotifications

Boolean

 

1 – Subscribe: Avangate sends subscription notifications to the end user.

0 – Unsubscribe – Avangate does not send subscription notifications to the end user.

Lifetime

Boolean

 

Possible values:

  • True – the subscription is evergreen

False – the subscription has a recurring billing cycle less than or equal to three years.

PartnerCode

String

 

  • Empty: for ecommerce orders

Partner Code

AvangateCustomerReference

Int

 

Unique, system-generated customer identifier.

ExternalCustomerReference

String

 

Customer identifier that you control.

TestSubscription

Boolean

 

True for test subscriptions, false otherwise.

IsTrial

Boolean

 

True for trial subscriptions, false otherwise.

MerchantCode String
  Unique, system-generated ID in the Avangate system.

 

Place new partner orders

Overview

When placing an order on behalf of your partners, you can purchase new products in addition to upgrades and subscription renewals.

Requirements

  • It's mandatory to associate products to price lists. Do this by connecting a single or multiple pricing configurations of the items you sell through 2Checkout with a price list. You also have to assign price lists to the partners that you want to be able to access your offerings. Products that are not part of price lists assigned to partners will not be available for purchase.
  • The new purchase option is only available for active subscriptions/licenses, and not for disabled products.

Place new partner orders

  1. Go to Orders & customers -> Place partner order.
  2. Select the partner for which you're placing the order, 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. You'll now get the possibility to order a new license, a renewal or an upgrade.
  4. Select the desired price list under the New license area.
  5. On the next page, choose the product for your order from the drop down menu. You will now be able to customize your order using values such as quantity, and additional settings (if available). Once finished, click the Add to cart button.
  6. Click Add more products to be redirected to the Edit Order screen where you can select additional products from the same pricing list as the last added to chart.
  7. Click the Change link to add products from different pricing lists.
  8. Click Add to cart.
  9. When you place orders on behalf of your partners, their value will automatically be deducted from the amount of available credit you awarded them with, provided that you configured a Credit limit for partner accounts.
  10. View Shopping Cart - You can now introduce an External Reference No. / PO, remove some or all items in the cart, change quantity details, add more products, and even leave a comment for the order that your partners will be able to read, by editing orders that haven't been placed. The Comments field supports direct communication with your partner. Any comments added will become part of the order information once you hit the Place order button. If the partner posts a reply, then a new comment is added and will be available in this area. Additional comments can be introduced by editing orders once they have been placed. Make sure to also enter a value for the External Reference No. / PO, if you want your order to have one. The parameter you introduce in this field will be visible both to you and to the partner, and synchronized across both Control Panels.
  11. Add extra margin / discount: To edit the discount details of a partner order you need to select Order search in the left hand side pane of the Vendor Control Panel, click on Partner orders and filter existing items to show only those with the Pending approval status. You can always also just search for a partner order, if you have specific details on hand. Once you identified the order you'd like to refresh, click View and then Edit Order. Additional information is available here.
  12. Attach end user information - Please read Require end user information for partner (reseller) orders for guidance and Require end user information before placing the order for the steps detailing the process.
  13. Place Order - click on the Place Order button once all the details of your order are finalized.
  14. Order confirmation - orders placed by you on the behalf of your partners are approved automatically.
  15. Attach end user information - Please read Require end user information for partner (reseller) orders for guidance and Require end user information after placing the order for the steps detailing the process.
  16. Partners have to provide the necessary details to push the order to the delivery/fulfillment stage, but you can also provide the details if you have them.
    • Alternatively, fulfillment be done exclusively to partners, leaving them to deal with their customers, and in this case, no additional info is required.
    • When the system configuration is set to distribute products/keys to end users, customers are required to first register ahead of delivery/fulfillment.
  17. Attach reseller information - You'll need to provide reseller information for the order to move to the delivery/fulfillment stage, if the reseller information is required according to the Partner's commercial settings. Partners are required to enter the necessary information to push the order to the delivery/fulfillment stage, but you can also provide the details if you have them.
  18. You can view and search through the full list of your partner resellers by clicking the View partner resellers button at the bottom of the Partners page.
  19. Partner invoices - Partner invoices can be generated manually or automatically, depending on 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 and only then will the process advance to the delivery/fulfillment stage. To manually issue a partner invoice, navigate to Partner partner invoices under Orders & customers.
  20. Click on 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.
  21. Hit 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.
  22. 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.
  23. Cancelling an order: To cancel an order make your way to Partner orders under Order search and identify the item you'd like to call off. Click to view the order, and get access to the Cancel button on the next screen. Cancelling orders automatically disables all associated licenses.

FAQ

  • Can I edit pricing details for placed orders?

Yes. If no partner was generated then you'll be able to add extra margin and to increase the discount. When the partner was already issued you'll need to first cancel it to edit the order's extra margin and discount.

  • How is the upgrade price calculated?

The upgrade price is calculated according to the upgrade settings and then applied to the upgrade promotion on the resulted price.

  • How is the price calculated when applying an extra promotion?

Applying an extra promotion to the final price of a product in the Channel Manager shopping cart will discount the price further.

  • What happens when you add extra margin?

Adding extra margin means that a particular partner will benefit from an extra discount applied to an order. The extra margin can be cumulated with an extra discount.

Generate SKU Schema

Overview

Stock keeping unit or SKU is a number assigned to a particular product by a digital or physical retail store for easy identification and inventory tracking purposes. The SKU number is a string of alphanumeric characters that uniquely identify details such as price, product options and manufacturer of a particular product or service. SKUs are used in order notifications, electronic delivery, export files, etc.

SKU Management

For companies that manage large product catalogs with defined SKUs and that make regular changes to their prices and products (new versions, new options), the manual process performed in the Merchant Control Panel needs to be supported by an automatic solution as well. By using an automated flow, merchants decrease the time needed for this process, and also reduce the risk of human errors associated with the manual process.

In the 2Checkout platform, SKUs can be associated with a unique combination made up of:

  • Product identification element
  • Pricing configuration
  • Plus minimum one of the following:
    • Currency – defined as applicable to all currencies or only to specific ones
    • Volume Discounts – defined as specific quantity or intervals (applicable only according to the volume discounts that are defined at pricing configuration level)
    • Purchase Types – possible values: new purchase, renewal, upgrade and trial
    • Pricing Options – will be available considering the pricing option groups assigned to the selected pricing configuration

 

Subscription

Overview

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

Retrieve a subscription                              Search subscriptions

Retrieve customer's subscriptions          Retrieve specific subscriptions

Subscription object

Parameters Type/Description
SubscriptionReference String
  Unique, system-generated subscription identifier.
StartDate String
 

Subscription start date(YYYY-MM-DD) - represents the date since the subscription became active. It might be greater or at least equal to the subscription start(creation/purchase) date. While not reached, the subscription has a pending activation status.

StartDate is mandatory when importing subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the StartDate you provide must be in accordance with your custom configuration.

ActivationDate String
  Subscription activation date (YYYY-MM-DD) ActivationDate is optional when updating subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the ActivationDate you provide must be in accordance with your custom configuration.
ExpirationDate String
  Subscription expiration date(YYYY-MM-DD) - ExpirationDate is mandatory when importing subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the ExpirationDate you provide must be in accordance with your custom configuration.
RecurringEnabled Boolean
 

Possible values:

TRUE – recurring billing/automatic subscription renewals enabled

FALSE– recurring billing/automatic subscription renewals disabled

NextBillingDate Date
  The date when the client will be billed next (ISO 8601).
SubscriptionEnabled

Boolean

Possible values:

TRUE –subscription enabled

FALSE–subscription disabled

Product Required (object)
  The product for which Avangate generated the subscription. Details below.
  ProductCode String
    Unique product identifier that you control.
  ProductId Int
    Unique, system-generated product identifier.
  ProductName String
    Product name.
  ProductQuantity Int
    Ordered number of units.
  ProductVersion String
    Product version.
  PriceOptionCodes Array
    The product options codes the customer selected when acquiring the subscription. Pricing options codes are case sensitive.
EndUser Object
  The end user of the subscription. Details below.
  Person Object
    FirstName String
      End user's first name
    LastName String
      End user's last name
    CountryCode String
      End user country code [ISO3166-1 Alpha 2].
    State String
      End user state.
    City String
      End user city.
    Address1 String
      End user first address line.
    Address2 String
      End user second address line.
    Zip String
      End user zip code.
    Email String
      End user email address.
    Phone String
      End user phone number.
    Company String
      Company name.
    Fax   String
    End user fax.
    Language   String
    Language [ISO639-2] the Avangate system uses for communications.
SKU String
  Stock keeping unit you defined.
DeliveryInfo Object
  The object contains information about the delivery/fulfillment made to the customer.
  Description String
    Delivery description.
  Codes Array of objects
    Code String
      Activation key/license code of the first order from this subscription. Use getSubscriptionHistory method if you want to retrieve the activation keys/license codes for all orders belonging to a subscription.
    Description String
      Code description for dynamic lists from your key generator. 
    ExtraInfo Object
      Info set by your key generator for dynamic lists only.
      CodeExtraInfo Object
      Type String
      Label String
      Value String
    File Array of objects
      Content String
        Content of the file (base64 encoded).
      ContentLength Int
        File size.
      Filename String
        The name of the delivered file.
      FileType String
        The type of the delivered file.
ReceiveNotifications Boolean
 

1 – Subscribe: Avangate sends subscription notifications to the end user.

0 – Unsubscribe – Avangate does not send subscription notifications to the end user.

Lifetime Boolean
 

Possible values:

  • True – the subscription is evergreen

False – the subscription has a recurring billing cycle less than or equal to three years.

PartnerCode String
 
  • Empty: for ecommerce orders
  • Partner Code
AvangateCustomerReference Int
  Unique, system-generated customer identifier.
ExternalCustomerReference String
  Customer identifier that you control.
TestSubscription Boolean
  True for test subscriptions, false otherwise.
IsTrial Boolean
  True for trial subscriptions, false otherwise.
MerchantCode String
  Unique, system-generated ID in the Avangate system.

Authentication

Overview

Use the login method for the authentication process in the 2Checkout system.

Parameters

Parameters Type/Description
merchantCode required (string)
  Your merchant identifier (received from 2Checkout).
date required (string)
  UTC ISO Date format (e.g. 2010-01-01 12:13:14)
hash required (string)
  Calculated HMAC_SHA256 signature based on MerchantCode and Date, using your secret key (see example below).

Response

Parameter Type/Description

sessionID

string

  Session identifier string. An exception will be thrown if the values are incorrect. The sessionID expires in 10 minutes.

Request

To create the HMAC_SHA256 source string use your merchant code (available here) and the date of the request, prefixing them with the length in bytes of each respective value, along with your account’s secret key (for UTF-8 characters the length in bytes might be longer than the string length). For example:

Parameters Type/Description

merchantCode

Avangate

 

8AVANGATE

 

date

2010-05-13 12:12:12

 

192010-05-13 12:12:12

 

HMAC source string

8AVANGATE192010-05-13 12:12:12

 

 

 

Secret key

SECRET_KEY

 

 

Calculated HMAC_SHA256 signature based on MerchantCode and Date, using your secret key:

bf763db7d333e9c3038698cf59ada3e6

Request Example 

<?php

/**
 * @throws JsonException
 */
function callRPC($Request, $hostUrl)
{
    $curl = curl_init($hostUrl);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Accept: application/json']);
    $RequestString = json_encode($Request, JSON_THROW_ON_ERROR);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);

    $ResponseString = curl_exec($curl);

    if (!empty($ResponseString)) {
        $Response = json_decode($ResponseString, false, 512, JSON_THROW_ON_ERROR);
        if (isset($Response->result)) {
            return $Response->result;
        }
        if (!is_null($Response->error)) {
            echo("Method: {$Request->method}" . PHP_EOL);
            echo("Error: {$Request->error}" . PHP_EOL);
        }
    } else {
        return null;
    }

    return null;
}

$host = 'https://api.avangate.com/channel-manager/2.1/rpc/';

$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

$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$algo = 'sha256';
$hash = hash_hmac($algo, $string, $key);

$i = 1; // counter for api calls
// call login
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = [$merchantCode, gmdate('Y-m-d H:i:s'), $hash, $algo];
$jsonRpcRequest->id = $i++;

try {
    $sessionID = callRPC($jsonRpcRequest, $host);
    echo("Auth token: {$sessionID}" . PHP_EOL);
} catch (JsonException $e) {
    echo("Error: {$e->getMessage()}" . PHP_EOL);
} 

Errors

Error Description

AUTHENTICATION_FAILED

Authentication failed

FORBIDDEN

Forbidden area

 

Pricing option

Overview

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

Pricing option group

Parameters Type/Description
Name String
 

Price option group name.

 

Use this parameter when adding a new price options group.

 

To edit the name of a price option group use the Name parameter under the Translations object.

Description String
    Pricing option group description.
Translations Array of objects
    Details below.
  Name String
   

Localized product pricing options group name under PriceOptionGroup.

Localized pricing option child name under Options.

  Description String
   

Localized product pricing options group description underPriceOptionGroup.

Localized pricing option child description under Options.

  Language String
    ISO language code. (ISO 639-1 two-letter code).
Code String
    Unique code that The 2Checkout system generates or set for each pricing options group.
Type String
   

The type of the pricing options group. Possible values:

· RADIO

· CHECKBOX

· INTERVAL

· COMBO

Options Array of PriceOption objects
    Details below.
                                                   PriceOption Object
  Code String
    The code you set or that the 2Checkout system generated for each pricing option child inside a pricing options group parent.
  ScaleMin Int
    The minimum value of a scale interval set for each pricing option child inside a pricing options group parent of the type INTERVAL.
  ScaleMax Int
    The maximum value of a scale interval set for each pricing option child inside a pricing options group parent of the type INTERVAL.
  SubscriptionImpact SubscriptionLifetimeImpact object
    Details below.
                      Months String
    The value in months the 2Checkout system adds or subtracts from the initial billing cycle of a subscription.
                       Impact String
   

Possible values:

· ADD

· SUBTRACT

· LIFETIME

  PriceImpact Object
    Details below.
                    ImpactOn String
   

Possible values:

  • BASE corresponding to impact on base price
  • GLOBAL for impact on calculated sum.
                    Impact String
   

Impact on price per unit:

  • ADD
  • SUBTRACT
                     Percent String
    The value of the percentage out of the price per product unit, when you usePERCENT for Method.
                      Method String
   

Possible values:

· PERCENT

· FIXED

                      Amounts Array of objects.
    Details below.
                               Currency String
    Currency ISO code - ISO 4217.
                                Amount String
    The amount defined for each specific currency active for your account, when you use FIXED for Method.
  Default Boolean
   

TRUE for preselected options.

Missing for options that are not preselected.

  Name String
    Pricing option child name.
  Description String
    Pricing option child description.
  Translations Array of objects
    Details below.
Usage  

String.

Defines the type of pricing for scale product options. Can be either regular (tiered pricing) or payperusage (metered billing).

 

 

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