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
- Installments are available only for:
- Brazilian customers
- Local Visa, MasterCard or AMEX cards
- Non-recurring transactions
- Minimum installment threshold is 5 BRL. Maximum number of installments is 6.
- 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?
- Create the Order object.
- Validate the number of installments available based on total order value.
- Place the order specifying the number of installments.
Funds collection for installment payments
Avangate pays you in full, regardless of the number of installments (this is covered directly by the banks).
Orders with installments
Overview
2Checkout supports local Brazilian Visa, MasterCard and AMEX credit / debit cards limited to national purchases in the local currency BRL (Brazilian Real).
Requirements
- Installments are available only for:
- Brazilian customers
- Local Visa, MasterCard or AMEX cards
- Non-recurring transactions
- Minimum installment threshold is 5 BRL. Maximum number of installments is 6.
- 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 2Checkout for activation.
How does it work?
- Create the Order object.
- Validate the number of installments available based on total order value.
- 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).
Retrieve session content
Overview
Use the getContents method to get info on all the products added to cart by the shopper in the current session. Products can be either defined in the catalog, or created with dynamic information.
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. |
|
Order |
Required (Object) |
|
|
Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. |
Response
| Parameters | Type/Description |
|---|---|
| SessionContents | Object (for orders with catalog products) |
| SessionContents | Object (for orders with dynamic products) |
Request
<?php
require('PATH_TO_AUTH');
$Order = new stdClass();
$Order->RefNo = NULL;
$Order->Currency = 'usd';
$Order->Country = 'US';
$Order->Language = 'en';
$Order->CustomerIP = '91.220.121.21';
$Order->ExternalReference = NULL;
$Order->Source = NULL;
$Order->AffiliateId = NULL;
$Order->CustomerReference = NULL;
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1'; // you can also send products with dynamic information
$Order->Items[0]->Quantity = 1;
$Order->Items[0]->PriceOptions = NULL;
$Order->Items[0]->SKU = NULL;
$Order->Items[0]->Price = NULL;
$Order->Items[0]->CrossSell = NULL;
$Order->Items[0]->Trial = false;
$Order->Items[0]->AdditionalFields = NULL;
$Order->Items[0]->Promotion = NULL;
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'FirstName';
$Order->BillingDetails->LastName = 'LastName';
$Order->BillingDetails->CountryCode = 'us';
$Order->BillingDetails->State = 'California';
$Order->BillingDetails->City = 'LA';
$Order->BillingDetails->Address1 = 'Address example';
$Order->BillingDetails->Address2 = NULL;
$Order->BillingDetails->Zip = '90210';
$Order->BillingDetails->Email = 'customer@email.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'TEST';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->PaymentDetails->CustomerIP = '10.10.10.10';
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = true;
$Order->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";
$Order->PaymentDetails->PaymentMethod->CardType = 'visa';
$Order->PaymentDetails->PaymentMethod->ExpirationYear = '2019';
$Order->PaymentDetails->PaymentMethod->ExpirationMonth = '12';
$Order->PaymentDetails->PaymentMethod->HolderName = 'John';
$Order->PaymentDetails->PaymentMethod->CCID = '123';
$Order->Promotions = NULL;
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;
$jsonRpcRequest = array (
'method' => 'getContents',
'params' => array($sessionID, $Order),
'id' => $i++,
'jsonrpc' => '2.0'
);
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
Subscription upgrade
Overview
Retrieve information about the upgrade options for a specific subscription.
Trigger upgrade for your existing subscriptions, or set external references to a subscription by using the API methods displayed below.
Place a renewal order
Overview
Renew a subscription and collect recurring revenue using the 2Checkout Subscription Reference. You can renew subscriptions for both catalog and dynamic products. The only requirement is to provide a valid subscription reference.
Requirements
To place a renewal order, you need to provide a valid subscription reference number.
Payment methods
You can place renewal orders using the following payment methods:
- Credit cards
- PayPal
- WeChat Pay
- iDEAL
- Purchase Order
- Wire
Use the PaymentDetails object to change the payment method used in the ordering process.
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. | |
| Order | Required (Object) |
|
Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. To place an order with PayPal rather than PayPal Express, use PAYPAL as the type of the PaymentDetails object and send the shopper email and a return URL as part of the PaymentMethod object. See code sample. |
|
| SubscriptionReference |
Required (String) 2Checkout generated subscription reference number. E.q. A8C5671BFE. |
Response
| Parameters | Type/Description |
|---|---|
| Order information | Object |
Request
<?php
require ('PATH_TO_AUTH');
$Order = new stdClass();
$Order->Currency = 'USD';
$Order->Language = "EN";
$Order->Country = 'US';
$Order->CustomerIP = '91.220.121.21';
$Order->Source = "sourceAPI.net";
$Order->LocalTime = date('Y-m-d H:i:s');
$Order->Items = array();
/**/
$Order->Items[0]->RenewalInformation = new stdClass();
$Order->Items[0]->RenewalInformation->SubscriptionReference = 'A8C5671BFE'; //subscription used in the renewal process
$Order->Items[0]->Price = new stdClass();
$Order->Items[0]->Price->Type = 'CUSTOM';
$Order->Items[0]->Price->Amount = '10';
$Order->Items[0]->PriceOptions = array('uniqscale1=4');//
$Order->MachineId = "MachineID";
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->Address1 = 'Bil1ing address';
$Order->BillingDetails->Address2 = 'Billing address 2';
$Order->BillingDetails->City = 'Billing City';
$Order->BillingDetails->State = 'Billing State';
$Order->BillingDetails->CountryCode = 'US';
$Order->BillingDetails->Phone = 1231232123;
$Order->BillingDetails->Email = 'customer_details@test.com';
$Order->BillingDetails->FirstName = 'First';
$Order->BillingDetails->LastName = 'Customer';
$Order->BillingDetails->Company = 'Billing Company';
$Order->BillingDetails->Zip = '55104';
$Order->DeliveryDetails = new stdClass();
$Order->DeliveryDetails->Address1 = 'Bil1ing address';
$Order->DeliveryDetails->Address2 = 'Billing address 2';
$Order->DeliveryDetails->City = 'Billing City';
$Order->DeliveryDetails->State = 'Billing State';
$Order->DeliveryDetails->CountryCode = 'US';
$Order->DeliveryDetails->Phone = '12345';
$Order->DeliveryDetails->Email = 'customer_details@test.com';
$Order->DeliveryDetails->FirstName = 'First';
$Order->DeliveryDetails->LastName = 'Customer';
$Order->DeliveryDetails->Zip = "55104";
$Order->PaymentDetails = new stdClass();
$Order->PaymentDetails->Type = "CC";
$Order->PaymentDetails->Currency = $currency;
$Order->PaymentDetails->PaymentMethod = new stdClass();
/**/
$Order->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";
$Order->PaymentDetails->PaymentMethod->CardType = "VISA";
$Order->PaymentDetails->PaymentMethod->ExpirationYear = "2019";
$Order->PaymentDetails->PaymentMethod->ExpirationMonth = "12";
$Order->PaymentDetails->PaymentMethod->CCID = "123";
$Order->PaymentDetails->PaymentMethod->HolderName = "John Doe";
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = TRUE;
$Order->PaymentDetails->PaymentMethod->HolderNameTime = 1;
$Order->PaymentDetails->PaymentMethod->CardNumberTime = 1;
/**/
try {
$newOrder = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
echo "newOrder: " . $e->getMessage();
exit;
}
var_dump("newOrder", $Order);
Trial expiration notification
Use the variables in the list below to customize the Trial expiration notification 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 |
|---|---|---|---|
| AVANGATE_LOGO | Avangate logo URL | https://secure.avangate.com/images/e...endor_logo.png | Yes |
| BUSINESS_COMPANY | BUSINESS_COMPANY | Avangate | Yes |
| BUSINESS_SUPEMAIL | BUSINESS_SUPEMAIL | support@avangate.com | No |
| COMMERCIALNAME | COMMERCIALNAME | [Software Company Name] | No |
| [example@customer-email.com] | No | ||
| ENCRYPTED_MERCHANT_CODE | ENCRYPTED_MERCHANT_CODE | 0 | No |
| EXPIRATIONDATE | EXPIRATIONDATE | [2011-01-30] | Yes |
| EXTERNAL_CUSTOMER_REFERENCE | External customer reference | Alphanumeric string | No |
| FIRSTNAME | FIRSTNAME | [John | No |
| FULL_PRICE | FULL_PRICE | [19.99] | Yes |
| LASTNAME | LASTNAME | Doe] | No |
| LICENSE_PERIOD | LICENSE_PERIOD | 6 | No |
| MYACCOUNT_URL | MYACCOUNT_URL | https://secure.avangate.com/myaccoun...m&k=xxxxxxxxxx | Yes |
| PAYMENT_METHOD | PAYMENT_METHOD | 1 | No |
| PRODUCT_NAME | PRODUCT_NAME | [Software Product Name] | Yes |
| REFNO | REFNO | [9xxxxx] | No |
| SELLERWEBSITE | SELLERWEBSITE | http://www.software-company-website.com | No |
| START_DATE | START_DATE | [2011-01-01] | No |
| TECHEMAIL | TECHEMAIL | support@software-company-website.com | No |
| TECHPHONE | TECHPHONE | [888-xxx-xxxx] | No |
| TRIAL_PERIOD | Trial period | 8 | No |
API Migration Guide
Overview
Use this guide to prepare and migrate your 2Checkout API implementation from version 1.0 to 3.0. This document features deprecations, updates and enhancements, providing guidance on how to upgrade your implementation to the latest version of the 2Checkout API.
API 1.0 discontinuation
2Checkout plans to discontinue API 1.0 as of the end of February 2017. The end-of-support date implies ceasing all development of bug fixes and patches for API 1.0.
API 3.0 availability
Version 3.0 of the 2Checkout API is available as of June 2016, following an extensive public testing phase started in November 2015. 2Checkout recommends that you migrate to the latest version of the API (v3.0) to enjoy support for your implementation.
API 3.0 updates and benefits
- Full REST support for existing platform functionalities in addition to SOAP and JSON-RPC.
- Simplify interactions with single-entry point (one endpoint, one client, single-authentication).
- Centralized all previous functionality under 3.0 (plus new capabilities).
-
Unified WSDL for Order, Subscription, and Product scenarios.
Serializations 1.0 vs. 3.0
Single API URL per serialization format
- https://api.avangate.com/rpc/3.0/
- https://api.avangate.com/soap/3.0/
- https://api.avangate.com/rest/3.0/
- https://api.avangate.com/3.0/ redirects to https://api.avangate.com/rest/3.0/ by default
WSDL 1.0 vs. 3.0
When you migrate from API 1.0 to 3.0, stop using https://secure.2checkout.com/api/merchant/?wsdl in favor of https://api.2checkout.com/soap/3.0/?wsdl.
Methods 1.0 vs. 3.0
|
API 1.0 |
Status |
API 3.0 equivalent |
|---|---|---|
|
addLicense |
Updated. Use: |
|
|
addProduct |
Deprecated |
N/A. The placeOrder scenario now requires a single method. |
|
clearProducts |
Deprecated |
N/A. The placeOrder scenario now requires a single method. |
|
deleteProduct |
Deprecated |
N/A. The placeOrder scenario now requires a single method. |
|
disableLicense |
Updated. Use: |
|
|
disableLicenseRecurring |
Updated. Use: |
|
|
enableLicense |
Updated. Use: |
|
|
enableLicenseRecurring |
Updated. Use: |
|
|
extendLicense |
Updated. Use: |
|
|
getAvailableCountries |
Updated. Use: |
getAvailableCountries |
|
getAvailableCurrencies |
Updated. Use: |
getAvailableCurrencies |
|
getAvailableLanguages |
Updated. Use: |
getAvailableLanguages |
|
getContents |
Updated. Use: |
|
|
getInvoice |
Updated. Use: |
|
|
getLicense |
Updated. Use: |
|
|
getLicensePaymentDetails |
Updated. Use: |
getPaymentInformation |
|
getLicenseProductUpgradeOptions |
Updated. Use: |
|
|
getNextRenewalPrice |
Updated. Use: |
|
|
getOrder |
Updated. Use: |
|
|
getOrderStatus |
Updated. Use: |
|
|
getPrice |
Updated. Use: |
|
|
getProductByCode |
Updated. Use: |
|
|
getProductById |
Updated. Use: |
|
|
getProductUpgradeOptionsPrice |
Updated. Use: |
|
|
getRenewalPrice |
Updated. Use: |
|
|
getSingleSignOn |
Updated. Use: |
|
|
getTimezone |
Updated. Use: |
|
|
isValidOrderReference |
Updated. Use: |
|
|
login |
Updated. Use: |
|
|
placeOrder |
Updated. Use: |
|
|
renewLicense |
Updated. Use: |
|
|
searchLicense |
Updated. Use: |
|
|
searchProducts |
Updated. Use: |
|
|
setBillingDetails |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setClientIP |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setCountry |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setCurrency |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setCustomer |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setCustomRenewalPrice |
Updated. Use: |
|
|
setDeliveryDetails |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setExternalRef |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setLanguage |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setLicenseEmailSubscription |
Updated. Use: |
|
|
setLicenseUpgrade |
Updated. Use: |
|
|
setPaymentDetails |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setSource |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
setStaticPrice |
Deprecated. |
N/A. The placeOrder scenario now requires a single method. |
|
updateLicense |
Updated. Use: |
|
|
updateLicenseCustomer |
Updated. Use: |
New use cases API 3.0
Direct Debit UK
Overview
Direct Debit is a payment method in which the bank processes payments by accessing funds from an account when the holder instructs it to do so. It authorizes the organization you want to pay to collect the money from your account, but only after you've been notified of the amounts and dates of collection.
Once you have agreed on the payment details, the money is deducted automatically. If the organization you are paying wants to change an amount or date of collection, they have to notify you before the changes take place.
Currency
Direct Debit UK supports only GBP.
Mandates and E-mandates
Shoppers authorize 2Checkout to collect payments and instruct their banks to pay those collections with mandates.
- 2Checkout uses e-mandates and does not require shoppers to fill in and submit paperwork.
- Mandates expire within 36 months after the last initiated collection.
- 2Checkout stores mandates at least for 14 months after the last collection of funds.
Workflow
To set up payments by Direct Debit UK, the shopper must complete a Direct Debit instruction to you. The instruction makes it clear that shopper allows you to debit their account. The interface for completing the Direct Debit instruction is controlled by 2Checkout. After the shopper fills in the form, 2Checkout sends the data to the payment processor and to the shopper's bank, via BACS.
Direct Debit UK orders take 21 calendar days to be confirmed. During this interval, shoppers can cancel their order regardless of the reason and receive a refund.
The Direct Debit UK rules allow the instructions to be completed by using an online application form.
Purchase flow
- Shoppers fill in the billing information, select United Kingdom as the billing country and choose Direct Debit UK as the payment option. Before they can continue, there are two mandatory questions that they need to answer to confirm the ownership of the bank account.
- Shoppers fill in the Direct Debit UK payment details.
- They confirm the payment details. Important: If the details are incorrect, they can edit them.
- The order is finalized. Important: Shoppers can print the order details if needed.
- 2Checkout sends the Advance Notice Letter to the shoppers informing them about the payment details.
- The payment is processed and the money is deducted from the shoppers' account.
Emails
2Checkout sends the Advance Notice Letter email to shoppers upon placing the order.
Order statuses
Once the shoppers place an order, 2Checkout shows it as In progress / Processing. Following the fulfillment, the order status changes to COMPLETE. If the shopper's bank rejects the payment, the order shows up as Canceled.
Refunds
2Checkout only offers support for full refunds for orders paid for via Direct Debit UK. Partial refunds are not supported.
Shoppers can ask for a "no-questions-asked" refund right during the eight weeks (56 days) following the debiting of a shopper's account. This period is extended to 13 months for unauthorized Direct Debit collections.
Additional order fields
Overview
Use this object to create / update information on additional order/product fields.
Parameters
| AdditionalField | Object |
|---|---|
| Label | String |
| Field text. | |
| Code | String |
| Field identifier. Alpha-numeric chars, underscores and dashes. | |
| Type | String |
|
Field type:
|
|
| ApplyTo | Sting |
|
|
| Values | Array of values |
| Custom values you control. | |
| ValidationRule | String |
| The validation rule restricting the type of information shoppers can enter in the additional field during the purchase process. | |
| Translations | Array of objects |
| Details below. | |
| Label | String |
| Field text translated in the language of the Translations object. | |
| Values | Object |
| Custom values you control translated in the language of the Translations object. | |
| Language | String |
| ISO language code. (ISO 639-1 two-letter code). |