Leveraging a commerce blueprint for digital business success
In just a few short years, we have witnessed an explosion of new touchpoints (mobile, social, in-app, etc.) and new payment methods (Bitcoin, Apple Pay, etc.). Investments that were made for eCommerce are already obsolete and need to keep pace with the needs of a global, digital business. 2Checkout and Featured Guest Forrester Research, Inc. talk about:
Watch our informative session with guest speaker Peter Sheldon, VP, and Principal Analyst at Forrester Research, and walk away with actionable insights that you can apply immediately. |
![]() |
Product group
Overview
This object is returned directly or within a successful response from the following API requests:
Retrieve product group Retrieve product groups
Product group object
Parameters | Type/Description |
---|---|
Name |
Required (string) |
|
The name of the product group. |
Code | Optional (string) |
Unique, system-generated identifier assigned to product groups. | |
TemplateName |
Optional (string) |
|
Leave empty to assign the Default Template to the product.
Or use the name of an active shopping cart template. |
Description |
Optional (string) |
|
The description of the product group. |
Place an order
Overview
Use the placeOrder method to create an order and collect the payment.
Supported payment methods
- Credit/Debit cards: Visa, Visaelectron, MasterCard, Maestro, Amex, Discover, Dankort, Cartebleue, JCB. 2Checkout supports local Brazilian cards.
- PayPal and PayPal Express
- Puchase Order
- Wire
- Check
- iDEAL
- Previous order references - In addition to the payment methods enumerated above, 2Checkout also supports 1-click purchase flows in which you use valid previous order references belonging to returning customers to pay for new orders with their previously used cards and PayPal accounts.
For anti-fraud purposes, 2Checkout limits the number of successive purchases made using the same credit card.
Requirements
As reseller of your products, 2Checkout must validate your compliance with the PCI requirements, making sure you meet Payment Card Industry (PCI) standards when using the New Purchase 2Checkout API. You alone control the level of complexity of your PCI compliance.
Details on some of the most frequent PCI compliance levels for ecommerce businesses and the associated steps you need to follow to obtain the compliance and be able to start using the New Purchase 2Checkout API are available here: New Purchase Avangate API PCI DSS Requirements.
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. |
Required (Object) |
|
|
Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. |
Response
Parameters | Type/Description |
---|---|
Object |
Request
<?php
require ('PATH_TO_AUTH');
//The following script lets you place an new order with Credit/Debit cards as the payment method
$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';
$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]->SubscriptionStartDate = NULL; //If empty or null, subscriptions become active when purchase is made.
$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 = 'email@avangate.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'CC';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->CustomerIP = '10.10.10.10';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$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->CardNumberTime = 83.21; // can be null - high value in seconds is a red flag for fraud attempts.
$Order->PaymentDetails->PaymentMethod->HolderNameTime = 13.35; // can be null - high value in seconds is a red flag for fraud attempts.
$Order->PaymentDetails->PaymentMethod->CCID = '123';
$Order->Promotions = NULL;
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;
$jsonRpcRequest = array (
'method' => 'placeOrder',
'params' => array($sessionID, $Order),
'id' => $i++,
'jsonrpc' => '2.0'
);
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
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 and AMEX cards
- Non-recurring transactions
- Minimum installment threshold is 5 BRL. The 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).
Order information object
Overview
Use this object to retrieve information about orders.
Attributes
OrderInformation object parameters |
Type/Description |
|||||||||||||||||||||||||||||||||||
RefNo |
Optional (string) |
|||||||||||||||||||||||||||||||||||
2Checkout generates unique reference numbers for all orders (purchases). You can use this parameter to retry authorizations for orders with failed transactions by changing the payment method.
NULL when you place new orders. |
||||||||||||||||||||||||||||||||||||
OrderNo |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The consecutive order number 2Checkout associates with orders and displays in the Order search area of your account. |
||||||||||||||||||||||||||||||||||||
ExternalReference |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Set external reference identifiers for orders. Enables you to replicate the functionality of the REF parameter included into Buy Links. Maximum 100 characters. If there is a need for longer references, you can apply an md5 hash for any string value, resulting in a 32 characters string. You can verify the hash after the order notification, on the client side. |
||||||||||||||||||||||||||||||||||||
ShopperRefNo |
Optional (string) |
|||||||||||||||||||||||||||||||||||
External shopper identifier. |
||||||||||||||||||||||||||||||||||||
Status |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The status of the order:
|
||||||||||||||||||||||||||||||||||||
ApproveStatus |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The status of the order resulted from the evaluation by the 2Checkout anti-fraud system or by a member of the anti-fraud department. This status varies for new purchases and for orders requiring customers to make manual payments. Possible values:
|
||||||||||||||||||||||||||||||||||||
VendorApproveStatus |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shows if you approved or not a partner order. Possible values:
|
||||||||||||||||||||||||||||||||||||
Language |
Optional (string) |
|||||||||||||||||||||||||||||||||||
ISO 639-1 two-letter code. Language used for the purchase process. Example: “en.” |
||||||||||||||||||||||||||||||||||||
OrderDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Y-m-d H:i:s (2014-05-22 00:12:12) The datetime stamp (in the API time zone defined in cPanel) when customers place their orders. |
||||||||||||||||||||||||||||||||||||
FinishDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Y-m-d H:i:s (2014-05-22 00:12:12) The datetime stamp (in the API time zone defined in cPanel) when the order reach the Complete status.
NULL for order that did not reach the Complete/Finished stage. |
||||||||||||||||||||||||||||||||||||
Source |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The link source for the sales. Enables you to replicate the functionality of the SRC (separate link identifier) parameter when included into Buy Links. Use the SRC parameter to track sale sources. Maximum length 255 characters. Cannot be null. |
||||||||||||||||||||||||||||||||||||
AffiliateSource |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The link source for affiliate referred sales. Similar to the functionality of the SRC (separate link identifier) parameter included into Buy Links, but controlled by the AFFSRC parameter. Affiliates use the AFFSRC parameter to track sale sources for their referrals. Maximum length 255 characters. |
||||||||||||||||||||||||||||||||||||
AffiliateId |
Optional (int) |
|||||||||||||||||||||||||||||||||||
Identifier belonging to affiliates who refer orders. |
||||||||||||||||||||||||||||||||||||
AffiliateName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Affiliate name. |
||||||||||||||||||||||||||||||||||||
AffiliateUrl |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Affiliate website URL from the Affiliate Details. |
||||||||||||||||||||||||||||||||||||
RecurringEnabled |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
true or false, depending on whether the shoppers checked the subscription auto-renewal checkbox or not, during the purchase process. |
||||||||||||||||||||||||||||||||||||
HasShipping |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
true or false, depending on whether the order requires shipping. |
||||||||||||||||||||||||||||||||||||
BillingDetails |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Person |
Object |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
FirstName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper name. |
||||||||||||||||||||||||||||||||||||
LastName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper surname. |
||||||||||||||||||||||||||||||||||||
CountryCode |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper country. ISO 3166 two-letter code. |
||||||||||||||||||||||||||||||||||||
State |
Optional (string) – Required for US, Brazil and Romania |
|||||||||||||||||||||||||||||||||||
The state in the shopper's country. Mandatory when you set the Billing Country to US, Brazil and Romania. Use case insensitive utf8 strings for the full name, or just the two letter code. |
||||||||||||||||||||||||||||||||||||
City |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper city. |
||||||||||||||||||||||||||||||||||||
Address1 |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper address. |
||||||||||||||||||||||||||||||||||||
Address2 |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper address. |
||||||||||||||||||||||||||||||||||||
Zip |
Optional (string) |
|||||||||||||||||||||||||||||||||||
ZIP/ Postal code. |
||||||||||||||||||||||||||||||||||||
|
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper email address. |
||||||||||||||||||||||||||||||||||||
Phone |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper phone number. Mandatory when you set Brazil as the Billing Country. Can be NULL. |
||||||||||||||||||||||||||||||||||||
Company |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Company name. Can be null for end users. When present, you also need to provide the FiscalCode. |
||||||||||||||||||||||||||||||||||||
FiscalCode |
Optional (string) – Required for Brazil |
|||||||||||||||||||||||||||||||||||
• For companies, it needs to be the VAT ID. 2Checkout will validate the value provided and throw an error if the VAT ID is invalid/incorrect when calling setPaymentDetails. When present, you also need to provide the Company name. • Mandatory when the Billing Country is set to Brazil. For Brazilian customers it represents the Fiscal Code (CPF/CNPJ). • Can be null for end users. |
||||||||||||||||||||||||||||||||||||
DeliveryDetails |
Optional (Object) Optional. When missing, 2Checkout uses the same details as for the BillingDetails object. |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Person |
Object |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
FirstName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper name from the delivery details. |
||||||||||||||||||||||||||||||||||||
LastName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper surname from the delivery details. |
||||||||||||||||||||||||||||||||||||
CountryCode |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper country. ISO 3166 two-letter code from the delivery details. |
||||||||||||||||||||||||||||||||||||
State |
Optional (string) – Required for US, Brazil and Romania |
|||||||||||||||||||||||||||||||||||
The state in the shopper's country from the delivery details. Mandatory when you set the Billing Country to US, Brazil and Romania. Use case insensitive utf8 strings for the full name, or just the two letter code. |
||||||||||||||||||||||||||||||||||||
City |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper city from the delivery details. |
||||||||||||||||||||||||||||||||||||
Address1 |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper address from the delivery details. |
||||||||||||||||||||||||||||||||||||
Address2 |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper address from the delivery details. |
||||||||||||||||||||||||||||||||||||
Zip |
Optional (string) |
|||||||||||||||||||||||||||||||||||
ZIP/ Postal code from the delivery details. |
||||||||||||||||||||||||||||||||||||
|
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper email address from the delivery details. |
||||||||||||||||||||||||||||||||||||
Phone |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper phone number from the delivery details. Mandatory when you set Brazil as the Billing Country. Can be NULL. |
||||||||||||||||||||||||||||||||||||
Company |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Company name from the delivery details. Can be null for end users. When present, you also need to provide the FiscalCode. |
||||||||||||||||||||||||||||||||||||
PaymentDetails |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Adapt this object to the desired payment method. |
||||||||||||||||||||||||||||||||||||
Type |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The payment method:
|
||||||||||||||||||||||||||||||||||||
Currency |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The currency ISO code for the payment - ISO 4217. Example: “usd.” |
||||||||||||||||||||||||||||||||||||
PaymentMethod |
Optional (object) |
|||||||||||||||||||||||||||||||||||
Object structure and parameters differ according to payment method selected and API method (placing orders (POST) vs. retrieving order data (GET)). For payments with credit cards, PalPay Express, previous order reference and purchase order use the objects below.
For payments with check and wire, send only the ‘CHECH’ and ‘WIRE’ strings.
null for 0 value orders for which you’re not requiring customers to enter payment details. |
||||||||||||||||||||||||||||||||||||
PaymentDetailsCard |
Optional (object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
CardType |
Optional (string) |
|||||||||||||||||||||||||||||||||||
visa, visaelectron, mastercard, maestro, amex, discover, dankort, cartebleue, jcb, hipercard, elo |
||||||||||||||||||||||||||||||||||||
FirstDigits |
Optional (string) |
|||||||||||||||||||||||||||||||||||
First four digits of the credit card. |
||||||||||||||||||||||||||||||||||||
LastDigits |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Last four digits of the credit card. |
||||||||||||||||||||||||||||||||||||
CheckPaymentDetails |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Beneficiary |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The beneficiary of the payment. Can be NULL. |
||||||||||||||||||||||||||||||||||||
CheckPostalAddress |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The address of the beneficiary. Can be NULL. |
||||||||||||||||||||||||||||||||||||
Amount |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The total costs incurred by the customer for an order. Can be NULL. |
||||||||||||||||||||||||||||||||||||
Currency |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The currency ISO code of the order/payment - ISO 4217. Can be NULL. |
||||||||||||||||||||||||||||||||||||
PayPalExpress |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
|
Optional (string) |
|||||||||||||||||||||||||||||||||||
Email address customers use for their PayPal account. |
||||||||||||||||||||||||||||||||||||
ReturnURL |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The PayPal Express Checkout redirect URL returned by calling the getPayPalExpressCheckoutRedirectURL method. The return URL is the page on your website to which PayPal redirects your buyer's browser after the buyer logs into PayPal and approves the payment. Typically, this is a secure page (https://...) on your site. |
||||||||||||||||||||||||||||||||||||
CancelURL |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The cancel URL is the page on your website to which PayPal redirects your buyer's browser if the buyer does not approve the payment. Typically, this is the secure page (https://...) on your site from which you redirected the buyer to PayPal. |
||||||||||||||||||||||||||||||||||||
WirePaymentDetails |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Amount |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The total costs customers incur. Can be NULL. |
||||||||||||||||||||||||||||||||||||
Currency |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The currency ISO code of the order - ISO 4217. Can be NULL. |
||||||||||||||||||||||||||||||||||||
PaymentReference |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Transaction identifier. Can be NULL. |
||||||||||||||||||||||||||||||||||||
RoutingNumber |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Identification number assigned to financial institutions. Can be NULL. |
||||||||||||||||||||||||||||||||||||
BankAccounts |
Optional (Array of objects) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Beneficiary |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The beneficiary of the payment. Can be NULL. |
||||||||||||||||||||||||||||||||||||
BankName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The name of the beneficiary's bank. Can be NULL. |
||||||||||||||||||||||||||||||||||||
BankCountry |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The country of the beneficiary's bank. Can be NULL. |
||||||||||||||||||||||||||||||||||||
BankCity |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The city of the beneficiary's bank. Can be NULL. |
||||||||||||||||||||||||||||||||||||
BankAddress |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The address of the beneficiary's bank. Can be NULL. |
||||||||||||||||||||||||||||||||||||
BankAccount |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The number for the account in which customers transfer the funds. Can be NULL. |
||||||||||||||||||||||||||||||||||||
BankAccountIban |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The IBAN of the beneficiary's bank. Can be NULL. |
||||||||||||||||||||||||||||||||||||
BankAccountSwiftCode |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The Swift Code of the beneficiary's bank. Can be NULL. |
||||||||||||||||||||||||||||||||||||
Currency |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The currency ISO code for the bank account - ISO 4217. Can be NULL. |
||||||||||||||||||||||||||||||||||||
CustomerIP |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Shopper IP. |
||||||||||||||||||||||||||||||||||||
CustomerDetails |
Object 2Checkout populates the parameters of the customer entity with information from the customer whose 2CheckoutCustomerReference or ExternalCustomerReference you send during the purchase. |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
2CheckoutCustomerReference |
Optional (Int) |
|||||||||||||||||||||||||||||||||||
System-generated 2Checkout customer reference. Aggregate subscriptions under the same Customer account if the products they're associated to are purchased by the same shopper by adding the AV_CUSTOMERID (case sensitive) parameter to buy links. The 2Checkout system generates default customer numerical (integer) IDs (AV_CUSTOMERID) automatically for all orders containing products that feature subscriptions. |
||||||||||||||||||||||||||||||||||||
ExternalCustomerReference |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The external customer reference you control. Aggregate subscriptions under the same Customer account if the products they're associated to are purchased by the same shopper by adding the CUSTOMERID (case sensitive) parameter to buy links. |
||||||||||||||||||||||||||||||||||||
FirstName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's first name. |
||||||||||||||||||||||||||||||||||||
LastName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's last name. |
||||||||||||||||||||||||||||||||||||
CountryCode |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's country code (ISO 3166 two-letter code). |
||||||||||||||||||||||||||||||||||||
State |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's state. For example, "Alabama","Alaska","Arizona". |
||||||||||||||||||||||||||||||||||||
City |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's city. |
||||||||||||||||||||||||||||||||||||
Address1 |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's address. |
||||||||||||||||||||||||||||||||||||
Address2 |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's address. |
||||||||||||||||||||||||||||||||||||
Zip |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Zip code. |
||||||||||||||||||||||||||||||||||||
|
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's email. |
||||||||||||||||||||||||||||||||||||
Phone |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's phone number. |
||||||||||||||||||||||||||||||||||||
Company |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Company name. |
||||||||||||||||||||||||||||||||||||
FiscalCode |
Optional (string) |
|||||||||||||||||||||||||||||||||||
For companies, it needs to be the VAT ID. 2Checkout validates this values and throws an error if the VAT ID is invalid/incorrect. When present, you need to also provide Company name.
Can be null for end users. |
||||||||||||||||||||||||||||||||||||
Fax |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Customer's fax number. |
||||||||||||||||||||||||||||||||||||
Enabled |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
true or false, depending on whether the customer account is active or inactive. An active customer account features at least one Active or Past due subscription. |
||||||||||||||||||||||||||||||||||||
Trial |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
true or false, depending on whether the customer account features only trials or also paid subscriptions. |
||||||||||||||||||||||||||||||||||||
Language |
Optional (string) |
|||||||||||||||||||||||||||||||||||
ISO 639-1 two-letter code. Example: “en.” |
||||||||||||||||||||||||||||||||||||
ExistingCards |
Optional (Array of objects) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
TransientToken |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Populated only when you retrieve customer information by SSOToken. |
||||||||||||||||||||||||||||||||||||
Token |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Token for the EXISTING_PAYMENT_DATA flow. Use it to charge customers using cards they used in the past for purchases from your 2Checkout account. |
||||||||||||||||||||||||||||||||||||
CardType |
Optional (string) |
|||||||||||||||||||||||||||||||||||
visa, visaelectron, mastercard, maestro, amex, discover, dankort, cartebleue, jcb, hipercard, elo |
||||||||||||||||||||||||||||||||||||
LastDigits |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Last four digits of the credit card. |
||||||||||||||||||||||||||||||||||||
ExpirationMonth |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Card expiration month. |
||||||||||||||||||||||||||||||||||||
ExpirationYear |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Card expiration year. |
||||||||||||||||||||||||||||||||||||
NameOnCard |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Card holder name. |
||||||||||||||||||||||||||||||||||||
Origin |
Optional (String) |
|||||||||||||||||||||||||||||||||||
2Checkout automatically tracks the source of purchases:
|
||||||||||||||||||||||||||||||||||||
2CheckoutCommission |
Optional (Int) |
|||||||||||||||||||||||||||||||||||
2Checkout's commission for the order. |
||||||||||||||||||||||||||||||||||||
OrderFlow |
Optional (string) |
|||||||||||||||||||||||||||||||||||
PURCHASE_ORDER - Sent only when shoppers used Purchase Orders. REGULAR - Sent in all other cases. |
||||||||||||||||||||||||||||||||||||
GiftDetails |
Optional (object) |
|||||||||||||||||||||||||||||||||||
Contains contact details for the recipient of a gift purchase. |
||||||||||||||||||||||||||||||||||||
FirstName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
First name of gift recipient. |
||||||||||||||||||||||||||||||||||||
LastName |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Last name of gift recipient. |
||||||||||||||||||||||||||||||||||||
|
Optional (string) |
|||||||||||||||||||||||||||||||||||
Email of gift recipient. 2Checkout uses this email for the delivery/fulfillment process. |
||||||||||||||||||||||||||||||||||||
GiftNote |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Custom text shoppers provide as a message to the gift recipient. |
||||||||||||||||||||||||||||||||||||
PODetails |
Object (optional) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Status |
Optional (string) |
|||||||||||||||||||||||||||||||||||
PO status. Possible values:
|
||||||||||||||||||||||||||||||||||||
AutoApprove |
Optional (Boolean) |
|||||||||||||||||||||||||||||||||||
TRUE or FALSE, depending on whether you set POs to auto-approve or not. |
||||||||||||||||||||||||||||||||||||
ExtraInformation |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
|
PaymentLink |
Optional (String) |
||||||||||||||||||||||||||||||||||
|
|
Can be: 1. The PO doc upload link - If you set AutoApprove as FALSE on the original order and before shoppers upload the PO. 2. Payment link for orders with POs. Business customers can use the PaymentLink to finalize payment for orders with POs. If you set AutoApprove as TRUE on the original order and if 2Checkout and you approve the PO. |
||||||||||||||||||||||||||||||||||
PaymentLink |
Optional (string) |
|||||||||||||||||||||||||||||||||||
In scenarios in which an issue blocks the transaction from finalizing, 2Checkout provides a retry link where shopper can complete their purchase by providing new payment details. |
||||||||||||||||||||||||||||||||||||
PartnerCode |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Partner code you configured for your partner. NULL for eStore orders. |
||||||||||||||||||||||||||||||||||||
PartnerMargin |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Partner margin you set for the order. NULL for eStore orders. |
||||||||||||||||||||||||||||||||||||
PartnerMarginPercent |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The percentage of the partner margin from the net value of the products ordered, minus the value of any discounts. NULL for eStore orders. |
||||||||||||||||||||||||||||||||||||
ExtraMargin |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Extra margin you offer by editing partner orders. NULL for eStore orders. |
||||||||||||||||||||||||||||||||||||
ExtraMarginPercent |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The percentage of the extra partner margin from the net value of the products ordered, minus the partner margin and the value of any discounts. NULL for eStore orders. |
||||||||||||||||||||||||||||||||||||
ExtraDiscount |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Extra discount you offer by editing partner orders. NULL for eStore orders. |
||||||||||||||||||||||||||||||||||||
ExtraDiscountPercent |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The percentage of the partner margin from the net value of the products ordered, minus the value of any coupon discounts. NULL for eStore orders. |
||||||||||||||||||||||||||||||||||||
LocalTime |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Local shopper time in the following format: Y-m-d H:i:s. This parameter can impact the fraud score of an order when it's missing, NULL or incorrectly formatted. |
||||||||||||||||||||||||||||||||||||
TestOrder |
Optional (Boolean) |
|||||||||||||||||||||||||||||||||||
True for test orders. False of regular orders. |
||||||||||||||||||||||||||||||||||||
Errors |
Optional (StringArray) |
|||||||||||||||||||||||||||||||||||
Payment gateway processing errors. |
||||||||||||||||||||||||||||||||||||
Items |
Array of objects |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
ProductDetails |
Object |
|||||||||||||||||||||||||||||||||||
Name |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Product name. |
||||||||||||||||||||||||||||||||||||
ExtraInfo |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The text entered in the Additional information field when generating Buy links, or via the INFO[PRODUCT_ID] parameter used in Buy links. |
||||||||||||||||||||||||||||||||||||
RenewalStatus |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Subscriptions |
Object |
|||||||||||||||||||||||||||||||||||
SubscriptionReference |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Unique, system-generated subscription identifier. |
||||||||||||||||||||||||||||||||||||
PurchaseDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The date time stamp when shoppers acquired their subscriptions corresponding to the moment when the 2Checkout system marks the purchase as finished. Format (YYYY-MM-DD HH:mm:ss). Default GMT+02:00.
e.g. 2015-08-11 15:18:52 |
||||||||||||||||||||||||||||||||||||
SubscriptionStartDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Example: 2015-09-29 17:57:59 |
||||||||||||||||||||||||||||||||||||
ExpirationDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The date time stamp of upcoming renewal/expiration for subscriptions not taking into account grace period settings.
Format (YYYY-MM-DD HH:mm:ss). Default GMT+02:00.
e.g. 2015-09-11 15:18:52 |
||||||||||||||||||||||||||||||||||||
Lifetime |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Trial |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Enabled |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
RecurringEnabled |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
|
PriceOptions |
Optional (array of strings) |
||||||||||||||||||||||||||||||||||
Array of price option codes. |
||||||||||||||||||||||||||||||||||||
Code |
Optional (strings) |
|||||||||||||||||||||||||||||||||||
Unique code that the 2Checkout system generates or that you set for each pricing options group. |
||||||||||||||||||||||||||||||||||||
Required |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Options |
Optional (array of strings) |
|||||||||||||||||||||||||||||||||||
The code you set or that the 2Checkout system generates for each price option child inside a pricing options group parent. |
||||||||||||||||||||||||||||||||||||
Price |
Object |
|||||||||||||||||||||||||||||||||||
This object returns the price per unit at order line level.
In the case of trials, the object returns the costs for the trial to full subscription conversion. |
||||||||||||||||||||||||||||||||||||
UnitNetPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The value per product unit, excluding sales tax/VAT expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
UnitGrossPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Total value per product unit, including sales tax/VAT expressed in the payment currency. UnitGrossPrice does not reflect any discounts. |
||||||||||||||||||||||||||||||||||||
UnitVAT |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Sales tax/VAT per product unit expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
UnitDiscount |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Value of the discount per product unit expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
UnitNetDiscountedPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The value per product unit, expressed in the payment currency, excluding sales tax/VAT, from which 2Checkout deducts the unit discount. |
||||||||||||||||||||||||||||||||||||
UnitGrossDiscountedPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Total costs shoppers incur per product unit, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts. |
||||||||||||||||||||||||||||||||||||
UnitAffiliateCommission |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Value of the affiliate commission per product unit calculated expressed in the payment currency.
2Checkout deducts discounts from the costs incurred by shoppers before calculating affiliate commissions.
2Checkout does not take into account shipping costs when calculating affiliate commissions.
NULL when 2Checkout does not apply an affiliate commission. |
||||||||||||||||||||||||||||||||||||
Currency |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The currency ISO code for the payment - ISO 4217. Example: usd. |
||||||||||||||||||||||||||||||||||||
NetPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The value per order line, excluding sales tax/VAT expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
GrossPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Total value per order line, including sales tax/VAT expressed in the payment currency. UnitGrossPrice does not reflect any discounts. |
||||||||||||||||||||||||||||||||||||
NetDiscountedPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The NetPrice value per order line (in the payment currency), excluding sales tax/VAT, from which 2Checkout deducts discounts. |
||||||||||||||||||||||||||||||||||||
GrossDiscountedPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Total costs shoppers incur per order line, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts.
Example:
|
||||||||||||||||||||||||||||||||||||
Discount |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Value of the discounts per order line expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
VAT |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Value of sales tax/VAT per order line expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
AffiliateCommission |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Value of the affiliate commission per order line, calculated from the NetDiscountedPrice expressed in the payment currency. Or NULL. 2Checkout does not take into account shipping costs when calculating affiliate commissions. |
||||||||||||||||||||||||||||||||||||
Code |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Unique product identifier your control. Max length 256 characters. |
||||||||||||||||||||||||||||||||||||
Quantity |
Optional (integer) |
|||||||||||||||||||||||||||||||||||
Number of units |
||||||||||||||||||||||||||||||||||||
SKU |
Optional (string) |
|||||||||||||||||||||||||||||||||||
SKU identifier. |
||||||||||||||||||||||||||||||||||||
CrossSell |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
ParentCode |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The product code of the master product you set to trigger the campaign. |
||||||||||||||||||||||||||||||||||||
CampaignCode |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Unique, system-generated identifier for cross-sell campaigns. |
||||||||||||||||||||||||||||||||||||
Trial |
Optional (Object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Period |
Optional (integer) |
|||||||||||||||||||||||||||||||||||
The length of the trial subscription lifetime in days. |
||||||||||||||||||||||||||||||||||||
GrossPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Total trial price in the payment currency before 2Checkout deducts any taxes, discounts, etc. |
||||||||||||||||||||||||||||||||||||
VAT |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The total value of taxes for the trial in the payment currency, before 2Checkout deducts any discounts. |
||||||||||||||||||||||||||||||||||||
NetPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Total trial price in the payment currency, not including taxes, before 2Checkout deducts any discounts. |
||||||||||||||||||||||||||||||||||||
AdditionalFields |
Optional (array of objects) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Code |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The alpha-numeric characters, underscores and dashes that are set as the field identifier. |
||||||||||||||||||||||||||||||||||||
Text |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Field text visible to shoppers in the cart. |
||||||||||||||||||||||||||||||||||||
Value |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Selected field value. |
||||||||||||||||||||||||||||||||||||
Promotion |
Optional (object) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Name |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Promotion name. |
||||||||||||||||||||||||||||||||||||
Description |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Promotion description. |
||||||||||||||||||||||||||||||||||||
StartDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The date when you set the promotion to start. NULL for promotions that start immediately after you create them. |
||||||||||||||||||||||||||||||||||||
EndDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The date when you set the promotion to end. NULL for promotions you want active indefinitely. |
||||||||||||||||||||||||||||||||||||
MaximumOrdersNumber |
Optional (integer) |
|||||||||||||||||||||||||||||||||||
2Checkout only applies the promotion to a maximum number of orders you define.
Can be NULL if you want the promotion to apply to an unlimited number of orders. |
||||||||||||||||||||||||||||||||||||
MaximumQuantity |
Optional (integer) |
|||||||||||||||||||||||||||||||||||
Discount only applies to a maximum number of units purchased through a single order, smaller than the quantity you defined. Shoppers purchase any extra units at full price. Can be NULL if you want the promotion to apply to an unlimited number units. |
||||||||||||||||||||||||||||||||||||
InstantDiscount |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
The instant discount option auto-applies the discount for ALL selected products, without the need for shoppers to enter a discount coupon. |
||||||||||||||||||||||||||||||||||||
Coupon |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Promotion coupon/voucher. |
||||||||||||||||||||||||||||||||||||
DiscountLabel |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Discounts can be set as a percentage from the product price or as a fixed amount in the chosen currency. |
||||||||||||||||||||||||||||||||||||
Enabled |
Optional (string) |
|||||||||||||||||||||||||||||||||||
true or false, depending on whether a promotion is active or disabled. |
||||||||||||||||||||||||||||||||||||
Type |
Optional (string) |
|||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Promotions |
Optional (Array of objects) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Name |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Promotion name. |
||||||||||||||||||||||||||||||||||||
Description |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Promotion description. |
||||||||||||||||||||||||||||||||||||
StartDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The date when you set the promotion to start. NULL for promotions that start immediately after you create them. |
||||||||||||||||||||||||||||||||||||
EndDate |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The date when you set the promotion to end. NULL for promotions you want active indefinitely. |
||||||||||||||||||||||||||||||||||||
MaximumOrdersNumber |
Optional (integer) |
|||||||||||||||||||||||||||||||||||
2Checkout only applies the promotion to a maximum number of orders you define.
Can be NULL if you want the promotion to apply to an unlimited number of orders. |
||||||||||||||||||||||||||||||||||||
MaximumQuantity |
Optional (integer) |
|||||||||||||||||||||||||||||||||||
Discount only applies to a specific number of units purchased at once, smaller than the maximum quantity you defined. Shoppers purchase any extra units at full price. Can be NULL if you want the promotion to apply to an unlimited number units. |
||||||||||||||||||||||||||||||||||||
InstantDiscount |
Optional (boolean) |
|||||||||||||||||||||||||||||||||||
The instant discount option auto-applies the discount for ALL selected products, without the need for shoppers to enter a discount coupon. |
||||||||||||||||||||||||||||||||||||
Coupon |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Promotion coupon/voucher. |
||||||||||||||||||||||||||||||||||||
DiscountLabel |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Discounts can be set as a percentage from the product price or as a fixed amount in the payment currency. |
||||||||||||||||||||||||||||||||||||
Enabled |
Optional (string) |
|||||||||||||||||||||||||||||||||||
true or false, depending on whether a promotion is active or disabled. |
||||||||||||||||||||||||||||||||||||
Type |
Optional (string) |
|||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
AdditionalFields |
Optional (array of objects) |
|||||||||||||||||||||||||||||||||||
Details below. |
||||||||||||||||||||||||||||||||||||
Code |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The alpha-numeric characters, underscores and dashes that are set as the field identifier. |
||||||||||||||||||||||||||||||||||||
Text |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Field text visible to shoppers in the cart. |
||||||||||||||||||||||||||||||||||||
Value |
Optional (string) |
|||||||||||||||||||||||||||||||||||
Selected field value. |
||||||||||||||||||||||||||||||||||||
Currency |
Optional (string) |
|||||||||||||||||||||||||||||||||||
The currency ISO code for the payment - ISO 4217. Example: usd. |
||||||||||||||||||||||||||||||||||||
NetPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Order value excluding sales tax/VAT expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
GrossPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Total order value, including sales tax/VAT expressed in the payment currency. GrossPrice does not reflect any discounts. |
||||||||||||||||||||||||||||||||||||
NetDiscountedPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
The NetPrice order value excluding sales tax/VAT, from which 2Checkout deducts discounts. NetDiscountedPrice is expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
GrossDiscountedPrice |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Total costs shoppers incur, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts.
For example:
|
||||||||||||||||||||||||||||||||||||
Discount |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Value of the discounts for an order expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
VAT |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Value of sales tax/VAT expressed in the payment currency. |
||||||||||||||||||||||||||||||||||||
AffiliateCommission |
Optional (double) |
|||||||||||||||||||||||||||||||||||
Value of the affiliate commission for the order calculated from the NetDiscountedPrice expressed in the payment currency. Or NULL. 2Checkout does not take into account shipping costs when calculating affiliate commissions. |
Single Sign On (SSO)
Overview
Redirect and login shoppers automatically from your user portal into their 2Checkout myAccount based on subscription or customer information.
Requirements
You need a custom domain to use Single Sign-On. Contact 2Checkout directly for guidance on how to set up a custom domain.
Use Bank transfers
Overview
Place an order using catalog products, and collect the payment using Wire transfers.
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. |
Required (Object) |
|
|
Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. |
Response
Parameters | Type/Description |
---|---|
Object |
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->Affiliate = new stdClass();
$Order->Affiliate->AffiliateCode = 'Partner123'
$Order->Affiliate->AffiliateSource = 'MobilePlatform'
$Order->CustomerReference = NULL;
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1';
$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]->SubscriptionStartDate = NULL; //If empty or null, subscriptions become active when purchase is made.
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'Test Cosmin API';
$Order->BillingDetails->LastName = 'Cosmin API';
$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 = 'john.doe@avangate.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'WIRE';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;
$jsonRpcRequest = array (
'method' => 'placeOrder',
'params' => array($sessionID, $Order),
'id' => $i++,
'jsonrpc' => '2.0'
);
$order = callRPC($jsonRpcRequest, $host);
Use Bank transfers
Overview
Place an order using catalog products, and collect the payment using Wire transfers.
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. |
Required (Object) |
|
|
Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. |
Response
Parameters | Type/Description |
---|---|
Object |
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->Affiliate = new stdClass();
$Order->Affiliate->AffiliateCode = 'Partner123'
$Order->Affiliate->AffiliateSource = 'MobilePlatform'
$Order->CustomerReference = NULL;
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1';
$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]->SubscriptionStartDate = NULL; //If empty or null, subscriptions become active when purchase is made.
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'Test Cosmin API';
$Order->BillingDetails->LastName = 'Cosmin API';
$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 = 'john.doe@2checkout.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'WIRE';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;
try {
$newOrder = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
echo "newOrder: " . $e->getMessage();
exit;
}
var_dump("newOrder", $newOrder);
Use PayPal Express
Overview
Use the getPayPalExpressCheckoutRedirectURL method to retrieve the RedirectURL by sending an Order object with PAYPAL_EXPRESS payment method.
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. |
Required (Object) |
|
|
Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details.
Use PAYPAL_EXPRESS as the payment method. |
Response
Parameters | Type/Description |
---|---|
PayPalExpressCheckoutRedirectURL |
String |
Retrieve PayPal redirect URL
<?
require ('PATH_TO_AUTH');
$Order = new stdClass();
$Order->Language = 'en';
$Order->CustomerReference = 'APITEST'; // set customer reference (optional)
$Order->Currency = 'EUR';
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1'; // send the product code
$Order->Items[0]->Quantity = 1;
$Order->PaymentDetails = new stdClass();
$Order->PaymentDetails->Type = 'PAYPAL_EXPRESS'; // payment method, must be PAYPAL_EXPRESS for the express flow to take place.
$Order->PaymentDetails->Currency = 'EUR';
$Order->PaymentDetails->CustomerIP = '91.220.121.21';
$PayPalExpress = new stdClass();
$PayPalExpress->Email='customer@email.com';
$PayPalExpress->ReturnURL = 'http://' . $_SERVER['HTTP_HOST'] . '/api/place_order_api_json_paypal_express_response.php';
$PayPalExpress->CancelURL = 'http://' . $_SERVER['HTTP_HOST'] . '/api/place_order_api_json_paypal_express_response.php' . '?cancel=true';
$Order->PaymentDetails->PaymentMethod = $PayPalExpress;
// Call the method for retrieving Express Checkout redirect URL
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'getPayPalExpressCheckoutRedirectURL';
$jsonRpcRequest->params = array($sessionID, $Order);
$jsonRpcRequest->id = $i++;
$redirectUrl = callRPC($jsonRpcRequest, $host);
header('Location:' . $redirectUrl);
Place order with PayPal Express
<?php
require ('PATH_TO_AUTH');
// This is the start of the second script place_order_api_json_paypal_express_response.php
var_dump($_REQUEST);
if (isset($_GET['billingDetails'])) {
$billingDetails = base64_decode($_GET['billingDetails']);
parse_str($billingDetails, $billingDetailsArray);
}
if (isset($_GET['deliveryDetails'])) {
$deliveryDetails = base64_decode($_GET['deliveryDetails']);
parse_str($deliveryDetails, $deliveryDetailsArray);
}
if (isset($_GET['token'])) {
$token = $_GET['token'];
}
if (!empty($_GET['cancel']) && $_GET['cancel'] == true) {
echo 'canceled';
die();
} else {
echo 'success!';
}
$Billing = new stdClass();
$Billing->Country = empty($billingDetailsArray['Country']) ? '' : $billingDetailsArray['Country'];
$Billing->City = empty($billingDetailsArray['City']) ? '' : $billingDetailsArray['City'];
$Billing->State = empty($billingDetailsArray['State']) ? '' : $billingDetailsArray['State'];
$Billing->PostalCode = empty($billingDetailsArray['PostalCode']) ? '' : $billingDetailsArray['PostalCode'];
$Billing->Email = "customer@email.com";
$Billing->FirstName = empty($billingDetailsArray['FirstName']) ? '' : $billingDetailsArray['FirstName'];
$Billing->LastName = empty($billingDetailsArray['LastName']) ? '' : $billingDetailsArray['LastName'];
$Billing->Address = empty($billingDetailsArray['Address']) ? '' : $billingDetailsArray['Address'];
$Order->BillingDetails = $Billing;
$Delivery = new stdClass();
$Delivery->Country = empty($deliveryDetailsArray['Country']) ? '' : $deliveryDetailsArray['Country'];
$Delivery->City = empty($deliveryDetailsArray['City']) ? '' : $deliveryDetailsArray['City'];
$Delivery->State = empty($deliveryDetailsArray['State']) ? '' : $deliveryDetailsArray['State'];
$Delivery->FirstName = empty($deliveryDetailsArray['FirstName']) ? '' : $deliveryDetailsArray['FirstName'];
$Delivery->LastName = empty($deliveryDetailsArray['LastName']) ? '' : $deliveryDetailsArray['LastName'];
$Delivery->Address = empty($deliveryDetailsArray['Address']) ? '' : $deliveryDetailsArray['Address'];
$Delivery->PostalCode = empty($deliveryDetailsArray['PostalCode']) ? '' : $deliveryDetailsArray['PostalCode'];
$Order->DeliveryDetails = $Delivery;
$Payment = new stdClass();
$Payment->Type = 'PAYPAL_EXPRESS';
$Payment->Currency = 'EUR';
$Payment->CustomerIP = '91.220.121.21';
$PayPal = new stdClass();
$PayPal->Email='customer@email.com';
$PayPal->Token = $token;
$PayPal->ReturnURL = 'http://' . $_SERVER['HTTP_HOST'] . '/api/place_order_api_json_paypal_express_response.php1';
$PayPal->CancelURL = 'http://' . $_SERVER['HTTP_HOST'] . '/api/place_order_api_json_paypal_express_response.php1' . '?cancel=true';
$Payment->PaymentMethod = $PayPal;
$Order->PaymentDetails = $Payment;
$OrderField = new stdClass();
$OrderField->Code = 'ED5310';
$OrderField->Value = 'Value1';
// Call the method for placing the order
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'placeOrder';
$jsonRpcRequest->params = array($sessionID, $NewOrder);
$jsonRpcRequest->id = $i++;
$APIOrderFullInfo = callRPC((Object)$jsonRpcRequest, $host);