Pricing options
Overview
Use this object to add/create and edit/update price options for your account.
Parameters
Parameters | Type/Description | |||
---|---|---|---|---|
PriceOptionsGroup |
Object |
|||
Name |
String |
|||
|
Price option group name. Use this parameter when adding a new price options group. To edit the name of a price option group use the Name parameter under the Translations object. |
|||
Description |
String |
|||
|
Pricing option group description. |
|||
Translations |
Array of objects |
|||
|
Details below. |
|||
|
Name |
String |
||
|
|
Product pricing options group name, localized under Options. |
||
|
Description |
String |
||
|
|
Product pricing options group description, localized under Options. |
||
|
Language |
String |
||
|
|
ISO language code. (ISO 639-1 two-letter code). |
||
Code |
String |
|||
|
Unique code that The 2Checkout system generates or set for each pricing options group. |
|||
Type |
String |
|||
|
The type of pricing options group. Possible values: · RADIO · CHECKBOX · INTERVAL · COMBO |
|||
Options |
Array of objects |
|||
|
Details below. |
|||
|
Name |
String |
||
|
|
Pricing option child name. |
||
|
Description |
String |
||
|
|
Pricing option child description. |
||
|
Translations |
Array of objects |
||
|
|
Details above. |
||
|
|
Name |
String |
|
|
|
|
Localized product pricing options group name under PriceOptionGroup. Localized pricing option child name under Options. |
|
|
|
Description |
String |
|
|
|
|
Localized product pricing options group description under PriceOptionGroup. Localized pricing option child description under Options. |
|
|
|
Language |
String |
|
|
|
|
ISO language code. (ISO 639-1 two-letter code). |
|
|
Value |
String |
||
|
|
The code you set or that the 2Checkout system generated for each pricing option child inside a pricing options group parent. |
||
|
ScaleMin |
Int |
||
|
|
The minimum value of a scale interval set for each pricing option child inside a pricing options group parent of the type INTERVAL. |
||
|
ScaleMax |
Int |
||
|
|
The maximum value of a scale interval set for each pricing option child inside a pricing options group parent of the type INTERVAL. |
||
|
SubscriptionImpact |
Object |
||
|
|
Details below. |
||
|
Months |
String |
||
|
|
The value in months the 2Checkout system adds or subtracts from the initial billing cycle of a subscription. |
||
|
Impact |
String |
||
|
|
Possible values: · ADD · SUBTRACT · LIFETIME |
||
|
PriceImpact |
Object |
||
|
|
Details below. |
||
|
|
ImpactOn |
String |
|
|
|
|
Possible values:
|
|
|
|
Impact |
String |
|
|
|
|
Impact on price per unit:
|
|
|
|
Percent |
String |
|
|
|
|
The value of the percentage out of the price per product unit, when you use PERCENT for Method. |
|
|
|
Method |
String |
|
|
|
|
Possible values: · PERCENT · FIXED |
|
|
|
Amounts |
Array of objects. |
|
|
|
|
Details below. |
|
|
|
|
Currency |
String |
|
|
|
|
Currency ISO code - ISO 4217. |
|
|
|
Amount |
String |
|
|
|
|
The amount defined for each specific currency active for your account, when you use FIXED for Method. |
|
Default |
Boolean |
||
|
|
TRUE for preselected options. Missing for options that are not preselected. |
||
Required |
boolean |
|||
|
True if you made the pricing option group mandatory. |
Electronic delivery and payment receipt
Overview
2Checkout automatically sends out the electronic delivery and payment receipt email to both providers and shoppers with confirmation and details on their payment and to fulfill orders - delivering binary keys, activation codes, Backup Media, Download Software Insurance details or product files to your shoppers.
As of July 13th, 2016, you can use a redesigned template complete with fresh content. The new template has replaced the previous electronic delivery and payment receipt email, but any customization you have in place, either in terms of styling or content, continues to be available.
Availability
All 2Checkout accounts.
What is the purpose of this email?
For the default email communications setup, 2Checkout blends the payment receipt and electronic delivery emails into a single notification. 2Checkout sends the electronic delivery and payment receipt email if your account uses the default shopper communications setup, for those products where you set fulfillment to be performed through 2Checkout delivery.
Email content
Depending on what actions need to be performed by your clients to receive access to your products, the email includes one or several of the following:
- Product/Subscription plan information.
- Activation keys/codes accompanied by short descriptions.
- Downloadable product files, backup media, and download insurance service.
- A payment receipt with information on the payment method, ordered products, quantities, unit prices, taxes and total amount.
- Billing/Delivery Information.
- Cross-sell products (provided you have an active cross-sell campaign set to also be displayed in the payment receipt email).
- Technical and payment support contact details.
Sample
Is this the only email my shoppers receive after placing an order?
2Checkout can send the electronic delivery email either standalone or combined with the payment receipt notification (in one single email).
Depending on your account's setup, for each order containing at least one product configured with 2Checkout delivery your shoppers can receive:
- Default: One email containing both the payment receipt and the electronic delivery messages
- Two email notifications: The payment receipt and the electronic delivery messages, separately
- Three email notifications: An order confirmation email, plus the payment receipt and the electronic delivery messages, separately
Contact 2Checkout to change your default configuration if you find another setup better suited for your customers.
Preview and test email
Navigate to the Email template manager section to:
- Preview and test current templates for emails sent to your shoppers
- Customize the header and the footer sections by creating custom templates you can assign to your emails
Access the electronic delivery and payment receipt email under the Order section. You can access this email only if your account uses the default shopper emails communication setup that blends together the electronic delivery and the payment emails.
Why don't I see the new template for this email?
The redesigned template for the electronic delivery and payment receipt email has automatically replaced default templates.
If your preview of electronic delivery and payment receipt email does not show the new template, you are most probably using a customized version that includes content and/or styling your company requested at a certain point in time.
You can compare the above sample to your current template and send us an email if you decide the new one suits your business needs better. We will work with you on the switch.
Search cross-sell campaigns
Overview
Use the searchCrossSellCampaigns call to retrieve information on the cross-sell campaigns currently defined on your account.
Request parameters
Parameters |
Type |
Required |
Description |
---|---|---|---|
CampaignName |
String |
Optional |
The name of the campaign. |
Status |
String |
Optional |
The status of the campaign; can be ACTIVE/INACTIVE. |
Products |
Array of strings |
Optional |
Array of product codes to apply to this campaign. |
RecommendedProducts |
Array of strings |
Optional |
Array of product codes recommended to the shopper. |
StartDate |
String |
Optional |
The date when the cross-sell campaign starts, formatted as YYYY-MM-DD |
EndDate |
String |
Optional |
The date when the cross-sell campaign ends, formatted as YYYY-MM-DD |
Type | String | Optional | Can be MERCH/AFF. |
Pagination |
Object |
Optional |
|
Page |
Int |
Optional |
The page number of the results. |
Limit |
Int |
Optional |
The number of results per page. |
Request sample
<?php
declare(strict_types=1);
// Start clear CLI
echo chr(27).chr(91).'H'.chr(27).chr(91).'J';
// End clear CLI
$executionStartTime = microtime(true);
class Configuration
{
public const MERCHANT_CODE = 'your_merchant_code';
public const MERCHANT_KEY = 'your_merchant_key';
public const URL = 'http://api.avangate.local/rpc/6.0';
}
class Client
{
private const LOGIN_METHOD = 'login';
private const SEARCH_CROSS_SELL_CAMPAIGNS = 'searchCrossSellCampaigns';
private int $calls = 1;
private function generateAuth(): array
{
$merchantCode = Configuration::MERCHANT_CODE;
$key = Configuration::MERCHANT_KEY;
$date = gmdate('Y-m-d H:i:s');
$string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
$hash = hash_hmac('md5', $string, $key);
return compact('merchantCode', 'date', 'hash');
}
public function login()
{
$payload = $this->generateAuth();
$response = $this->callForRpc(Configuration::URL, self::LOGIN_METHOD, array_values($payload));
return $response['result'];
}
private function callForRpc(string $url, string $action, ?array $payload = null)
{
$request = json_encode([
'jsonrpc' => '2.0',
'method' => $action,
'params' => $payload,
'id' => $this->calls++,
]);
$headers = [
'Content-Type: application/json',
'Accept: application/json',
'Cookie: XDEBUG_SESSION=PHPSTORM'
];
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl, CURLOPT_SSLVERSION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
$response = curl_exec($curl);
if (empty($response)) {
die('Server unavailable');
}
echo "\n\r Method " . $action . " result: \n\r";
echo $response . "\n\r";
return json_decode($response, true);
}
private function buildSearchParameters(): array
{
$searchOptions = new \stdClass();
$searchOptions->Status = ['ACTIVE']; // Optional | Ex: ['ACTIVE']
$searchOptions->Type = null; // Optional | Ex: 'MERCH'
$searchOptions->CampaignName = null; // Optional | Ex: 'UpdatedCampaign_4'
$searchOptions->Products = []; // Optional | Ex: ["a01", "a02"]
$searchOptions->RecommendedProducts = [];// Optional | Ex: ["a03"]
$searchOptions->StartDate = null; // Optional | Ex: 'YYYY-MM-DD'
$searchOptions->EndDate = null; // Optional | Ex: 'YYYY-MM-DD'
$searchOptions->Pagination = null; // Optional | Ex: {"Page": "1", "Limit": "10"}
return (array)$searchOptions;
}
public function searchCrossSellCampaigns($sessionId)
{
$response = $this->callForRpc(
Configuration::URL,
self::SEARCH_CROSS_SELL_CAMPAIGNS,
[$sessionId, $this->buildSearchParameters()]
);
return $response['result'];
}
}
$client = new Client();
$sessionId = $client->login();
$result = $client->searchCrossSellCampaigns($sessionId);
var_dump("SEARCH CROSS SELL CAMPAIGNS: \n\r", json_encode($result, JSON_PRETTY_PRINT));
$executionEndTime = microtime(true);
// The duration will be displayed in seconds and milliseconds.
$seconds = round($executionEndTime - $executionStartTime, 2);
// Print it out
echo "\n\rThis script took $seconds to execute.\n\r";
Response
Parameters | Type/Description |
---|---|
Items | An array of CrossSellCampaign Objects |
Pagination | Pagination Object with the following parameters: Page, Limit, Count |
Subscription additional information fields
Overview
Use this object to assign, update, retrieve and delete additional information fields from your subscriptions.
Parameters
Parameters | Type/Description |
---|---|
fieldName |
String |
The name of the additional information field. Used for identifying additional information fields. |
|
fieldValue |
String |
|
The value of the additional information field. |
Place orders with upsell campaign
Overview
When calling the placeOrder method in order to place an order with an upsell campaign, the code of the master product and the campaign code need to be added to the UpSell object for the product item where it is applied.
UpSell Object for the placeOrder API method
Parameter name | Type | Required/Optional | Description |
---|---|---|---|
CampaignCode | String | Required | The upsell campaign code. |
ParentCode | String | Required | Product code of the product to be recommended to the shopper. |
PriceOptions | String | Required |
Array of priceOptions strings used on parent product. |
Quantity | Integer | Required | Product quantity. |
Request Example
{
"Currency": "USD",
"Language": "EN",
"Country": "US",
"CustomerIP": "10.10.10.10",
"Source": "sourceAPI.net",
"CustomerReference": 421820775,
"Items": [
{
"Code": "15",
"Quantity": 1
},
{
"Code": "34924C876E",
"Quantity": 1,
"UpSell": {
"CampaignCode": "1490b954-c299-430a-8134-e6a0501913ef",
"ParentCode": "0BQ591VOTW",
"PriceOptions": [
"option_code_1"
],
"Quantity": 5
}
}
],
"BillingDetails":{
"FirstName":"Customer First Name",
"LastName":"Customer Last Name",
"CountryCode":"US",
"State":"California",
"City":"San Francisco",
"Address1":"Example Street",
"Zip":"90210",
"Email":"example@email.com"
},
"PaymentDetails": {
"Type": "CC",
"Currency": "USD",
"CustomerIP": "10.10.10.10",
"PaymentMethod": {
"Vendor3DSReturnURL": "https:\/\/example.com",
"Vendor3DSCancelURL": "https:\/\/example.com",
"CardNumber": "4111111111111111",
"CardType": "VISA",
"ExpirationYear": "2020",
"ExpirationMonth": "12",
"CCID": "123",
}
}
}
Response
Using the same structure, the getContents method will take into account the discount associated with the up-sell campaign and display the appropriate prices and taxes.
{
"Country": "DE",
"Currency": "EUR",
"Items": [
{
"Code": "NIQRPI0GTU",
"Quantity": 1
},
{
"Code": "0XICS3OVDK",
"Quantity": 1,
"UpSell": {
"CampaignCode": "1490b954-c299-430a-8134-e6a0501913ef",
"ParentCode": "0BQ591VOTW",
"PriceOptions": [
"option_code_1"
],
"Quantity": 5
}
}
],
"BillingDetails": {
"FirstName": "Customer First Name",
"LastName": "Customer Last Name",
"CountryCode": "DE",
"City": "Bucharest",
"Address1": "Example Street",
"Zip": "73331",
"Email": "example@email.com"
}
}
Restricted countries and territories
Overview
The 2Checkout services and products are not available in the restricted countries listed below. 2Checkout does not accept merchants or businesses from these prohibited countries.
OFAC-Restricted Countries
The United States Department of Treasury's Office of Foreign Assets Control (OFAC) is a legal entity that enforces and administers economic and trade regulations according to US foreign policies and national security goals.
Regulations and sanctions administered by OFAC are meant to protect shoppers from terrorists, traffickers, and other national security threats.
2Checkout is fully compliant with OFAC regulations, restricting shoppers from the following countries from placing orders:
- The Republic of Cameroon
- The Republic of Cuba
- The Islamic Republic of Iran
- The State of Libya
- The Republic of Sudan
- The Syrian Arab Republic
- The Republic of Tunisia
- The Democratic People's Republic of Korea
The list of countries can be updated without any notice at any moment by OFAC and will be applied immediately. Check the official OFAC website for the latest updates.
Shoppers from OFAC-restricted countries are unable to finalize payments or place orders, as the 'Buy' button is not accessible to them during the checkout process.
OFAC-Sanctioned Countries
- The Russian Federation
Retrieve proposal by ID
Overview
Use the getProposalById method via SOAP APIv6 to retrieve a proposal/quote using a specific ID.
Request parameters
Parameters | Type | Required/Optional | Description |
---|---|---|---|
proposalId | String |
Required |
The unique merchant proposal ID generated by the 2Checkout system. |
sessionId | String | Required | Unique 2Checkout session ID code. |
Request sample
<?php
require ('PATH_TO_AUTH');
$proposalID = "0573e71d-38bb-4d61-88ca-b3c557517c68";
try {
$result = $soapClient->getProposalById($sessionID, $proposalID);
echo "Proposal: </br>",
var_dump($result);
}
catch (SoapFault $e) {
echo "Could not fetch proposal: " . $e->getMessage();
exit;
}
Response
The getProposalById call via SOAP APIv6 returns the Proposal object.
Retrieve product groups
Overview
Use the getProductGroups method to extract information about the product groups you created for your account.
Parameters
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. |
Response
ProductGroup |
Array of objects |
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 = "YOURCODE123"; //your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "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;
}
try {
$ProductGroups = $client->getProductGroups($sessionID);
}
catch (SoapFault $e) {
echo "Product Groups: " . $e->getMessage();
exit;
}
var_dump("ProductGroups", $ProductGroups);
?>
ProductInfo Object Structure
Parameters
Parameter | Type/Description |
---|---|
SimpleProduct | Object |
Product object with the structure detailed below. | |
PriceOptions | Object |
PriceOptionsGroupItem object with the structure detailed below. |