Skip to main content

Transition Guide for 2CO Sandbox

Overview

In 2Checkout's legacy checkout system, we have always supported the demo parameter to test the checkout process without actually creating an order. In 2014, we introduced our sandbox environment to provide merchants with a way to completely test the order lifecycle through their API and INS integration.

Over the past couple of years, we have been working to integrate the legacy platform with our new platform's test ordering system so that our merchants can fully test their integration without the need for a separate sandbox account. Since there is no longer a need for it, we are decommissioning the legacy sandbox environment and ask that all remaining sandbox users transition their testing to our test ordering system.

If you are not using 2Checkout's legacy sandbox platform there is no need to read further. We are not making any changes to our production environment.

Demo/Test Ordering System

To place a test order with 2Checkout's legacy checkout system using your production account, you just need to pass the demo parameter with a value of `Y` as we have always supported.

Example

https://www.2checkout.com/checkout/purchase?sid=your-seller-id&mode=2CO&li_0_name=test&li_0_price=1.00&demo=Y
Form:
<form action='https://www.2checkout.com/checkout/purchase' method='post'>
<input type='hidden' name='sid' value='your-seller-id' />
<input type='hidden' name='mode' value='2CO' />
<input type='hidden' name='li_0_name' value='test' />
<input type='hidden' name='li_0_price' value='1.00' />
<input type='hidden' name='demo' value='Y' />
<input name='submit' type='submit' value='Checkout' />
</form>

Example

You can then use the data detailed in this article to test each use case.

To place a test order with 2Checkout's legacy Payment API, just add the demo property to the root of your JSON payload with a value of TRUE.

https://www.2checkout.com/checkout/api/1/your-seller-id/rs/authService

{
    "sellerId": "your-seller-id",
    "privateKey": "your-private-key",
    "merchantOrderId": "123",
    "token": "customer-client-side-token",
    "currency": "USD",
    "total": "0.01",
    "billingAddr": {
        "name": "John Doe",
        "addrLine1": "123 Test St",
        "city": "Columbus",
        "state": "Ohio",
        "zipCode": "43123",
        "country": "USA",
        "email": "example@2co.com",
        "phoneNumber": "5555555555"
    },
    "demo": true
}
Some legacy accounts may have demo mode disabled. If you are having any problems placing demo orders, contact 2Checkout for assistance.

Test Order Management

To locate your Test orders, log in to your Merchant Control Panel and navigate to Orders & Customers → Order Search, and use the 'Test orders' filter, as shown in this image.

test orders cPanel.png

Test orders can be refunded or re-billed (recurring sales) and will send all necessary INS messages just like production orders. More information on the 2Checkout test ordering system can be found in our Knowledge Center.

 

 

Recommended resources

 

Pricing configuration

Overview

Use this object to add/create and update/edit pricing configurations for your account. You can assign one or multiple price option groups to pricing configurations.

You identify a pricing configuration using its unique identifier: Code.

Parameters

Parameters Type/Description

Name

String

 

Pricing configuration name.

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.

 

Special price promotions

Overview

Create Special price promotions and define the final order price your customers will pay considering any pricing options or volume discounts configured on the product. Use Special promotions to have full control over the discounted price displayed to your customers.

Benefits

  • Increase average order value through better incentives
  • Improve customer satisfaction by offering the products at the right price
  • Extended control over the prices displayed throughout the entire buying experience

Availability

Special price promotions are enabled by default on all 2Checkout accounts.

Limitations

Special price promotions are available through the ConvertPlus ordering flow. API support for creating Special price promotions is not available at this moment.

Once a product is added to a Special price promotion, you cannot update its price, or its volume discounts setup. To update the pricing configuration of a product that is part of an active campaign, remove the product from the promotion and then update its price.

Special price promotions are not available in the Affiliates Network.

How it works

Special price promotions allow you to control the final price paid by the customers, taking into account product pricing configurations/options or volume discounts that may be applied to the order.

Gross / Net product price

If 2Checkout handles the management of taxes on your behalf, then you are able to create products with gross price type (the product price includes the tax/VAT to be collected from the customers). When adding products with gross price type in a Special price promotion, you are able to control the final order price paid by customers including taxes. 

Example: Product 2Checkout Monthly Subscription costs $19.99 (including taxes). Let's say a 19% VAT is applied based on customer location. If no promotion is applied, the cart price is:

with out special promo.png

Now let's use a Special price promotion to define a final order price of $14.99 for product 2Checkout Monthly Subscription. The Special price promotion takes into account the 19% VAT applied to the order and the total order price displayed is $14.99 (including taxes):

special price promotion.png

Pricing options / Volume discounts

When creating a Special price promotion, you are able to define the final price your customers will pay for each pricing configuration configured. A price matrix is available for defining the order price based on the volume discounts/pricing options set on the product.

The values from the fields left blank are auto-converted by 2Checkout based on exchanged rates from the European Central Bank, from the previous day.

special price promotion - price matrix

Adding a Special price promotion

To create a Special price promotion, follow the below steps:

  1. Go to Marketing Tools > Promotions.
  2. Click on the Special price promotions tab.
  3. Click Add Special price promotion.
  4. Give the promotion a suggestive title and description. Shoppers can see the promotion title during purchase.
  5. Select when you want the promotion to run. You can limit promotions to a specific time interval or let them run indefinitely. To start a promotion as soon as you mark it Active, leave the start date empty. If you don't set the end date, the promotion will stop when the maximum number of orders has been reached or will continue to run if the maximum number of orders is unlimited.
  6. Choose the coupon/voucher type:
    • Single - one voucher to impact multiple orders;
    • Multiple - individual and unique, pre-order vouchers.
  7. Choose whether to restrict the promotion to a number of orders, or apply it for all orders. This option is only available for single coupons.
  8. Choose whether or not to limit the promotion based on the product quantity. Any product quantity above this limit will be sold at full price.
  9. Set the default currency of the promotion. 
  10. Fill in the promotion coupon/voucher code. The maximum length of a coupon code is 255 alphanumeric characters.
    • Single: enter the coupon values manually
    • Multiple: either add the values manually one coupon per line or use the coupon generator available in the Control Panel to generate 5, 10, 20, 30, 50 or 100 vouchers at a time and either append them to an existing list or replace existing items. The generator creates random vouchers that resemble this: D8C10E32. 2Checkout recommends limiting the number of coupon codes to a maximum of 25000.
  11. Choose whether or not to apply discounts automatically. Only available for single coupons. This option applies discounts to all selected products in all orders, without the need for shoppers to enter the coupon manually.
  12. Apply promotion to recurring charges. You can apply it to none, to one recurring charge, to all or to a specific number of recurring charges after which the renewal price is recalculated.
  13. Select the products to be included in the promotion.
  14. Select the pricing configurations for which the promotion should apply.
  15. Add the special promotional prices that should be displayed to end-users, when the promotion is active in cart. Filling in the price for the default currency is mandatory. Use the price matrix to define the price for each pricing option/volume discounts threshold active on the product. Set the amount for all currencies, or leave them empty and let 2Checkout convert the amounts automatically.

 

Extract invoices

Overview

Use the getInvoices method to extract shopper invoices from the Avangate system based on unique order references. The method returns the binary code for invoices in the PDF file format, Base64 encoded (Base64 is used to represent binary data in the ASCII string format).

getInvoices works for COMPLETE orders for which an invoice was already issued. For refunded orders, getInvoices provides two shopper invoices, one for the original order and the second for the refund, reflecting the repayment made.

In the case of cross-selling orders which contain products from different merchants, getInvoice enables you to re-send only the invoices for your own offerings.

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.

RefNo

Required (string)

 

Unique, system generated reference for orders.

Response

InvoicesData

Array of objects

 

 

Details below.

 

Sale

String

 

 

Base64 encoded PDF file containing an invoice for a Complete order.

 

Cancellation

String

 

 

Base64 encoded PDF file containing a cancellation invoice.

 

Refunds

Array of string

 

 

Base64 encoded PDF files containing invoices for Refunds.

Request


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

function hmac($key, $data)
{
    $b = 64; // byte length for md5
    if (strlen($key) > $b) {
        $key = pack("H*", md5($key));
    }
    
    $key    = str_pad($key, $b, chr(0x00));
    $ipad   = str_pad('', $b, chr(0x36));
    $opad   = str_pad('', $b, chr(0x5c));
    $k_ipad = $key ^ $ipad;
    $k_opad = $key ^ $opad;
    return md5($k_opad . pack("H*", md5($k_ipad . $data)));
}
$merchantCode = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.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.avangate.com/cpanel/account_settings.php
$now          = gmdate('Y-m-d H:i:s'); //date_default_timezone_set('UTC')
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash   = hmac($key, $string);
try {
    $sessionID = $client->login($merchantCode, $now, $hash);
}
catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage();
    exit;
}
$Reference = '43997639';
try {
    $invoices = $client->getInvoices($sessionID, $Reference);
}
catch (SoapFault $e) {
    echo "invoices: " . $e->getMessage();
    exit;
}
var_dump("invoices", $invoices);

Partner

Overview

Use the Partner object to search and retrieve partner information.

Structure

Partner Object
PartnerCode String
  Unique identifier that you need to specify when creating a partner in the Control Panel. You can find it under the General Information area when editing partner details.
CompanyName String
  The name of your partner company.
Email String
  The partner email address specified in the Contact Information area.
CommunicationLanguage String
 

ISO 639-1 two-letter language code set for the communication language under Contact information.

Case sensitive: 'en' instead of 'EN'.

 

Possible values:

  • en
  • fr
  • de
Currency String
  The ISO code of the currency set for the partner - ISO 4217. This currency governs transactions between you and the partner. You can configure it in the Commercial settings section, under Payment information.
CreditLimit double
  The credit limit set for the partner. Can be NULL when no credit is offered.
AvailableCreditLimit double
  The credit still available to the partner, after the value of orders already placed but not paid was deducted from the total credit limit configured. Can be NULL when no credit limit is defined.

 

Account Payouts

Overview

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

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

 

 

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