Product
Overview
This object is returned directly or within a successful response from the following API requests:
Retrieve products by ID Retrieve products by code Search products
Product object
Parameters | Type/Description | |
---|---|---|
AvangateId |
String |
|
|
Unique, system-generated 2Checkout product ID. Read-only. |
|
ProductCode |
String |
|
|
The product code that you can define for each of your offerings. Needs to be unique. |
|
ExternalReference | String | |
External reference that you control when defining the product. | ||
ProductType |
String |
|
|
REGULAR or BUNDLE |
|
ProductName |
String |
|
|
The name of the product |
|
ProductVersion |
String |
|
|
The product version number |
|
PurchaseMultipleUnits | Boolean | |
Possible values:
The default value is TRUE. |
||
Tangible | Boolean | |
Possible values:
|
||
Boolean | ||
TangibleDetails | Object | |
Only for physical products. Contains information related to product's physical setup. | ||
UnitDetails | Array of objects | |
Details on tangible setup. | ||
Type | String | |
Product physical configuration type. Example: "WEIGHT". | ||
Amount | String | |
Product's tangible weight. Example: "5". | ||
Fee | Array of objects | |
Details on handling fees associated with a tangible product. | ||
Currency | String | |
Currency of the handling fee. Example: "USD" | ||
Amount | String | |
Handling fee amount defined on the tangible product. Example: "5". | ||
ProductGroup | Object | |
Product group information. | ||
Name | String | |
Product group name | ||
Code | String | |
Product group code generated when you create the group | ||
TemplateName | String | |
Default cart template used when generating buy links for products from this group. | ||
Description | String | |
Product group description. | ||
ShippingClass |
Object |
|
|
Existing shipping class object with the structure detailed below. |
|
|
Name |
String |
|
|
The name of the shipping class |
|
Amount |
Decimal |
|
|
The shipping costs |
|
Currency |
String |
|
|
The currency ISO code used for shipping costs - ISO 4217. |
|
ApplyTo |
String |
|
|
Possible values: • PRODUCT • ORDER |
|
Type |
Possible values: • FIXED • PERCENT |
GiftOption |
Boolean |
|
|
True or false depending on whether the product can be gifted or not. |
|
ShortDescription |
String |
|
|
Product's short description. |
|
LongDescription |
String |
|
|
Product's long description. |
|
SystemRequirements |
String |
|
|
System requirements |
|
ProductCategory |
String |
|
|
Product category |
|
Platforms |
Array of Platform objects |
|
|
Array of objects detailing the platforms supported by the application. Details below. |
|
|
PlatformName |
String |
|
|
The label of the platform per the product configuration. |
|
Category |
String |
|
|
Platform category per product configuration. |
ProductImages |
Array of Image objects |
|
|
Image object. Details below. Read-only. |
|
|
Default |
Boolean |
|
|
True or False depending on whether you set the image stored at the address in the URL parameter as default or not. |
|
URL |
String |
|
|
The location of the image on the 2Checkout system. |
TrialUrl |
String (anyURI) |
|
|
The URL from where shoppers can download trial software. |
|
TrialDescription |
String |
|
|
Descriptive text entered for trials. |
|
Enabled |
Boolean |
|
|
True/false depending on whether the products are active or disabled. When empty, 2Checkout marks the product as disabled. |
|
AdditionalFields |
Array of AdditionalFieldAssigned objects |
|
|
Array of existing additional fields assigned to products. Details below. |
|
|
Label |
String |
|
|
The name of the additional field assigned to a product. |
|
Code |
String |
|
|
The code of the additional field assigned to a product. |
|
Enabled |
Boolean |
|
|
True or false depending on whether the assigned product field is enabled or not. |
|
Required |
Boolean |
|
|
True or false depending on whether the assigned product field is required or not. |
|
URLParameter |
String |
|
|
The value of the system generated URL parameter for the product field that can be used in Buy Links. |
Translations |
Array of ProductTranslation objects |
|
|
Details below. |
|
|
LongDescription |
String |
|
|
The translated long description in the language corresponding to the Translation object. |
|
TrialUrl |
String |
|
|
The trial URL for users speaking the language corresponding to the Translation object. |
|
TrialDescription |
String |
|
|
|
|
SystemRequirements |
String |
|
|
Localized system requirements. |
|
Name |
String |
|
|
Localized product name. |
|
Description |
String |
|
|
Localized product short description. |
|
Language |
String |
|
|
ISO 639-1 two-letter code. |
PricingConfigurations |
Array of PricingConfiguration objects |
|
|
Details below. 2Checkout creates pricing configurations during the process when you add a product. |
|
|
Name |
String |
|
|
Pricing configuration name |
|
Code |
String |
|
|
System-generated identifier. |
|
Default |
boolean |
|
|
True for the default pricing configuration |
|
BillingCountries |
Array of strings |
|
|
ISO codes of the countries assigned to the pricing configuration. Empty unless specific countries are assigned to a pricing configuration. |
|
PricingSchema |
String |
|
|
DYNAMIC – With a base price FLAT – Without a base price |
|
PriceType |
String |
|
|
Possible values: NET / GROSS |
|
DefaultCurrency |
String |
|
|
The ISO code of the default currency for the pricing configuration |
|
Prices |
Object |
|
|
Details below. |
|
Regular |
Array of objects |
|
|
Details below. |
|
Amount |
Int |
|
|
The price of the product. |
|
Currency |
String |
|
|
ISO code of the currency for the product price. |
|
MinQuantity |
Int |
|
|
The minimum quantity of volume discounts. Default is 1. |
|
MaxQuantity |
Int |
|
|
The maximum quantity of volume discounts. Default is 99999. |
|
OptionCodes |
Array of objects |
|
|
Details below. |
|
Code |
String |
|
|
Price option identifier. |
|
Options |
Array of strings |
|
|
The pricing options group option code you configured that the 2Checkout system uses to calculate product prices for pricing configurations without a base price. |
|
Renewal |
Array of objects |
|
|
Details below. |
|
Amount |
Int |
|
|
The price of the product. |
|
Currency |
String |
|
|
ISO code of the currency for the product price. |
|
MinQuantity |
Int |
|
|
The minimum quantity of volume discounts. Default is 1. |
|
MaxQuantity |
Int |
|
|
The maximum quantity of volume discounts. Default is 99999. |
|
OptionCodes |
Array of PriceOptionCode objects |
|
|
Details below. |
|
Code |
String |
|
|
Price option identifier. |
|
Options |
Array of strings |
|
|
The pricing options group option code you configured that the 2Checkout system uses to calculate product prices for pricing configurations without a base price. |
|
PriceOptions |
Array of AssignedPriceOptionGroup objects |
|
|
Details below. |
|
Code |
String |
|
|
System generated pricing options group code (you can also configure it) that the 2Checkout system uses to calculate product prices for pricing configurations without a base price. |
|
Required |
Boolean |
|
|
True or False depending on whether you want to make it mandatory for shoppers to select the price option during the puyrchase process. |
BundleProducts |
Array of BundleProductCode objects |
|
|
Details below. |
|
|
ProductId |
String |
|
|
Unique, system-generated product ID. |
|
ProductCode |
String |
|
|
Editable product code that you control. |
Fulfillment |
String |
|
|
BY_AVANGATE NO_DELIVERY – The 2Checkout system finalizes orders immediately after it receives payment confirmation. BY_VENDOR – you are responsible for delivering/fulfilling orders |
|
Prices |
Array of Price objects |
|
|
Use this object only when Pricing Configurations are not available for your account. Details below. |
|
|
Amount |
Int |
|
|
The price of the product. |
|
Currency |
String |
|
|
ISO code of the currency for the product price. |
|
MinQuantity |
Int |
|
|
The minimum quantity of volume discounts. Default is 1. |
|
MaxQuantity |
Int |
|
|
The maximum quantity of volume discounts. Default is 99999. |
|
OptionCodes |
Array of objects |
|
|
Details below. |
|
Code |
String |
|
|
Price option identifier. |
|
Options |
Array of strings |
|
|
The pricing options group option code you configured that the 2Checkout system uses to calculate product prices for pricing configurations without a base price. |
GeneratesSubscription |
Boolean |
|
|
TRUE or FALSE depending on whether you set the product to generate subscriptions or not.
NULL for bundles for which you set the following subscription management option: “Use the subscription settings of each product in the bundle” |
|
SubscriptionInformation |
ProductSubscriptionInformation Object |
|
|
Details below. NULL for bundles which you set to use the renewal settings of child products and not of the parent bundle. |
|
|
DeprecatedProducts |
Array |
|
|
Deprecated products. |
|
BundleRenewalManagement |
String |
|
|
Possible values:
Can be NULL. |
|
BillingCycle |
String |
|
|
The number of subscription billing cycle units (months or days). Possible values:
Days
Months
|
|
BillingCycleUnits |
String |
|
|
The units of the billing cycle:
|
|
IsOneTimeFee |
Boolean |
|
|
True or False depending on whether the subscription is evergreen or not. |
|
ContractPeriod |
Object |
|
|
Details below. |
|
Period |
Int |
|
|
The contract period in months or days. -1 for unlimited contracts. |
|
PeriodUnits |
String |
|
|
The contract period units days | months |
|
IsUnlimited |
Boolean |
|
|
This flag is true if the contract is for an unlimited period |
|
Action |
String |
|
|
The action performed after the subscription expires. Possible values CANCEL | RESTART |
|
EmailsDuringContract Boolean |
|
|
|
True or False depending on whether you suppress renewal notification emails throughout the duration of the contract or not. |
|
UsageBilling |
Int |
|
|
The usage billing interval must be smaller than or equal to the grace period.
Interval of time within the grace period, when the 2Checkout system attempts to automatically charge customers for recurring costs and additional metered usage fees (in arrears). 2Checkout renews subscriptions only after subscribers make all outstanding payments per the renewal settings (from the expiration or the renewal date). If automatic renewal and usage charges fail, subscriptions can be manually renewed only by the end of the grace period, after which they expire.
Can be NULL. |
|
GracePeriod |
Object |
|
Type |
String |
|
|
CUSTOM – you configured grace period setting at product level. GLOBAL – global grace period settings apply. |
|
Period |
String |
|
|
Number of days set for the grace period. |
|
PeriodUnits |
String |
|
|
D - Days. |
|
IsUnlimited |
Boolean |
|
|
TRUE or FALSE depending on whether you set the grace period to unlimited or not. |
|
RenewalEmails |
Object |
|
|
Details below. Can be NULL. Available only in Product API 2.5 and later. |
|
Type |
String |
|
|
GLOBAL - Send emails according to the global renewal notification settings. CUSTOM – per product renewal notification settings |
|
Settings |
Object (can be NULL) |
|
|
Details below. |
|
ManualRenewal |
Object (can be NULL) |
|
|
Details below. |
|
Before30Days |
Boolean |
|
|
True or False. |
|
Before15Days |
Boolean |
|
|
True or False. |
|
Before7Days |
Boolean |
|
|
True or False. |
|
Before1Day |
Boolean |
|
|
True or False. |
|
OnExpirationDate |
Boolean |
|
|
True or False. |
|
After5Days |
Boolean |
|
|
True or False. |
|
After15Days |
Boolean |
|
|
True or False. |
|
AutomaticRenewal |
Object (can be NULL) |
|
|
Details below. |
|
Before30Days |
Boolean |
|
|
True or False. |
|
Before15Days |
Boolean |
|
|
True or False. |
|
Before7Days |
Boolean |
|
|
True or False. |
|
Before1Day |
Boolean |
|
|
True or False. |
|
OnExpirationDate |
Boolean |
|
|
True or False. |
|
After5Days |
Boolean |
|
|
True or False. |
|
After15Days |
Boolean |
|
|
True or False. |
FulfillmentInformation |
Object |
|
|
Details below. Can be NULL. Available only in Product API 2.5 and later. |
|
|
IsStartAfterFulfillment |
Boolean |
|
|
True or False. Depending on whether you want the subscription lifetime to start afther the completion of the fulfillment process or not. |
|
IsElectronicCode |
Boolean |
|
|
True or False. Depending on whether you configure the delivery of keys/codes for the product or not. |
|
IsDownloadLink |
Boolean |
|
|
True or False. Depending on whether you configure the delivery of a product file or not. |
|
IsBackupMedia |
Boolean |
|
|
True or False. Depending on whether you configure the delivery of backup media or not. |
|
IsDownloadInsuranceService |
Boolean |
|
|
True or False. Depending on whether you enable the Download Insurance Service or not, for a product for which you configure a product file. |
|
IsInstantDeliveryThankYouPage |
Boolean |
|
|
True or False. Depending on whether you enable instant delivery in the Thank You page or not. |
|
IsDisplayInPartnersCPanel |
Boolean |
|
|
True or False. Depending on whether you share access to the product file with your channel partners or not. |
ReturnMethod | Object | |
Information on the customer redirect method after a successful purchase. | ||
Type | String | |
Possible values:
|
||
URL | String | |
Website to which customers are redirected after a successful purchase. Example: "http://mySuccessURL.com" | ||
|
CodeList |
Object (can be NULL) |
|
|
Details below. |
|
Code |
String |
|
|
The unique code list identifier. |
|
Name |
String |
|
|
Name of the code list. |
|
Type |
String |
|
|
Code list type:
|
|
BackupMedia |
Object (can be NULL) |
|
|
Details below. |
|
Code |
String |
|
|
The unique backup media identifier. |
|
Name |
String |
|
|
Name of the backup CD/DVD. |
|
Type |
String |
|
|
Media type: CD |
|
ProductFile |
Object (can be NULL) |
|
|
Details below. |
|
Code |
String |
|
|
Unique product file identifier. |
|
Name |
String |
|
|
Display name. |
|
File |
String |
|
|
Name of the product file. |
|
Version |
String |
|
|
File version. |
|
Size |
String |
|
|
File size. |
|
Type |
String |
|
|
File type. |
|
LastUpdate |
String |
|
|
YYYY-MM-DD HH-MM-SS. Date time stamp when you last updated the file. |
|
AdditionalInformationByEmail |
String (can be NULL) |
|
|
The text you set up in the Additional fulfillment information - by email area. |
|
AdditionalInformationEmailTranslations |
Object (can be NULL) |
|
|
Array of localized Additional fulfillment information - by email texts. |
|
AdditionalThankYouPage |
String (can be NULL) |
|
|
The text you set up in the Additional fulfillment information - "Thank you" page area. |
|
AdditionalThankYouPageTranslations |
Array (can be NULL) |
|
|
Array of localized Additional fulfillment information - "Thank you" page texts. |
Add pricing configuration
Overview
Use the addPricingConfiguration method to add a new pricing configuration for your account.
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) |
|
|
Use this object to add a new pricing configuration for your account. |
ProductCode |
Required (string) |
|
The code of the produt you assign the configuration to. |
Response
bool(true)
Request
<?php
require ('PATH_TO_AUTH');
$PricingConfiguration = new stdClass();
$PricingConfiguration->Default = True;
$PricingConfiguration->Name = 'New Pricing Configuration Through API';
$PricingConfiguration->BillingCountries = array();
$PricingConfiguration->BillingCountries[0] = 'RO';
$PricingConfiguration->BillingCountries[1] = 'DE';
$PricingConfiguration->PricingSchema = 'DYNAMIC';
$PricingConfiguration->PriceType = 'NET';
$PricingConfiguration->DefaultCurrency = 'USD';
$PricingConfiguration->Prices = new stdClass();
$PricingConfiguration->Prices->Regular = array();
$PricingConfiguration->Prices->Regular[0] = new stdClass();
$PricingConfiguration->Prices->Regular[0]->Amount = 69.09;
$PricingConfiguration->Prices->Regular[0]->Currency = 'USD';
$PricingConfiguration->Prices->Regular[0]->MinQuantity = 1;
$PricingConfiguration->Prices->Regular[0]->MaxQuantity = 35;
$PricingConfiguration->Prices->Regular[0]->OptionCodes = array();
$PricingConfiguration->Prices->Regular[0]->OptionCodes[0] = new stdClass();
$PricingConfiguration->Prices->Regular[0]->OptionCodes[0]->Code = 'G77ICHEM1C';
$PricingConfiguration->Prices->Regular[0]->OptionCodes[0]->Options = array();
$PricingConfiguration->Prices->Regular[0]->OptionCodes[0]->Options[0] = 'zh5onfolw7';
$PricingConfiguration->Prices->Regular[0]->OptionCodes[0]->Options[1] = '75rjldfcnz';
$PricingConfiguration->Prices->Regular[0]->OptionCodes[1] = new stdClass();
$PricingConfiguration->Prices->Regular[0]->OptionCodes[1]->Code = 'BAWAQB8LZP';
$PricingConfiguration->Prices->Regular[0]->OptionCodes[1]->Options = array();
$PricingConfiguration->Prices->Regular[0]->OptionCodes[1]->Options[0] = 'r3oi06opvi';
$PricingConfiguration->Prices->Regular[0]->OptionCodes[1]->Options[1] = '76gqbq4bhd';
$PricingConfiguration->Prices->Regular[1] = new stdClass();
$PricingConfiguration->Prices->Regular[1]->Amount = 64.66;
$PricingConfiguration->Prices->Regular[1]->Currency = 'USD';
$PricingConfiguration->Prices->Regular[1]->MinQuantity = 36;
$PricingConfiguration->Prices->Regular[1]->MaxQuantity = 83;
$PricingConfiguration->Prices->Regular[1]->OptionCodes = array();
$PricingConfiguration->Prices->Regular[1]->OptionCodes[0] = new stdClass();
$PricingConfiguration->Prices->Regular[1]->OptionCodes[0]->Code = '8RNXV3T3RE';
$PricingConfiguration->Prices->Regular[1]->OptionCodes[0]->Options = array();
$PricingConfiguration->Prices->Regular[1]->OptionCodes[0]->Options[0] = 'rorqkqnd9p';
$PricingConfiguration->Prices->Regular[1]->OptionCodes[0]->Options[1] = 'aeu89gqdg6';
$PricingConfiguration->Prices->Regular[1]->OptionCodes[1] = new stdClass();
$PricingConfiguration->Prices->Regular[1]->OptionCodes[1]->Code = 'DJYD713MKC';
$PricingConfiguration->Prices->Regular[1]->OptionCodes[1]->Options = array();
$PricingConfiguration->Prices->Regular[1]->OptionCodes[1]->Options[0] = 'y2z2squ7c1';
$PricingConfiguration->Prices->Regular[1]->OptionCodes[1]->Options[1] = 'g74qfskbjg';
$PricingConfiguration->Prices->Renewal = array();
$PricingConfiguration->Prices->Renewal[0] = new stdClass();
$PricingConfiguration->Prices->Renewal[0]->Amount = 7.89;
$PricingConfiguration->Prices->Renewal[0]->Currency = 'USD';
$PricingConfiguration->PriceOptions = array();
$PricingConfiguration->PriceOptions[0] = new stdClass();
$PricingConfiguration->PriceOptions[0]->Code = 'FKQ8CFLYKM';
$PricingConfiguration->PriceOptions[0]->Required = false;
$PricingConfiguration->PriceOptions[1] = new stdClass();
$PricingConfiguration->PriceOptions[1]->Code = 'TH1HKFOTFR';
$PricingConfiguration->PriceOptions[1]->Required = true;
$ProductCode= 'test';
try {
$NewPricingConfiguration = $client->addPricingConfiguration($sessionID, $PricingConfiguration, $ProductCode);
}
catch (SoapFault $e) {
echo "NewPricingConfiguration: " . $e->getMessage();
exit;
}
var_dump("NewPricingConfiguration", $NewPricingConfiguration);
?>
SSO in cart
Overview
Use the getSingleSignOnInCart method. 2Checkout attaches a unique token to links, designed to identify the returning shoppers and support the automatic extraction of payment data and billing information from the 2Checkout system. For example, you can generate single sign on in cart links for existing customers logged into your website based on their external or 2Checkout customer IDs.
How does this work?
When accessing the shopping cart using tokenized payment links:
- 2Checkout prefills automatically customer billing and delivery details associated with their 2Checkout customer accounts (linked based on their unique customer IDs).
- 2Checkout presents shoppers with an optimized payment area featuring the credit / debit cards used to make previous purchases / transactions in the 2Checkout system. Customers have the option of selecting one of the payment methods depending on available card-on-file data.
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. |
Customer |
Required (string) |
Unique customer identifiers. Can be either the ExternalCustomerReference you control or the system-generated AvangateCustomerReference. |
|
customerType |
Required (string) |
|
Possible values:
|
url |
Required (string) |
|
The shopping cart URL. 2Checkout redirects shoppers to this URL.
Possible values:
Any buy link you generate from the cPanel or using the API. Note: For the time being, payment tokenization does not support Express Payments Checkout or the 2Checkout mobile shopping cart. |
validityTime |
Optional (int) |
|
The time, in seconds, before the single sign-on URL expires. By default, the URL expires after 10 seconds. (optional) |
validationIp |
Optional (string) |
|
The IP address of the shopper, necessary for security purposes. Can be an empty string or a valid IP, or null. |
Response
Parameters | Type/Description |
---|---|
Single sign-on URL |
String |
The generated string is the tokenized time-limited single sign-on URL pointing to 2Checkout shopping cart.
Note: Each SSO link cleans any previous cart sessions. Shoppers using multiple SSO links would purchase only a single product at a time.
If shoppers add multiple products to cart via SSO buy links and then use a non-SSO link, they’ll purchase all items using the same order. When you use single sign on in cart for customers without card on files in the 2Checkout system, the generated tokenized link prefills the billing information but the purchase process requires that shoppers provide payment information, such as a credit or debit card.
Important! You can use the value of the logintoken to retrieve customer information by SSO token.
|
Request
<?php
require ('PATH_TO_AUTH');
$idCustomer = '352365983';
$customerType = 'AvangateCustomerReference';
$url = 'https://store.avancart.com/order/checkout.php?PRODS=4639321&QTY=1&CART=1&CARD=2';
$validityTime = 50;
$validationIp = null;
try {
$ssoLINK = $client->getSingleSignOnInCart($sessionID, $idCustomer, $customerType, $url, $validityTime, $validationIp);
}
catch (SoapFault $e) {
echo "ssoLINK: " . $e->getMessage();
exit;
}
var_dump("ssoLINK", $ssoLINK);
Use iDEAL
Overview
Place an order with catalog products defined in your Control Panel and collect the payment using iDEAL.
Requirements
One shoppers from Netherlands can purchase using iDEAL. The billing country and the order country code has to be NL.
Supported currencies
- EUR
Workflow
- Use the getIdealIssuerBanks method for retrieving information on the Avangate list of banks that support iDEAL payments. More details about this method here.
- Shoppers select iDEAL as payment option in the interface you provide them, and select their bank from the list.
- Create the order object. Use IDEAL as the type of the PaymentDetails object, and include ReturnURL and CancelURL. The BankCode parameter should be added based on the bank selected by the customer, from the array obtained after calling method getIdealIssuerBanks.
- Use the placeOrder method to send the data to Avangate.
- Once you place the order, Avangate logs it into the system. At this point in time, the status of the order is PENDING.
- Avangate returns an Order object as the output of the placeOrder method.
- Use the PaymentMethod object to create a redirect URL for the shoppers, concatenating the values of the Href and avng8apitoken parameters. Here's an example of the redirect URL:
https://api.avangate.com/4.0/scripts/ideal/authorize/?avng8apitoken=f56373d92ed6b153
- Customers are directed to the iDEAL payment page, where they have to confirm their payment details before finishing the ordering process.
- Shoppers are redirected to the RedirectURL from the Order information object. In case the payment fails, shoppers are redirected to the CancelURL.
Parameters
Parameters | Type/Description |
---|---|
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. Avangate throws an exception if the values are incorrect. The sessionID expires in 10 minutes. |
Order |
Required (Object) |
|
Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details. To place an order with iDEAL, use IDEAL as the type of the PaymentDetails object and provide the following parameters as part of the PaymentMethod object:
See code sample for more details. |
Response
Order information | Object |
---|---|
Object containing order information. |
Request
<?php
require ('PATH_TO_AUTH');
$Order = new stdClass();
$Order->RefNo = NULL;
$Order->Currency = 'eur';
$Order->Country = 'NL';
$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]->Promotion = NULL;
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'FirstName';
$Order->BillingDetails->LastName = 'LastName';
$Order->BillingDetails->CountryCode = 'nl';
$Order->BillingDetails->State = 'California';
$Order->BillingDetails->City = 'LA';
$Order->BillingDetails->Address1 = 'Address example';
$Order->BillingDetails->Address2 = NULL;
$Order->BillingDetails->Zip = '90210';
$Order->BillingDetails->Email = 'customer@email.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'IDEAL';
$Order->PaymentDetails->Currency = 'eur';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->PaymentDetails->CustomerIP = '91.220.121.21';
$Order->PaymentDetails->PaymentMethod->ReturnURL = 'http://facebook.com';
$Order->PaymentDetails->PaymentMethod->CancelURL= 'http://cancelurl.com';
$Order->PaymentDetails->PaymentMethod->BankCode='RABONL2U+RAB'; // value retrieved based on the bank selected by the customer, from the array obtained after calling method getIdealIssuerBanks.
try {
$newOrder = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
echo "newOrder: " . $e->getMessage();
exit;
}
$idealredirect= $newOrder->PaymentDetails->PaymentMethod->Authorize->Href."/?avng8apitoken=".$newOrder->PaymentDetails->PaymentMethod->Authorize->Params->avng8apitoken;
header('Location:' . $idealredirect);
?>
Next renewal price
Overview
Retrieve the costs of the next subscription renewal.
Attributes
Parameters | Type/Description |
---|---|
NetPrice |
Double |
|
Price without taxes |
NetCurrency |
String |
|
Currency for the price without taxes. The currency ISO code used for the payment - ISO 4217. |
FinalPrice |
Double |
|
Price with taxes |
FinalCurrency |
String |
|
Currency used for prices with taxes. The currency ISO code used for the payment - ISO 4217. |
Search historical payouts
Overview
Use the searchPayouts method to extract information on the historical payouts issued by 2Checkout for your account.
You can retrieve information on the payment for a specific invoice, or search based on numerous filters such as payment status, transfer date, or payout method.
Search filters
Parameters | Type/Description |
---|---|
Reference |
Optional/String InvoicePrefix (PREFIX) + InvoiceNo (00000) will search for transfers containing an invoice with prefix + number. The invoice reference is generated by 2Checkout and can be found in the Accounting area from your Control Panel. |
Status |
Optional/Array of strings Possible payout statuses:
|
Currency |
Optional/String 3 letter ISO currency code. |
StartDate |
Optional/String Start payment date. Format: Yyyy-mm-dd. |
EndDate |
Optional/String End payment date. Format: Yyyy-mm-dd. |
PaymentType |
Optional/String Possible payout methods:
|
OrderBy |
Optional/Array of objects Details below |
Field |
String Variable used for ordering the returned data. Possible values:
|
Direction |
String Order direction. Possible values:
|
Pagination |
Optional/Object Use this object for paginating the results. Default behavior is to display 10 results per page. |
Page |
Integer Number of pages used for displaying results. |
Limit |
Integer Limit the number of results. |
Request
<?php
require('PATH_TO_AUTH');
$SearchOptions = new stdClass();
//$SearchOptions->Reference = 'FBV8572'; // search for a specific invoice
$SearchOptions->Status = ['PAID', 'CANCELED'];
$SearchOptions->Currency = 'USD';
$SearchOptions->StartDate = '2018-05-01';
$SearchOptions->EndDate = '2018-06-01';
$SearchOptions->PaymentType = 'WIRE';
$SearchOptions->OrderBy = [];
$orderBy = new stdClass();
$orderBy->Field = 'TransferCompletionDate';
$orderBy->Direction = 'DESC';
$SearchOptions->OrderBy[] = $orderBy;
$SearchOptions->Pagination = new stdClass();
//$SearchOptions->Pagination->Page = 1;
//$SearchOptions->Pagination->Limit = 200;
$jsonRpcRequest = array(
'jsonrpc' => '2.0',
'method' => 'searchPayouts',
'params' => array($sessionID, $SearchOptions),
'id' => $i++
);
var_dump("AccountPayouts", callRPC((Object)$jsonRpcRequest, $host));
Response
Historical payout object
Parameters | Type/Description | |
---|---|---|
Items |
Array of objects Details below |
|
PaymentInstance |
Object Details below |
|
TransferCompletionDate | String | |
Payment date. Format: Yyyy-mm-dd. | ||
PaymentType | String | |
Payout method used for the transfer. Possible values:
|
||
Amount | Float | |
Amount transferred. Can be negative, for invoices deducted from your payment. | ||
Currency | String | |
Currency in which the amount was transferred. Three letters ISO currency code. | ||
Status | String | |
Payment status. Possible values:
|
||
Invoices |
Array of objects An object is created for each invoice part of the payment. |
|
Reference | String | |
System generated invoice reference. Formed by InvoicePrefix (PREFIX) + InvoiceNo (00000). | ||
Amount | Float | |
Invoice amount. | ||
Description | String | |
Comments submitted on the invoice. | ||
Type | String | |
Invoice type. Possible values:
|
||
Code | String | |
Code used for identifying the invoice type. Possible values:
|
||
Date | String | |
Date the invoice was generated. | ||
PaidAmount | Float | |
Invoice amount paid on this transfer. | ||
PaidDate | String | |
Transfer date. | ||
PaidCurrency | String | |
Currency of the transfer. | ||
Summary |
Object A summary of all the invoices included in this transfer. |
|
ServicesAmount | Float | |
Amount paid or retained for 2Checkout service invoices. | ||
PurchaseOrdersAmount | Float | |
Amount paid for purchase orders. | ||
ChargeBacksAmount | Float | |
Amount paid for chargebacks retained and released. | ||
RollingReserveAmount | Float | |
Amount paid for rolling reserves. | ||
PeriodNetSales | Float | |
Amount paid for period net sales. | ||
VendorToVendor | Float | |
Amount paid for vendor 2 vendor invoices. | ||
ChargeBackFund | Float | |
Amount paid for the chargeback fund. | ||
Pagination |
Object Details below |
|
Page | Integer | |
Number of pages used for displaying the results. | ||
Limit | Integer | |
Limitation of the result numbers. | ||
Count | Integer | |
Total number of results. |
Retrieve session content
Overview
Use the getContents method to get info on all the products added to cart by the shopper in the current session.
Products added in cart can be either defined in your catalog, or created with dynamic information.
Parameters
Parameters | Type/Description |
---|---|
sessionID |
Required (string) |
|
Session identifier, the output of the Login method. Include sessionID into all your requests. 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 |
---|---|
SessionContents | 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->AffiliateId = NULL;
$Order->CustomerReference = NULL;
$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1'; // you can also send products with dynamic information
$Order->Items[0]->Quantity = 1;
$Order->Items[0]->PriceOptions = NULL;
$Order->Items[0]->SKU = NULL;
$Order->Items[0]->Price = NULL;
$Order->Items[0]->CrossSell = NULL;
$Order->Items[0]->Trial = false;
$Order->Items[0]->AdditionalFields = NULL;
$Order->Items[0]->Promotion = NULL;
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'FirstName';
$Order->BillingDetails->LastName = 'LastName';
$Order->BillingDetails->CountryCode = 'us';
$Order->BillingDetails->State = 'California';
$Order->BillingDetails->City = 'LA';
$Order->BillingDetails->Address1 = 'Address example';
$Order->BillingDetails->Address2 = NULL;
$Order->BillingDetails->Zip = '90210';
$Order->BillingDetails->Email = 'customer@email.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'CC';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->PaymentDetails->CustomerIP = '10.10.10.10';
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = true;
$Order->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";
$Order->PaymentDetails->PaymentMethod->CardType = 'visa';
$Order->PaymentDetails->PaymentMethod->ExpirationYear = '2019';
$Order->PaymentDetails->PaymentMethod->ExpirationMonth = '12';
$Order->PaymentDetails->PaymentMethod->HolderName = 'John';
$Order->PaymentDetails->PaymentMethod->CCID = '123';
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;
try {
$CartContents = $client->getContents ($sessionID, $Order);
}
catch (SoapFault $e) {
echo "CartContents: " . $e->getMessage();
exit;
}
var_dump("CartContents", $CartContents);
?>
Single Sign On in cart
Overview
Use the getSingleSignOnInCart method. Avangate attaches a unique token to links, designed to identify the returning shoppers and support the automatic extraction of payment data and billing information from the Avangate system. For example, you can generate single sign on in cart links for existing customers logged into your website based on their external or Avangate customer IDs.
How does this work?
When accessing the shopping cart using tokenized payment links:
- Avangate prefills automatically customer billing and delivery details associated with their Avangate customer accounts (linked based on their unique customer IDs).
- Avangate presents shoppers with an optimized payment area featuring the credit / debit cards used to make previous purchases / transactions in the Avangate system. Customers have the option of selecting one of the payment methods depending on available card-on-file data.
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. |
Customer |
Required (string) |
Unique customer identifiers. Can be either the ExternalCustomerReference you control or the system-generated AvangateCustomerReference. |
|
customerType |
Required (string) |
|
Possible values:
|
url |
Required (string) |
|
The shopping cart URL. Avangate redirects shoppers to this URL.
Possible values:
Any buy link you generate from the cPanel or using the API. Note: For the time being, payment tokenization does not support Express Payments Checkout or the Avangate mobile shopping cart. |
validityTime |
Optional (int) |
|
The time, in seconds, before the single sign-on URL expires. By default, the URL expires after 10 seconds. (optional) |
validationIp |
Optional (string) |
|
The IP address of the shopper, necessary for security purposes. Can be an empty string or a valid IP, or null. |
Response
Parameters | Type/Description |
---|---|
Single sign-on URL |
String |
The generated string is the tokenized time-limited single sign-on URL pointing to Avangate shopping cart.
Note: Each SSO link cleans any previous cart sessions. Shoppers using multiple SSO links would purchase only a single product at a time.
If shoppers add multiple products to cart via SSO buy links and then use a non-SSO link, they’ll purchase all items using the same order. When you use single sign on in cart for customers without card on files in the Avangate system, the generated tokenized link prefills the billing information but the purchase process requires that shoppers provide payment information, such as a credit or debit card.
Important! You can use the value of the logintoken to retrieve customer information by SSO token.
|
Request
<?php
require ('PATH_TO_AUTH');
$idCustomer = '352365983';
$customerType = 'AvangateCustomerReference';
$url = 'https://store.avancart.com/order/checkout.php?PRODS=4639321&QTY=1&CART=1&CARD=2';
$validityTime = 50;
$validationIp = null;
$jsonRpcRequest = array (
'method' => 'getSingleSignOnInCart',
'params' => array($sessionID, $idCustomer, $customerType, $url, $validityTime, $validationIp),
'id' => $i++,
'jsonrpc' => '2.0');
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
Next renewal price
Overview
Retrieve the costs of the next subscription renewal.
Attributes
Parameters | Type/Description |
---|---|
NetPrice |
Double |
|
Price without taxes |
NetCurrency |
String |
|
Currency for the price without taxes. The currency ISO code used for the payment - ISO 4217. |
FinalPrice |
Double |
|
Price with taxes |
FinalCurrency |
String |
|
Currency used for prices with taxes. The currency ISO code used for the payment - ISO 4217. |