Upgrade price
Overview
Retrieve the upgrade price for a subscription.
Attributes
| Parameters | Parameters |
|---|---|
|
BillingPrice |
Double |
|
|
The price 2Checkout charges the customer, without taxes. |
|
BillingGrossPrice |
Double |
|
|
The price 2Checkout charges the customer, including taxes. |
|
BillingCurrency |
String |
|
|
The currency ISO code used for the payment - ISO 4217. |
|
Quantity |
Int |
|
|
The mandatory quantity for the upgrade (you cannot make partial upgrades) |
|
DisplayPrice |
Double |
|
|
Display price. |
|
DisplayGrossPrice |
Double |
|
|
Display price before deductions. |
|
DisplayCurrency |
String |
|
|
Display currency. ISO 4217 code. |
| ProratedPrice | String |
|
Net prorated price for the upgrade. If the calculated upgrade price is 0, the prorated price is also send as 0. If customers upgrade to a product with a lower price, the total and net prices will be 0, however, the Prorated Price will be the negative calculated value. Use this information in case you want to refund customers for upgrades to lower priced subscription plans. |
|
| ProratedGrossPrice | String |
|
Gross prorated price for the upgrade. If the calculated upgrade price is 0, the prorated gross price is also 0. If customers upgrade to a product with a lower price, the total and net prices will be 0, however, the Prorated Gross Price will be the negative calculated value. Use this information in case you want to refund customers for upgrades to lower priced subscription plans. |
|
| Discount | Float |
| Applied discounts | |
| DiscountedProratedPrice | Float |
| Prorated net price for the upgrade with applied discounts | |
| DiscountedProratedGrossPrice | Float |
| Prorated gross price for the upgrade with applied discounts | |
| DiscountedBillingPrice | Float |
| Net billing price available for the upgrade process with applied discounts | |
| DiscountedBillingGrossPrice | Float |
| Gross billing price available for the upgrade process with applied discounts | |
| DisplayDiscount | Float |
| Discount displayed for the upgrade process | |
| DiscountedDisplayPrice | Float |
| Net display price available for the upgrade process with applied discounts | |
| DiscountedDisplayGrossPrice | Float |
| Gross display price available for the upgrade process with applied discounts |
Retrieve product info by code
Overview
Use getProductByCode to extract product information using the unique identifier you assign to subscription plans/products.
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. |
|
ProductCode |
String |
|
|
The product code that you control. |
Response
| Parameters | Type/Description |
|---|---|
|
Object |
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;
}
$ProductCode = 'my_subscription_1';
try {
$ProdbyCode = $client->getProductByCode($sessionID, $ProductCode);
}
catch (SoapFault $e) {
echo "ProductInfo: " . $e->getMessage();
exit;
}
var_dump("ProductInfo", $ProdbyCode);
?>
Retrieve price option groups
Overview
Use the searchPriceOptionGroups to extract information on the price option groups you configured.
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. |
|
PriceOptionGroupSearch |
Optional (object) |
|
|
Details below |
|
PriceOptionGroupSearch |
Object Details below |
|
Name |
Optional (string) |
|
|
The name of the pricing options groups configured in the 2Checkout system. Can be NULL. |
|
Types |
Optional (array) |
|
|
Possible values:
Can be NULL. |
|
Limit |
Optional (int) |
|
|
Number of results displayed per page. Default maximum value is 10. Can be NULL. |
|
Page |
Optional (int) |
|
|
A specific page of search results. Default value is 1. Can be NULL. |
Response
| Parameters | Type/Description |
|---|---|
|
Array of objects |
Request
<?php
require ('PATH_TO_AUTH');
try {
$existentPriceOptions = $client->searchPriceOptionGroups($sessionID, $SearchOptions);
}
catch (SoapFault $e) {
echo "existentPriceOptions: " . $e->getMessage();
exit;
}
var_dump("existentPriceOptionst", $existentPriceOptions);
?>
Shipping method
Overview
The object below is returned directly or within a successful response from the following API requests:
Search shipping method
Shipping method object
| Parameters | Type/Description | ||
|---|---|---|---|
| Items | Array of objects | ||
| Contains shipping methods objects. | |||
| ShippingMethod |
Shipping method object. Details below. |
||
| Name | String | ||
| Shipping method name that you define when creating the method. | |||
| Code | String | ||
| System-generated identified for the shipping method. | |||
| TrackingURL | String | ||
| URL assigned to the shipping method. Provided to your customers that purchase physical products. | |||
| BasePrice | String | ||
| Base fee attached to the shipping method, that will be charged to customers when shipping method is available in cart, regardless of their country, product value or weight. | |||
| Currency | String | ||
| Currency in which the base fee is expressed. Example: 'USD'. | |||
| Active | Boolean | ||
|
Possible values:
|
|||
| Availability | Strings | ||
|
Defined where the shipping method is active. Possible values:
|
|||
| Countries | Array of objects | ||
| Countries where the shipping method applies. | |||
| CountryCode | String | ||
| Two-letters country code. | |||
| Surcharge | String | ||
| Surcharge defined for each country. | |||
| Surcharge | Array of objects | ||
| Additional fee assigned to the shipping method. | |||
| Type | String | ||
|
Order property based on which the surcharge is added. Possible values:
|
|||
| From | Float | ||
| Lower interval limit. | |||
| To | Int | ||
| Higher interval limit. | |||
| Amount | Int | ||
| Surcharge defined based on order price/weight. | |||
| ApplyTo | String | ||
|
Possible values:
|
|||
| Pagination | Object | ||
| Pagination filters. | |||
| Page | Int | ||
| Number of pages used for displaying the results. | |||
| Limit | Int | ||
| Number for limiting the results. | |||
| Count | Int | ||
| Total number of results. | |||
Extend a subscription
Overview
Use the Extend functionality available in the Subscription info area to prolong the lifetime of a subscription or to reduce the period of time it can be used by a customer.
When the subscription lifetime settings are updated using the Extend functionality, these will take precedence and override per-product configuration.
Retrieve account balance
Overview
Use getPendingPayout to retrieve a detailed estimation of the amount that 2Checkout owes you, based on the sales from your current payout period.
The amounts returned by this API method are approximations, and may not represent the final amount that 2Checkout will pay you at the end of the billing period.
Parameters
| Parameters | Type/Description | |
|---|---|---|
| inputParameters |
Object (Optional) Details below |
|
| Currency | String (Optional) | |
|
Use this parameter to show the balance only for a single order currency. Example: 'USD'. If not sent, or sent as NULL, 2Checkout sends the balance for all order currencies. |
||
| TotalCurrency | String (Optional) | |
|
Use this parameter to show the total account balance in the preferred currency. Example: 'EUR'. If not sent, or sent as NULL, 2Checkout sends the total balance in the default account currency. |
||
Request
<?php
require('PATH_TO_AUTH');
$inputParameters = new StdClass();
$inputParameters->Currency = "USD";
$inputParameters->TotalCurrency = "EUR";
try {
$pendingPayout = $client->getPendingPayout($sessionID, $inputParameters);
}
catch (SoapFault $e) {
echo "pendingPayout: " . $e->getMessage();
exit;
}
var_dump("pendingPayout", $pendingPayout);
Response
Pending Payout Object
| Parameters | Type/Description | ||
|---|---|---|---|
| Currencies |
Array of objects Details below |
||
| CurrencyObject |
Object Details below |
||
| Currency |
String |
||
| Order currency. | |||
| OrdersTotal |
Object Total order amounts, divided per order source. |
||
| estore | Float | ||
| eStore order amounts from the current payout cycle. | |||
| affiliates | Float | ||
| Amounts from your affiliates orders, during the current payout cycle. | |||
| partner | Float | ||
| Amounts from your partner sales, during the current payout cycle. | |||
| total | Float | ||
| Total sales amount made in the order currency from this object, during the current payout cycle. | |||
| RetainedToDisputesBalance | Float | ||
| Amounts retained to your dispute balance reports, in the object order currency. | |||
| ReleasedFromDisputesBalance | Float | ||
| Amounts released from your dispute balance reports, in the object order currency. | |||
| RetainedToRollingReserveBalance | Float | ||
| Amounts retained to your rolling reserve, in the object order currency. | |||
| ReleasedFromRollingReserveBalance | Float | ||
| Amounts retained to your rolling reserve, in the object order currency | |||
| ChargebackFees | Float | ||
| Chargeback fees retained in the object order currency. | |||
| ProcessingFees | Float | ||
| Processing fees retained by 2Checkout in the object order currency. | |||
| AffiliatesCommission | Float | ||
| Affiliate commissions paid by 2Checkout in the object order currency. | |||
| TaxCollected | Float | ||
| Tax collected by 2Checkout in the object order currency. | |||
| EstimatedTotalRevenue | Float | ||
| The estimated total revenue for the object order currency. | |||
| Total |
Object Total account balance amount |
||
| Currency |
String |
||
| Currency in which the total account balance is expressed. If not sent during the API call, 2Checkout uses the account default currency. | |||
| OrdersTotal |
|
Object Total order amounts, divided per order source. |
|
| estore | Float | ||
| Amounts from total eStore orders during the currency payout cycle. | |||
| affiliates | Float | ||
| Amounts from total affiliates orders during the currency payout cycle. | |||
| partner | Float | ||
| Amounts from total partner orders during the currency payout cycle. | |||
| total | Float | ||
| Total sales amount during the currency payout cycle. | |||
| RetainedToDisputesBalance | Float | ||
| Total amounts retained to your dispute balance during the current payout cycle. | |||
| RetainedFromDisputesBalance | Float | ||
| Total amounts released from your dispute balance during the current payout cycle. | |||
| RetainedToRollingReserveBalance | Float | ||
| Total amounts retained to your rolling reserve during the current payout cycle. | |||
| RetainedFromRollingReserveBalance | Float | ||
| Total amounts released from your rolling reserve during the current payout cycle. | |||
| ChargebackFees | Float | ||
| Total chargeback fees retained from your account during the currency payout cycle. | |||
| ProcessingFees | Float | ||
| Total processing fees retained by 2Checkout during the current payout cycle. | |||
| AffiliatesCommission | Float | ||
| Total affiliates commissions paid by 2Checkout during the current payout cycle. | |||
| TaxCollected | Float | ||
| Total tax amount collected by 2Checkout during the current payout cycle. | |||
| EstimatedTotalRevenue | Float | ||
| Total estimated revenue for the current payout cycle. | |||
Remove product coupon
Overview
Use this method to remove discount coupons applied to products added to cart.
Requirements
Parameters
| Parameters | Type/Description |
|---|---|
| sessionID | Required (String) |
| Session identifier, which is the output of the Login method. An exception is thrown if the values are incorrect | |
| coupon | Required (String) |
| The coupon/voucher code for a promotion impacting a product added to cart. |
Response
| Parameters | Type/Description |
|---|---|
| result | Boolean |
| True or false |
Request
<?php
require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner
require('PATH_TO_addProduct'); // addProduct example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/08Place_an_order/00Add_product_to_cart
require('PATH_TO_setCoupon'); // setCoupon example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/08Place_an_order/06Add_product_coupon
$couponCode = 'COUPON_CODE_TO_REMOVE';
try {
$DeletedCoupon = $client->deleteCoupon ($sessionID, $couponCode);
} catch (SoapFault $e) {
echo "Promotion: " . $e->getMessage();
exit;
}
var_dump ("Promotion ", $DeletedCoupon);
Errors
| Error | Description |
|---|---|
|
EMPTY_CART |
The shopping cart is empty |
|
INVALID_COUPON_CODE |
The coupon code is empty |
|
INVALID_COUPON |
The coupon code is not applied to cart |
Product group
Overview
Use the ProductGroup object to create/add and update/edit product groups.
Parameters
| ProductGroup | Object |
|---|---|
|
Name |
(string) Required when creating a product group. |
|
|
The name of the product group. |
| Code | (string ) Required when updating/retrieving a product group. |
| Unique, system-generated identifier assigned to product groups. | |
|
TemplateName |
(string) Optional |
|
|
Leave empty to assign the Default Template to the product.
Or use the name of an active shopping cart template. |
|
Description |
(string) Optional |
|
|
The description of the product group. |
Recurring payment failed (instant payment methods)
Overview
Use the variables in the list below to customize the Recurring payment failed (instant payment methods) 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 |
|---|---|---|---|
| 2CHECKOUT_LOGO | 2Checkout logo URL | https://secure.avangate.com/images/e...endor_logo.png | Yes |
| 2CHECKOUT_RESELLER_ROLE | This is mandatory content you need to keep in your emails, given 2Checkout acts as Reseller/Merchant of Record for online purchases on your website. | 2Checkout acts as authorized reseller of #Merchant commercial name online products and services. | Yes |
|
2CHECKOUT_SUPPORT_EMAIL |
2Checkout support email address |
Yes | |
|
2CHECKOUT_WEBSITE |
2Checkout website |
Yes | |
|
BUSINESS_COMPANY |
2Checkout company name |
2Checkout |
No |
|
BUSINESS_FAX |
2Checkout fax number |
+1 (650) 963-5701 |
No |
|
BUSINESS_HOTLINE |
2Checkout support phone |
0 |
No |
|
BUSINESS_HOTLINEUS |
2Checkout US hotline number |
0 |
No |
|
BUSINESS_OPEMAIL |
2Checkout operational email address |
0 |
No |
|
BUSINESS_OPFAX |
2Checkout operational fax number |
0 |
No |
|
BUSINESS_SUPEMAIL |
2Checkout support email address |
support@2checkout.com | No |
|
BUSINESS_WEBSITE |
2Checkout website |
https://www.2checkout.com | No |
|
CARD_LAST_DIGITS |
Last 4 digits of the card used to perform the payment |
0 |
No |
|
COMMERCIALNAME |
Merchant's commercial name |
[Software Company Name] |
|
|
CURRENCY |
Order billing currency |
EUR |
Yes |
|
CURRENCY_ORIGINAL |
Original order currency (applicable to refunds) |
0 |
No |
|
DISPLAY_MY_ACCOUNT_INFO |
Include or exclude myAccount information in the email body |
1 |
No |
|
ENCRYPTED_MERCHANT_CODE |
Encrypted merchant code |
FGTH45HG |
No |
|
FIRSTNAME |
Shopper's first name used on the billing information |
First |
No |
|
FIRST_NAME_BILLING |
Shopper's first name used on the billing information |
John |
No |
| GATEWAY_ERROR_CODE | Gateway error code | GW_PROCESSING_ERROR | No |
| GATEWAY_ERROR_MESSAGE | Reason why the transaction failed. (e.g. Invalid card, insufficient funds) | Error processing the card transaction. The card account has not been debited. Card data is invalid or incomplete. | No |
|
GENERALTOTAL |
Total order price |
23 |
No |
|
HAS_RENEWAL_PRODUCTS |
Flag that indicates whether at least one product has renewal settings |
0 |
No |
|
HOTLINE_NUMBERS |
0 |
0 |
No |
|
IS_CONVERSION_FROM_TRIAL |
Flag that states if the current order comes from a trial conversion |
0 |
No |
|
IS_RENEWAL |
Flag that indicates whether at least one product has renewal settings |
0 |
No |
|
IS_TRIAL_RENEWAL |
Flag that states if the current order comes from a trial conversion |
0 |
No |
|
LASTNAME |
Shopper's last name used on the billing information |
Last |
No |
|
LAST_NAME_BILLING |
Shopper's last name used on the billing information |
Doe |
No |
|
MERCHANT_COMMERCIAL_NAME |
Merchant's commercial name |
Software Company Name |
No |
|
MYACCOUNT_URL_UPDATE_CC |
URL for updating credit card information in myAccount |
0 |
No |
|
MY_ACCOUNT_LOGIN_EMAIL |
Email address used by shopper to login/signup to myAccount |
No | |
|
MY_ACCOUNT_LOGIN_URL |
2Checkout myAccount login/sign-up URL |
secure.sofware-company-website.com/myaccount/?lang=en |
Yes |
|
MY_ACCOUNT_URL_UPDATE_CC |
URL for updating credit card information in myAccount |
No | |
|
NAMES_OF_PRODUCTS |
Names of all products in the order, comma-separated |
Product name |
Yes |
|
ORDERDATE |
Order placement date |
41641 |
No |
|
ORDER_AMOUNT_ORIGINAL |
Original order value (applicable to refunds) |
0 |
No |
|
ORDER_DATE |
Order placement date |
42563 |
No |
|
ORDER_DATE_STANDARD_FORMAT |
Standard format used for the order placement date |
0 |
Yes |
|
ORDER_FLOW |
Purchase flow used to place the order |
0 |
No |
|
ORDER_REFERENCE_NUMBER |
Order reference number |
9xxxxxx |
Yes |
|
ORDER_STATUS |
Order status |
0 |
No |
|
ORDER_WEBSITE |
Website where the shopper placed the order |
Yes | |
|
PAYABLE_TO |
Payee name (applicable to wire transfer) |
0 |
No |
|
PAYMENT_METHOD |
English name for the payment method used |
Visa/MasterCard/Eurocard |
Yes |
|
PAYMENT_TYPE_INFO |
English payment method name. Includes last four card digits (if applicable). |
0 |
No |
|
PAYMETHOD |
The English name for the payment method used |
0 |
No |
|
PAYTYPE |
Identification number for the payment method selected during the ordering process |
5 |
No |
|
PRODUCTS |
0 |
0 |
No |
|
PRODUCTS[index1].BILLING_CYCLE |
Indicates how many renewals have been successfully performed so far (on the subscription) |
11 |
No |
|
PRODUCTS[index1].DISCOUNT |
Product discount value per product line |
2 |
No |
|
PRODUCTS[index1].INFO |
Additional product information defined by the merchant when generating buy links |
[Product name info] |
No |
|
PRODUCTS[index1].LICENSE_TYPE |
Type of purchased subscription |
TRIAL |
No |
|
PRODUCTS[index1].NAME |
Product name |
Product name |
No |
|
PRODUCTS[index1].PCODE |
Product code. |
2016 |
No |
|
PRODUCTS[index1].PID |
Product ID number |
4572431 |
No |
|
PRODUCTS[index1].PNAME |
Product name |
Product name |
No |
|
PRODUCTS[index1].PRICE |
Product unit price |
20 |
No |
|
PRODUCTS[index1].PRODUCT_OPTIONS |
0 |
0 |
No |
|
PRODUCTS[index1].PRODUCT_OPTIONS[index2].OptionText |
Ignore internal var. |
0 |
No |
|
PRODUCTS[index1].PROMONAME |
Name of the promotion applied to the product |
[Some promotion] |
No |
|
PRODUCTS[index1].QUANTITY |
Purchased product quantity |
[1] |
No |
|
PRODUCTS[index1].SHORT_DESCRIPTION |
Short product description |
0 |
No |
|
PRODUCTS[index1].SUBSCRIPTION_EXPIRATION_DATE |
Subscription expiration date |
42594 |
No |
|
PRODUCTS[index1].TOTAL |
Total gross price per product line (before applying discounts) |
23,00 |
No |
|
PRODUCTS[index1].VAT |
VAT/Sales tax value per product line |
5 |
No |
|
PRODUCTS_DATA[index1].IdProduct |
Product ID number |
0 |
No |
|
PRODUCTS_DATA[index1].PRODUCT_SHORT_DESCRIPTION |
Short product description |
0 |
No |
|
PRODUCTS_LIST |
Products data. |
Product name |
No |
|
PRODUCTS_NO |
Number of products in the cart |
1 |
No |
|
QR_CODE_SRC |
The QR code URL to be used for payments with bank/wire transfer |
0 |
No |
|
REFNO |
Order reference number |
[9xxxxx] |
No |
|
RETRYLINK |
Payment retry link |
No | |
|
RETRY_LINK |
Payment retry link |
0 |
Yes |
|
SELLERCOMPANY |
Merchant's company name |
0 |
No |
|
TOTALEQUIV |
The order amount converted to all the merchant's currencies |
0 |
No |
|
UNSUBSCRIBE_LINK |
Shopper unsubscribe link |
0 |
No |
|
UPLOADLINK |
File upload link |
0 |
No |
|
UPLOAD_LINK |
File upload link |
0 |
No |
|
WEBSITE |
Website where the shopper placed the order |
No |