Search methods pagination
Overview
Starting with 2Checkout API 5.0, search methods are including the option of pagination. Pagination has been developed for decreasing the request loading time, while allowing you to better handle the returning responses.
How it works?
Pagination works on all the search methods existing on 2Checkout API 5.0. The default pagination behavior is to display page 1 with 10 results. The maximum number of items displayed on a single page is 200.
Parameters
To use pagination, include the Pagination object inside the search method call, using the parameters below:
Parameters | Type/Description | |
---|---|---|
Pagination | Object | |
Details below. | ||
Page | Int | |
Set the number of pages that should be returned. | ||
Limit | Int | |
Set a limit for the number of results that should be returned. |
Response
The response of search methods that are including pagination will contain a new object, with the following parameters:
Parameters | Type/Description | |
---|---|---|
Pagination | Object | |
Details below | ||
Page | Int | |
Set the number of pages that should be returned. | ||
Limit | Int | |
Set a limit for the number of results that should be returned. | ||
Count | Int | |
Number of total results returned |
Sample request
The below PHP sample includes a search method for subscriptions.
<?php
require('PATH_TO_AUTH');
$SubscriptionSearch = new stdClass();
$SubscriptionSearch->CustomerEmail = 'email@avangate.com';
$SubscriptionSearch->DeliveredCode = null;
$SubscriptionSearch->AvangateCustomerReference = null;
$SubscriptionSearch->ExternalCustomerReference = null;
$SubscriptionSearch->Aggregate = false;
$SubscriptionSearch->SubscriptionEnabled = null; //true false null
$SubscriptionSearch->RecurringEnabled = null; // true - autorenewal, false - manual renewal, null = both(default)
$SubscriptionSearch->ProductCodes = null; //array('Product_Code1', 'Product_Code2');
$SubscriptionSearch->CountryCodes = null;//array ('au')
$SubscriptionSearch->PurchasedAfter = null;
$SubscriptionSearch->PurchasedBefore = null;
$SubscriptionSearch->ExpireAfter = null;
$SubscriptionSearch->ExpireBefore = null;
$SubscriptionSearch->LifetimeSubscription = null;
$SubscriptionSearch->Type = 'regular'; //'trial', 'regular', 'regularfromtrial'
$SubscriptionSearch->TestSubscription = null; // true, false, null = both(default)
$SubscriptionSearch->Pagination = new stdClass();
$SubscriptionSearch->Pagination->Page = 1; // set the number of pages for the response
$SubscriptionSearch->Pagination->Limit = 200; // set the limit for the values from the response
$jsonRpcRequest = array (
'method' => 'searchSubscriptions',
'params' => array($sessionID, $SubscriptionSearch),
'id' => $i++,
'jsonrpc' => '2.0');
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));
Retrieve subscription payment information
Overview
Use the getSubscriptionPaymentInformation method to retrieve information related to the payment made for a subscription.
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. | |
subscriptionReference | Required (String) |
The reference of the subscription you want to retrieve payment information for. |
Response
Parameters | Type/Description | |
---|---|---|
Type |
String |
|
|
Payment method type. |
|
Currency |
String |
|
|
ISO code of the order currency. |
|
PaymentMethod |
Object |
|
|
FirstDigits |
String |
|
|
First 4 digits of the card used on the order. |
|
LastDigits |
String |
|
|
Last 4 digits of the card used on the order. |
|
CardType |
String |
|
|
Type of card used on the order. |
ExpirationMonth | String | |
Card expiration month. | ||
ExpirationYear | String | |
Card expiration year. | ||
CardUpdated | Boolean | |
The card updated by our internal account updater. | ||
Authorize3DSUrl | String | |
URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized. |
Response sample
{
"Type": "CC",
"Currency": "USD",
"PaymentMethod": {
"FirstDigits": "4111",
"LastDigits": "1111",
"ExpirationMonth": null,
"ExpirationYear": null,
"CardUpdated": false,
"Authorize3DSUrl": null,
"CardType": "Visa"
}
}
Request
<?php
require ('PATH_TO_AUTH');
$subscriptionReference = "YOUR_SUBSCRIPTION_REFERENCE";
try {
$paymentInformation = $client->getSubscriptionPaymentInformation($sessionID, $subscriptionReference);
} catch (SoapFault $e) {
echo $e->getMessage();
}
var_dump($paymentInformation);
Configure order fulfillment/delivery
Overview
Enable customers to start using your services immediately after they finalize the purchase process and use electronic content delivery to distribute binary keys, activation codes, product files, etc. to your shoppers as soon as 2Checkout receives payment confirmation.
Supported business models
If your business relies on electronic software distribution (ESD), Software as a Service (SaaS), Information Services, Service Contracts, and even on physical delivery, you can easily leverage the scalability of 2Checkout's platform built to support the software and SaaS markets.
Availability
All 2Checkout accounts. Contact 2Checkout directly to:
- Access extra storage space for your product files.
- Inquire about physical delivery.
Configure product delivery options
Define product delivery options along with general information, pricing schemes, renewal details and all additional info needed when configuring a product.
- Go to Setup -> Products.
- Click Add product.
- Enter the item's general information and click Add product when you're done.
- Enter the pricing, upgrade and renewal details on the next page.
- Three Product fulfillment categories are available:
- Fulfillment made through 2Checkout delivery - You can opt to have 2Checkout deal with all aspects related to the delivery of your products, and serve binary keys, activation codes, product files and Download Insurance Service (DIS) to customers. Here you can also choose to manually confirm the delivery of the order. If you enable the Requires delivery confirmation option, 2Checkout puts the order processing on hold until you confirm delivery .
- Fulfillment made by you - You are responsible with providing your customers with the necessary resources to start using purchased products. It's critical that you also send confirmation of order fulfillment to 2Checkout to finalize orders.
- Fulfillment made immediately after payment confirmation - Use this if don't distribute products / keys to customers, but instead offer access to online services or subscriptions-based applications, to name a couple of examples.
Fulfillment made through 2Checkout delivery
2Checkout handles the delivery of your products, but you control the content served to customers as well as the distribution method, and can even add extra services to increase the value of your offerings.
Selecting Fulfillment made through 2Checkout delivery brings up the Content & methods box, enabling you to configure the delivery process of a product. The Fulfillment area tailors itself dynamically to the options you select under Product fulfillment type and Content & methods. Options available:
- Delivery content
- Delivery methods
- Extra delivery services
Delivery content
When 2Checkout handles the delivery of products on your behalf, it's mandatory that you check at least one of the boxes for the two Delivery content options:
Electronic code / key / binary file
Makes it mandatory to also select a list of codes from the drop down menu under the Activation codes settings area that is brought up. If none exists, you need to create a new code list and associate it with the product.
Product file download links
2Checkout can deliver your digital product files to shoppers immediately after they successfully placed an order.
In the product Fulfillment page, set the files you want to deliver from the Assign product files list under the Product file area. You need to upload and set up product files, if you haven't done so already. Click here to learn how to manage product files.
Assign multiple product files in case your delivery requires separate installation files for one product in the download page. For example, if your product has support for multiple operating systems: Windows, MAC OSX, etc., your shoppers can receive and download the product files for all supported versions. You can add multiple product files at once by checking all the files you want to assign from the list. The list contains all the product files uploaded by you that have a clean status, including the ones currently assign to your product. Keep in mind that when assigning a product file you have to check the extra delivery services involved: download link, download insurance service (DIS), and partner (channel manager).
Shoppers are able to download the product files from:
- Thank you page - If you have checked the delivery method of Instant delivery (in the Thank you page). This delivery option is available for payment methods with instant payment confirmation like credit cards, PayPal, etc.
Note that HTML tags are not supported in the ConvertPlus and InLine Checkout flows when using additional fulfillment information in 'Thank you' page . Plain text can be used instead.
- myAccount - Your shoppers can download the product files by logging into their 2Checkout customer account. The product files are available on the product history page, after clicking on the "Download product" button.
- Download page - The electronic delivery e-mail sent to your customers contains a "Download your product" button. By accessing it, customers are redirected to the download page where they can download all the product files belonging to the product ordered.
You can select both delivery options (product files / electronic code), in accordance with the distribution model of the product you're setting up. At least one of these options needs to be enabled for your offering to benefit from 2Checkout delivery. It's entirely up to you to offer the electronic code/key/binary file to your customers, a link to download the product file, or both.
Requirements
You can only assign clean files to your products. 2Checkout scans the files uploaded for malware, and only files in clean status can be delivered to shoppers.
Delivery methods
By Email & in 2Checkout myAccount
Default - cannot be disabled. Ensures that customers who acquire your products receive at least the electronic code / key / binary file or a link to download the product file, if not both, via email and in their myAccount, from 2Checkout. Consider customizing the email message sent to your customers using the Additional delivery information - by email field
Instant delivery (in the Thank you page)
Have 2Checkout instantly deliver product files and keys in the Thank you page displayed once a purchase is finalized. 2Checkout displays the Thank you page to customers if the payment method they use supports instant confirmation (credit cards, debit cards, PayPal, etc.) and automatically approved by the system/anti-fraud team, otherwise the instant electronic delivery can be delayed or even canceled altogether. You cannot use Instant delivery together with the Requires delivery confirmation feature.
The delivery content, also available in Email and in 2Checkout myAccount, is included in the Thank you page that you customize.
Instant delivery works for authorized and approved purchases. If the transaction fails or if the 2Checkout system flags an order as potentially fraudulent, 2Checkout does not display the instant delivery content in the "Thank You Page". In such scenarios, the delivery takes place over email once the order is authorized and approved.
Regardless if you checked the Instant delivery option or not, you can personalize the Additional delivery information - "Thank you" page with details according to your preferences in the field which is found at the bottom of the page.
Extra delivery services
DIS (Download insurance service) is an optional service that you can charge extra for, providing you with an easy tool to increase Average Order Value (AOV) while also offering a richer set of shopping cart options to customers.
DIS (Download insurance service)
By enabling the DIS (Download insurance service), customers get the option to pay to extend the life span of the product file download link for a total of two (2) years, but also to download the item an unlimited number of times. Make sure to associate a downloadable file associated with the product in the Product file area.
Orders and payments are confirmed via email when this option is selected with 2Checkout also delivering product keys / codes and download links through email. Order deliveries are confirmed automatically causing 2Checkout to execute the money transfer from the customer.
Fulfillment made by you
Distribute binary keys, activation codes, and product files, as well as additional files yourself by selecting Fulfillment made by you. You're required to confirm fulfillment of all orders before 2Checkout can move their status to Finished.
You can confirm delivery in two ways:
- Go to Orders & customers and Fulfillment confirmations to access a list of all incomplete orders that need fulfillment confirmation. Select he check box on the left hand side of an order you want to finalize and click Confirm fulfillment.
- Use Instant Delivery Notification (IDN). IDN helps you automate the order finalization process. Use scripts and rely on Instant Delivery Notification to facilitate automatic delivery confirmations from your system directly to 2Checkout servers..
2Checkout puts orders on hold until you confirm fulfillment, and finalizes them only after receiving confirmation from you or your system. Fulfillment made by you offers the possibility to have 2Checkout handle the distribution of products to customers on your behalf.
The Additional information - "Thank you" page functionality enables you to serve a custom message to your customers along with the "thank you" for their purchase.
Please note that the responsibility of providing customers with electronic deliveries for your offerings rests solely with you, and not with 2Checkout. For products which you configured with Fulfillment made by you, order fulfillment confirmation is mandatory as 2Checkout keeps track of the product distribution process for all orders, with the system setting order status to Finished only after the fulfillment was made and confirmed manually or through IDN by you.
2Checkout confirms order and payments via email when you select this option but does not deliver product keys / codes and download links. Once you confirm order fulfillment, 2Checkout executes the money transfer from the customer.
Fulfillment made immediately after payment confirmation
Designed with SaaS in mind, this feature enables you to sell services, without delivering binary keys, activation codes, product file, or DIS to customers.
Use Fulfillment made immediately after payment confirmation if your business model does not rely on electronic content delivery, and instead involves selling subscriptions or access to online services, etc.
Fulfillment made immediately after payment confirmation comes with the option to have 2Checkout handle the distribution of products to customers on your behalf.
The Additional information - "Thank you" field allows you to customize the message for your shoppers as you wish.
For products that you configured with Fulfillment made immediately after payment confirmation, 2Checkout confirms orders automatically, with their status updated to Finished after payment goes through. 2Checkout does not keep track of deliveries when you use this option, and you need to provide customers with access/subscriptions to your service/platform or additional delivery options.
2Checkout confirms orders and payments via email but does not deliver product keys/codes and download links through email. Order fulfillment is confirmed automatically causing 2Checkout to execute the money transfer from the customer.
Enable delivery confirmation
If you want to manually approve or reject orders after the 2Checkout performs the risk assessment, you can do so after you enable the vendor delivery confirmation feature.
Availability
Before you can use this feature, get in contact with your Customer Success Manager and ask for the activation of this option on your 2Checkout account.
Requirements
Follow these steps to enable it.
- Log in to the 2Checkout Control Panel
- Go to the Account Settings page
- Click Manage user access
- Go to the View roles tab and click Edit on the role that you want to enable the delivery confirmation feature.
- Under the Orders & Reports roles section, check the Enable delivery confirmation approval checkbox and click Save role at the bottom of the page.
How do I confirm orders?
When a shopper places an order, you now have the option to either manually confirm or reject the order from the order's status page in the Control Panel. If you don't confirm or reject the order for 14 days, 2Checkout automatically reverses it.
We also notify you about the order requiring confirmation in the Control Panel dashboard on the Last orders tab. Shoppers see their order marked with a Pending status in myAccount until you confirm the delivery.
2Checkout also notifies them that the order is waiting for your approval through a message in the Order lookup section.
How to activate delivery confirmation IPN
You can configure 2Checkout to send an IPN when you confirm the delivery of an order by following the steps below.
- Log in to the 2Checkout Control Panel.
- Go to the Account Settings page.
- Click Edit sytem settings.
- Go to the IPN settings tab.
- Check the the order was approved for delivery option under Notification settings.
- Click Save.
Add product
Overview
Use the addProduct method to create subscription plans/products for your 2Checkout 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 configure your subscription plans/products.
You can set all Product parameters except AvangateID and GroupName . The 2Checkout system sets the unique product ID. The AvangateID and GroupName are not editable. |
Mandatory parameters
ProductName
ProductCode
PricingConfigurations
Response
bool(true)
Sample request
<?php
require ('PATH_TO_AUTH'); // authentication call
$Product = new stdClass();
$Product->AvangateId = null;
$Product->ProductCode = 'API_Imported_Product_1';
$Product->ProductType = 'REGULAR';
$Product->ProductName = 'API_Subscription Imported New';
$Product->ProductVersion = '1.0';
$Product->GiftOption = false;
$Product->ShortDescription = 'Placeat cumque necessitatibus est minus praesentium ut non quibusdam. Molestias provident tempore eligendi mollitia quia.';
$Product->LongDescription = 'Corrupti inventore vitae nesciunt ab. Nemo cum non maiores. Non repudiandae est iste voluptatibus.';
$Product->SystemRequirements = null;
$Product->ProductCategory = null;
$Product->Platforms = array();
$Product->Platforms[0] = new stdClass();
$Product->Platforms[0]->PlatformName = null;
$Product->Platforms[0]->Category = null;
$Product->Platforms[1] = new stdClass();
$Product->Platforms[1]->PlatformName = null;
$Product->Platforms[1]->Category = null;
$Product->ProductImages = array();
$Product->ProductImages[0] = new stdClass();
$Product->ProductImages[0]->URL = null;
$Product->ProductImages[0]->Default = false;
$Product->ProductImages[1] = new stdClass();
$Product->ProductImages[1]->URL = null;
$Product->ProductImages[1]->Default = true;
$Product->TrialUrl = null;
$Product->TrialDescription = null;
$Product->Enabled = True;
//Product additional fields
/* $Product->AdditionalFields = array();
$Product->AdditionalFields[0] = new stdClass();
$Product->AdditionalFields[0]->Label = 'i44wak1dzp';
$Product->AdditionalFields[0]->Code = 'ITYAK0OEWJ';
$Product->AdditionalFields[0]->Enabled = false;
$Product->AdditionalFields[0]->Required = false;
$Product->AdditionalFields[0]->URLParameter = 'id1ktigl6d';
$Product->AdditionalFields[1] = new stdClass();
$Product->AdditionalFields[1]->Label = 'aig699lmo1';
$Product->AdditionalFields[1]->Code = 'V28TP07PQN';
$Product->AdditionalFields[1]->Enabled = false;
$Product->AdditionalFields[1]->Required = true;
$Product->AdditionalFields[1]->URLParameter = '8to9p6y54j'; */
//Product localization
/* $Product->Translations = array();
$Product->Translations[0] = new stdClass();
$Product->Translations[0]->Name = 'zsg7wtg4e5';
$Product->Translations[0]->Description = 'Voluptate iure ut quam omnis impedit. Deserunt facere id dolores doloribus quis. Minima nostrum ut possimus incidunt vel est sint. Odit tempora omnis iste nesciunt commodi accusantium placeat.';
$Product->Translations[0]->Language = 'pt';
$Product->Translations[0]->LongDescription = 'Pariatur molestiae sit dignissimos modi. Aut modi libero numquam repudiandae. Doloribus explicabo delectus fugiat amet. Excepturi quo consequatur sint adipisci.';
$Product->Translations[0]->SystemRequirements = 'c16tvyg88c';
$Product->Translations[0]->TrialUrl = 'UNCAUGHT TYPE: anyURI';
$Product->Translations[0]->TrialDescription = 'Voluptas rem sit ut voluptas molestias quidem ut. Maiores facilis tempora voluptates. Consequuntur illum recusandae hic magni iste.';
$Product->Translations[1] = new stdClass();
$Product->Translations[1]->Name = 'cv2sx15aby';
$Product->Translations[1]->Description = 'Ut distinctio asperiores et a placeat voluptatem et. Et eveniet temporibus aut vel. Nemo occaecati praesentium dolor fugiat rerum assumenda expedita.';
$Product->Translations[1]->Language = 'fr';
$Product->Translations[1]->LongDescription = 'Et ut nostrum molestiae voluptates soluta. Molestiae cum in ut qui. Voluptatem voluptates vero odit quia corporis. In impedit eligendi sed expedita nihil temporibus nobis.';
$Product->Translations[1]->SystemRequirements = 'cfv2amk25j';
$Product->Translations[1]->TrialUrl = 'UNCAUGHT TYPE: anyURI';
$Product->Translations[1]->TrialDescription = 'Voluptatem ut possimus consequatur iste. Recusandae id quia sed quibusdam aut debitis. Cupiditate harum architecto quod quia.'; */
$Product->PricingConfigurations = array();
$Product->PricingConfigurations[0] = new stdClass();
$Product->PricingConfigurations[0]->Default = false;
$Product->PricingConfigurations[0]->Code = null;
$Product->PricingConfigurations[0]->Name = 'API Pricing Configuration Test';
$Product->PricingConfigurations[0]->BillingCountries = array();
$Product->PricingConfigurations[0]->PricingSchema = 'DYNAMIC';
$Product->PricingConfigurations[0]->PriceType = 'NET';
$Product->PricingConfigurations[0]->DefaultCurrency = 'USD';
$Product->PricingConfigurations[0]->Prices = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular = array();
$Product->PricingConfigurations[0]->Prices->Regular[0] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular[0]->Amount = 100;
$Product->PricingConfigurations[0]->Prices->Regular[0]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Regular[0]->MinQuantity = 1;
$Product->PricingConfigurations[0]->Prices->Regular[0]->MaxQuantity = 10;
$Product->PricingConfigurations[0]->Prices->Regular[0]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Regular[1] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Regular[1]->Amount = 200;
$Product->PricingConfigurations[0]->Prices->Regular[1]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Regular[1]->MinQuantity = 11;
$Product->PricingConfigurations[0]->Prices->Regular[1]->MaxQuantity = 100;
$Product->PricingConfigurations[0]->Prices->Regular[1]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Renewal = array();
$Product->PricingConfigurations[0]->Prices->Renewal[0] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Renewal[0]->Amount = 50;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Renewal[0]->MinQuantity = 1;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->MaxQuantity = 10;
$Product->PricingConfigurations[0]->Prices->Renewal[0]->OptionCodes = array();
$Product->PricingConfigurations[0]->Prices->Renewal[1] = new stdClass();
$Product->PricingConfigurations[0]->Prices->Renewal[1]->Amount = 60;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->Currency = 'USD';
$Product->PricingConfigurations[0]->Prices->Renewal[1]->MinQuantity = 11;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->MaxQuantity = 100;
$Product->PricingConfigurations[0]->Prices->Renewal[1]->OptionCodes = array();
$Product->PricingConfigurations[0]->PriceOptions = array();
/* $Product->BundleProducts = array();
$Product->BundleProducts[0] = new stdClass();
$Product->BundleProducts[0]->ProductCode = '540Q45PQBN';
$Product->BundleProducts[0]->ProductId = 48439;
$Product->BundleProducts[1] = new stdClass();
$Product->BundleProducts[1]->ProductCode = 'PA3JDB5SZ2';
$Product->BundleProducts[1]->ProductId = 46439;
*/
$Product->Fulfillment = 'NO_DELIVERY';
$Product->Prices = array();
$Product->GeneratesSubscription = True;
$Product->SubscriptionInformation = new stdClass();
$Product->SubscriptionInformation->DeprecatedProducts = array();
$Product->SubscriptionInformation->BundleRenewalManagement = null;
$Product->SubscriptionInformation->BillingCycle = 1;
$Product->SubscriptionInformation->BillingCycleUnits = 'M';
$Product->SubscriptionInformation->IsOneTimeFee = false;
$Product->SubscriptionInformation->ContractPeriod = new stdClass();
$Product->SubscriptionInformation->ContractPeriod->Period = -1;
$Product->SubscriptionInformation->ContractPeriod->PeriodUnits = 'days';
$Product->SubscriptionInformation->ContractPeriod->IsUnlimited = TRUE;
$Product->SubscriptionInformation->ContractPeriod->Action = 'RESTART';
$Product->SubscriptionInformation->ContractPeriod->EmailsDuringContract = 'altenwerth.elise@gmail.com';
//$Product->SubscriptionInformation->UsageBilling = 77;
$Product->SubscriptionInformation->GracePeriod = new stdClass();
$Product->SubscriptionInformation->GracePeriod->Type = 'GLOBAL';
$Product->SubscriptionInformation->GracePeriod->Period = 14;
$Product->SubscriptionInformation->GracePeriod->PeriodUnits = 'D';
$Product->SubscriptionInformation->GracePeriod->IsUnlimited = false;
$Product->SubscriptionInformation->RenewalEmails = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Type = 'CUSTOM';
$Product->SubscriptionInformation->RenewalEmails->Settings = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before30Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before15Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before7Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->Before1Day = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->OnExpirationDate = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->After5Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->ManualRenewal->After15Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal = new stdClass();
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before30Days = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before15Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before7Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->Before1Day = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->OnExpirationDate = true;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->After5Days = false;
$Product->SubscriptionInformation->RenewalEmails->Settings->AutomaticRenewal->After15Days = true;
$Product->FulfillmentInformation = new stdClass();
$Product->FulfillmentInformation->IsStartAfterFulfillment = false;
$Product->FulfillmentInformation->IsElectronicCode = false;
$Product->FulfillmentInformation->IsDownloadLink = false;
$Product->FulfillmentInformation->IsBackupMedia = false;
$Product->FulfillmentInformation->IsDownloadInsuranceService = false;
$Product->FulfillmentInformation->IsInstantDeliveryThankYouPage = false;
$Product->FulfillmentInformation->IsDisplayInPartnersCPanel = false;
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'addProduct',
'params' => array($sessionID, $Product)
);
$addedProduct = callRPC($jsonRpcRequest, $host);
var_dump ($addedProduct);
How to efficiently scale your affiliate program
Is your company at the point where How to Efficiently Scale Your Affiliate Program sales from your affiliate program are flat? Are you simply not satisfied with the growth rate? Or are you just starting the affiliate program and are wondering how to scale? If you can identify with one of the above, watch our webinar and hear Cristian Miculi, 2Checkout's Senior Manager of Affiliate Services speak about how to efficiently scale your program and build it in such a manner so it'll be easy for you to add new opportunities on top of that. Watch this webinar and you will find out:
|
![]() |
Send subscription registration emails
Overview
Use this method to send registration emails for a list of subscriptions.
Requirements
Parameters
Parameter | Type/Description |
---|---|
sessionID | Required (String) |
Session identifier, output of the Login method. An exception is thrown if the values are incorrect. | |
subscriptionReferencesList | Required (StringArray) |
Array of subscription references for which the registration email will be sent. You can send registration emails for a maximum of 50 subscriptions at once. | |
Required (String) | |
End user email address. | |
language | Optional (String) |
ISO 639-1 two-letter language code for the language used in email registration messages. You can use all languages active on your account. Default language is English (en). Can be NULL. |
Response
Parameter | 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
$subscriptionReferencesList = array('REFERENCE_1', 'REFERENCE_2');
$email = 'YOUR_EMAIL_ADDRESS';
$language = 'YOUR_LANGUAGE';
try {
$RegistrationEmail= $client->sendRegistrationEmail ($sessionID, $subscriptionReferencesList, $email, $language);
} catch (SoapFault $e) {
Echo "REmail: " . $e->getMessage();
exit;
}
var_dump ("REmail ", $RegistrationEmail);
Errors
Error | Description |
---|---|
NOT_FOUND_PARTNER |
A partner must be set first. |
INVALID_ORDER |
Order is not yet completed. |
EMPTY_SUBSCRIPTION_REFERENCES_LIST |
The subscription references list is empty. |
INVALID_SUBSCRIPTION_REFERRENCE |
The subscription reference is invalid. |
INVALID_EMAIL |
The email address is invalid. |
REGISTRATION_EMAIL_SENDING_FAILED |
Failed to send the registration email. |
Place orders with catalog physical products
Overview
Use the placeOrder method to create an order using physical/tangible products defined in your Control Panel and collect the payment using credit card based payment methods.
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. |
Requirements
Add the product code of a tangible/physical product defined in your 2Checkout Control Panel.
When placing orders for physical products, you can provide the shipping method that applies to the purchase in the API call, as part of the DeliveryInformation object.
Response
Parameters | Type/Description |
---|---|
Object |
|
Object containing order information. |
Request
<?php
require ('PATH_TO_AUTH');
$Order = new stdClass();
$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 = 'First';
$Order->BillingDetails->LastName = 'Last';
$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@address.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->CCID = '123';
$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->Vendor3DSReturnURL = "http://www.success.ro";
$Order->PaymentDetails->PaymentMethod->Vendor3DSCancelURL = "http://www.error.ro";
try {
$newOrder = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
echo "newOrder: " . $e->getMessage();
exit;
}
var_dump("newOrder", $Order);
PriceOptionsGroupItemOptions Object structure
Parameters
Parameters | Type/Description |
---|---|
Name | String |
The name of the option inside the Pricing options group. | |
Value | String |
The code of the option inside the Pricing options group. | |
Default | Boolean |
True or false. | |
Description | String |
The description of the option inside the Pricing options group. | |
MinValue | Int |
The lowest value of a scale interval. Can be NULL. | |
MaxValue | Int |
The highest value of a scale interval. Can be NULL. |
Set external order reference
Overview
Use this method to set an external reference for a partner order. This is helpful if you use unique identifiers in your own order management system and you want to mirror the IDs in the 2Checkout system.
Requirements
Use this method before placeOrder.
Parameters
Parameter | Type/Description |
---|---|
sessionID | Required (String) |
Session identifier, which is the output of the Login method. An exception is thrown if the values are incorrect. | |
externalRef | Required (String) |
The unique identifier of an order placed in the Avangate system mirroring the reference you're using to manage order data in your system. |
Response
Parameter | Type/Description |
---|---|
Response | Boolean |
True or false |
Request
<?php
require ('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/02Authentication
require ('PATH_TO_SET_PARTNER'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/Partner/00Set_partner
require ('PATH_TO_ADD_PRODUCT'); // addProduct example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/JSON-RPC/06Reference/08Place_an_order/00Add_product_to_cart
$externalRef = 'NEW_REFERENCE';
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'setExternalRef',
'params' => array($sessionID, $externalRef)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host));
$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'placeOrder',
'params' => array($sessionID)
);
var_dump (callRPC((Object)$jsonRpcRequest,$host));
require ('PATH_TO_PLACE_ORDER');
Errors
Error | Description |
---|---|
INVALID_SOURCE |
The provided external reference is empty. |