Skip to main content

Upgrade a subscription

Overview

Use the setSubscriptionUpgrade method to upgrade a subscription.

Requirements

You can only upgrade subscriptions with automatic renewal enabled.

   The upgrade will not work if the subscription has a refund request that was not yet processed.

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.

subscriptionReference

Required (string)

 

Unique, system-generated subscription identifier.

productCode

Required (string)

 

Unique identifier of the target product for the subscription upgrade process. You control the product code and can set it up in the Control Panel.

options

Optional (string)

 

Pricing options of the target product for the subscription upgrade process.

 

String - ';' separated list of 'OptionValue' returned by getProductUpgradeOptions function.

If the pricing options groups is "scale" (interval), the Options parameter should be sent like this: [option group unique code] + "=" + value

e.g. Users=7

customPrice

Optional (string)

 

The price you want to charge customers for the upgrade. The currency used by default is the same as in the previous payment customers made.

Response

Parameters Type/Description

Boolean

true or false depending on whether or not the operation succeeded.

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$productCode = 'YOUR_PRODUCT_CODE';
$options = 'YOUR_PRICE_CODES'; //case sensitive; include only price options codes (exclude spaces)
$customPrice = 1;

$jsonRpcRequest = array (
'method' => 'setSubscriptionUpgrade',
'params' => array($sessionID, $subscriptionReference, $productCode, $options, $customPrice),
'id' => $i++,
'jsonrpc' => '2.0');

var_dump (callRPC((Object)$jsonRpcRequest, $host, true));

Create a cross-sell campaign

Overview

Use the createCrossSellCampaign method to create a cross-sell campaign for your 2Checkout account.

Request parameters

Parameters Type Required Description

MasterProducts 

Array of strings 

Required

Array of product codes to apply to this campaign. 

DisplayType 

String 

Required

The display type of the campaign; Can be cart, review, finish.

DisplayInEmail 

Boolean 

Required

Determines if the campaign will be displayed in payment receipt emails.

Products 

Array of objects 

Required

Array of objects containing the product codes pointing to the promoted products when tied to each master product, the discount value, and the discount type (can only be percent).

ProductCode 

String 

Required

Product code of the product to be recommended to the shopper.

Discount 

Float 

Required

Value of the discount.

DiscountType 

String 

Required

Can only be 'PERCENT'.

Name 

String 

Required

Name of the campaign.

StartDate 

String 

Optional 

The date when the cross-sell campaign starts, formatted as YYYY-MM-DD.

EndDate 

String 

Optional 

The date when the cross-sell campaign ends, formatted as YYYY-MM-DD.

Response parameters

Parameters Type Required Description

CampaignCode 

 String 

Required

The campaign code that can be used when placing orders. 

MasterProducts 

Array of strings 

Required

Array of product codes to apply to this campaign. 

DisplayType 

String 

Required

The display type of the campaign; Can be cart, review, finish.

DisplayInEmail 

Boolean 

Required

Determines if the campaign will be displayed in payment receipt emails. Can be 'true' or 'false'.

Products 

Array of objects 

Required

Array of objects containing the product codes pointing to the promoted products when tied to each master product, the discount value, and the discount type (can only be percent).

ProductCode 

String 

Required

Product code of the product to be recommended to the shopper.

Discount 

Float 

Required

Value of the discount.

DiscountType 

String 

Required

Can only be 'PERCENT'.

Name 

String 

Required

Name of the campaign.

CampaignStatus

String 

Optional 

The status of the cross-sell campaign.

StartDate 

String 

Optional 

The date when the cross-sell campaign starts, formatted as YYYY-MM-DD.

EndDate 

String 

Optional 

The date when the cross-sell campaign ends, formatted as YYYY-MM-DD.

Request sample

<?php 

require ('PATH_TO_AUTH'); 

$csCampaign = new stdClass(); 
$csCampaign->MasterProducts = ['C8851A5BC9']; 
$csCampaign->DisplayType = 'cart'; 
$csCampaign->DisplayInEmail = false; 
$csCampaign->Name = 'testing'; 
$csCampaign->StartDate = '2019-09-20'; 
$csCampaign->EndDate = '2020-10-21'; 
$csCampaign->Products = []; 
$csCampaign->Products[0] = new stdClass(); 
$csCampaign->Products[0]->ProductCode = '512712FA53'; 
$csCampaign->Products[0]->Discount = 15; 
$csCampaign->Products[0]->DiscountType = 'PERCENT'; 


$jsonRpcRequest = new stdClass(); 
$jsonRpcRequest->jsonrpc = '2.0'; 
$jsonRpcRequest->method = 'createCrossSellCampaign'; 
$jsonRpcRequest->params = array($sessionID, $csCampaign); 
$jsonRpcRequest->id = $i++; 

$csCampaignResponse = callRPC($jsonRpcRequest, $host, true); 

 

Retrieve upgrade price

Overview

Use the getProductUpgradeOptionsPrice method to retrieve information about the costs a customer incurs when upgrading a specific subscription. Retrieve information about the costs a customer incurs when upgrading a specific subscription.

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.

subscriptionReference

Required (string)

 

Unique, system-generated subscription identifier.

productCode

Required (string)

 

Unique identifier of the target product for the subscription upgrade process. You control the product code and can set it up in the Control Panel.

currency

Required (string)

 

ISO 4217 code.

options

Required (string)

 

Pricing options of the target product for the subscription upgrade process.

 

String - ';' separated list of 'OptionValue' returned by getProductUpgradeOptions function.

If the pricing options groups is "scale" (interval), the Options parameter should be sent like this: [option group unique code] + "=" + value

e.g. Users=7

Response

Parameters Type/Description

UpgradePrice

Object

    Details below.
  BillingPrice Int
    Net billing price available for  the upgrade process.
  BillingGrossPrice Int
    Gross billing price available for  the upgrade process.
  BillingCurrency String
    Billing currency available for the upgrade process.
  Quantity String
    Quantity available for the upgrade process.
  DisplayPrice Int
    Net display price available for the upgrade process.
  DisplayGrossPrice Int
    Gross display price available for the upgrade process.
  DisplayCurrency String
    Display currency available for the upgrade process.
  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

The response returns details about the upgrade price for a single product. For multiple products, the user needs to calculate the value using the quantity x upgradePrice (the value from the returned response) parameters.

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$productCode = 'my_subscription_123';
$currency = 'usd';
$options = 'emailsupport;oneuser1';

try {
    $upgradeOptions = $client->getProductUpgradeOptionsPrice($sessionID, $subscriptionReference, $productCode, $currency, $options);
}
catch (SoapFault $e) {
    echo "upgradeOptions: " . $e->getMessage();
    exit;
}
var_dump("upgradeOptions", $upgradeOptions);

 

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:

  • PAID  - 2Checkout transfers successfully paid.
  • PARTIALLY_PAID  - 2Checkout transfers that partially covered invoice amounts.
  • CANCELED  - 2Checkout canceled transfers.
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:

  • WIRE
  • PAYPAL
  • CHECK
  • PAYONEER
  • WEBMONEY
OrderBy

Optional/Array of objects

Details below

                            Field

String

Variable used for ordering the returned data. Possible values:

  • TransferCompletionDate - payment remittance date.
                            Direction

String

Order direction. Possible values:

  • ASC - for ascending order.
  • DESC - for descending order.
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;

try {
    $subscriptionInfo = $client->searchPayouts($sessionID, $SearchOptions);
}
catch (SoapFault $e) {
    echo "AccountPayouts: " . $e->getMessage();
    exit;
}
var_dump("Payouts", $subscriptionInfo);

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:

  • WIRE
  • PAYPAL
  • CHECK
  • PAYONEER
  • WEBMONEY
  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:

  • PAID  - 2Checkout transfers successfully paid.
  • NOT_PAID  - 2Checkout unpaid balance amounts.
  • PARTIALLY_PAID  - 2Checkout transfers that partially covered invoice amounts.
  • CANCELED  - 2Checkout canceled transfers.
  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:

  • Period net sales
  • Retain chargebacks
  • Release chargeback
  • Services
                      Code String
   

Code used for identifying the invoice type. Possible values:

  • PERIOD_NET_SALES
  • DISPUTES_BALANCE_HOLD
  • DISPUTES_BALANCE_RELEASE
  • AFFILIATE_BONUSES
  • AFFILIATE_BONUS_COMMISSION
  • CANCELED_PO
  • ROLLING_RESERVE_HOLD
  • ROLLING_RESERVE_RELEASE
  • CLOSED_CHARGEBACK_FEES
  • OPEN_CHARGEBACK_FEES
  • CUSTOM_FEE
  • CHARGEBACK_FUND
  • CHANNEL_MANAGER_SALES
  • MONTHLY_FEE
  • COMMITMENT_FEE
  • OVERDUE_PO_PAYMENTS
  • PENDING_PO_PAYMENTS
  • RRT_FEES
  • TRANSFER_FEE
  • UNILOC_DISCOUNT
                      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.

 

Revenue Recovery Tools

Overview

2Checkout provides recurring-revenue-based businesses with a comprehensive suite of revenue recovery tools, as well as the expertise and guidance to tailor and fine-tune your strategy to achieve industry-high revenue loss prevention and revenue recapture rates. Use the Revenue Recovery Tools to fight involuntary churn and increase your long-term revenues by up to 20%.

Revenue Recovery Tools are a unique set of features of the 2Checkout platform that are used for recovering and collecting transactional revenues lost due to poor authorization rates and include, without limiting, the following :

 

Basic  2Recover Add-on
Account Updater external

Yes

Yes

Multiple retry logic

2

up to 4 (in addition to the 2 included in Basic)

Pre-expiration billing Yes Yes
2Checkout Updater

No

Yes

Dunning management 

No

Yes

Dispute prevention service

No

Yes

Advanced Authorization  Report Basic Advanced

Availability

  • Basic revenue recovery tools are available by default for all types of plans (2Sell, 2Subscribe, 2Monetize).
  • 2Recover add-on is available on demand for all types of plans (2Sell, 2Subscribe, 2Monetize).

Basic Revenue Recovery Tools

Basic revenue recovery tools are available for all accounts (2Sell, 2Subscribe, 2Monetize).

Account Updater

Account Updater is a key customer retention tool designed to support seamless updates of credit/debit card account information. 

What is Account Updater Service

Account Updater is a generic term for programs such as Visa's Account Updater or MasterCard Automatic Billing Updater that are offered by the credit card networks to automatically update subscription customer card data when cardholder information changes or goes out of date.

How Does an Account Updater Service Work

This service records changes to credit card account numbers and expiration dates due to mergers, portfolio flips (e.g., Visa to MasterCard), re-issued cards (from loss or security breach) account closures, and product upgrades.

Companies that participate in updater programs have several ways to check the information in their subscriber database: automated nightly updates that check any card you have processed in the past six months, requests for information on specific cards that have been declined and requests for information on a set of cards due for their next billing installment.

Basic Retry Logic

Basic Retry Logic involves the first two (2) renewal authorizations 2Checkout makes to recover expired subscriptions for which the renewal process failed.

Smart Retry Logic

The post-expiration retry logic uses adaptive algorithms to help companies and merchants implement smart retries and maximize authorization rates, thus increasing their revenues. 

Generally, authorization rates show a steep decline after two attempts. Setting up too many authorization attempts can lead to overall poor results as banks and payment processors can flag them as fraudulent. The post-expiration smart retries aim to address about 30% of all declines on the platform. 

The post-expiration smart retries logic takes into account factors like country, subscription billing length, best days of the month for automatic billing, the minimum and maximum time to wait between attempts, and the maximum number of retry attempts. 

Availability

The smart retry logic is available to all MoR merchants on request. As we are in the early adopter phase, currently building on top of the existing functionality, please contact your account manager or sales representative should you be interested in activating this feature. 

Benefits

  • Maximizing authorization rates by adjusting retry logic to local payment behaviors

  • Reduced number of failed payment attempts

Use cases

Adapting the retry scheme to billing length

A company sells both monthly and yearly/bi-yearly subscriptions and has different grace period settings, depending on the billing length. To reduce soft declines due to insufficient funds, the company wants to have different post-expiration retry schemes for monthly and yearly/bi-yearly subscriptions.

Leverage the best days of the month for authorization

A company sells monthly subscriptions in different countries. After an analysis of authorization rates, they realize that for one or more billing countries, the authorization rates are consistently higher in a certain interval of the month. The company wants to leverage that information to drive up its authorization rates.  

Mitigate increased fraud score risk

A company has the maximum number of attempts configured and has seen authorization rates dropping lately. They suspect this is due to the high number of attempts per auto-renewal order that is having a side effect because the processors/issuing banks can view this as a possible fraud. The company would like to make fewer retries for monthly subscriptions and space out attempts for yearly subscriptions to mitigate the risk of having their transactions flagged as potentially fraudulent. 

2Recover Add-on 

The 2Recover add-on is available on-demand as part of the 2Recover add-on. Contact 2Checkout directly for more information. 2Recover add-on includes the basic revenue recovery tools plus: 

  • 2Checkout Updater
  • Advanced Retry Logic
  • Hard Declines Notifications
  • Advanced Authorization Report (new acquisition, auto-renewal, manual renewal) 

2Checkout Updater

2Checkout Updater is a key customer retention tool designed to support seamless updates of credit/debit card account information. 

Advanced retry logic

Advanced Retry Logic involves multiple renewal authorizations 2Checkout makes beyond those of Basic Retry Logic.

Hard Declines Notifications

Read more about hard decline notifications here.

Advanced Authorization  Report 

The advanced authorization report section in your Merchant Control Panel includes dedicated sections for each of the extra features in the 2Recover add-on, as well as the ability to display the report for new acquisitions and manual renewals. 

Self-service

Requirements

1. To request the activation of the 2Recover add-on, your account must meet the following criteria:

  • Less than 1% chargeback rate over the last 3 months
  • Have at least 10 active auto-renewing subscriptions
  • Use a 2Sell, 2Subscribe, 2Monetize 2Checkout account

2. If your account meets the requirements above, you can click on Activate Advanced Options in your Merchant Control Panel.

3. Next, you'll be prompted with a message informing you that we will activate the module for your account in 48 hours.

4. As soon as we activate the module, you will receive an email notifying you about the activation.

2Recover Add-on Fees and Revenue

2Recover Add-on Incurred Fees

Commission (net amount, does not include taxes) for the recurring payments 2Checkout recovered when renewing subscriptions using the 2Recover add-on. 2Checkout does not charge fees for basic recovery tools. To calculate the recovered revenue fee, generate the report using the Attempt date selector.

2Checkout keeps the 2Recover add-on fees even in the eventuality of chargebacks or refunds.

Total Earnings from the 2Recover Add-on

Total recurring charges successfully recovered using the 2Recover add-on, reported according to authorization dates, when the 2Checkout system collects funds from your customers.

Invoice for 2recover add-on fees

2Checkout issues an invoice for the advanced recovery fees at the end of each month.

Subscription import

Overview

Add/import subscriptions in the Avangate system. Include card data with your subscription import only if you contacted 2Checkout to enable this functionality for your account. Otherwise, the import process results in a failure. Contact 2Checkout or your account manager directly for more details.

Attributes

Parameters Type/Description

ExternalSubscriptionReference

Required (string)

 

Unique identifier for your subscription. Mandatory when importing subscription data.

StartDate

Required (string)

 

Subscription start date(YYYY-MM-DD) - StartDate is mandatory when importing subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the StartDate you provide must be in accordance with your custom configuration.

ExpirationDate

Required (string)

 

Subscription expiration date(YYYY-MM-DD) - ExpirationDate is mandatory when importing subscription data. If you changed the time zone for the Avangate API by editing system settings under Account settings, then the ExpirationDate you provide must be in accordance with your custom configuration.

Product

Required (object)

 

The product for which Avangate generated the subscription. Details below.

 

ProductCode

String

 

 

Unique product identifier that you control.

 

ProductId

Int

 

 

Unique, system-generated product identifier.

 

ProductName

String

 

 

Product name.

 

ProductQuantity

Int

 

 

Ordered number of units.

 

ProductVersion

String

 

 

Product version.

 

PriceOptionCodes

Array

 

 

The product options codes the customer selected when acquiring the subscription. Pricing options codes are case sensitive.

EndUser

Required (object)

 

The end user of the subscription. Details below.

 

Person

Object

    Details below. 

 

 

FirstName

String

 

 

 

End user's first name

 

 

LastName

String

 

 

 

End user's last name

 

 

CountryCode

String

 

 

 

End user country code [ISO3166-1 Alpha 2].

 

 

State

String

 

 

 

End user state.

 

 

City

String

 

 

 

End user city.

 

 

Address1

String

 

 

 

End user first address line.

 

 

Address2

String

 

 

 

End user second address line.

 

 

Zip

String

 

 

 

End user zip code.

 

 

Email

String

 

 

 

End user email address.

 

 

Phone

String

 

 

 

End user phone number.

 

 

Company

String

 

 

 

Company name.

 

Fax

String

 

 

End user fax.

 

Language

String

 

 

Language [ISO639-2] the Avangate system uses for communications.

DeliveryInfo

Optional (object)

 

The object contains information about the delivery/fulfillment made to the customer.

 

Description

String

 

 

Delivery description.

 

Codes

Array of objects

    Details below. 

 

 

Code

String

 

 

 

Delivered activation key/code.

 

 

Description

String

 

 

 

Code description for dynamic lists from your key generator. 

 

 

ExtraInfo

Object

 

 

 

Info set by your key generator for dynamic lists only.

 

 

 

CodeExtraInfo

Object

 

 

 

Type

String

 

 

 

Label

String

 

 

 

Value

String

 

 

File

Array of objects

      Details below. 

 

 

 

Content

String

 

 

 

 

Content of the file (base64 encoded).

 

 

 

ContentLength

Int

 

 

 

 

File size.

 

 

 

Filename

String

 

 

 

 

The name of the delivered file.

 

 

 

FileType

String

 

 

 

 

The type of the delivered file.

PartnerCode

Optional (string)

 

  • Empty: for ecommerce orders
  • Partner Code (mandatory)

ExternalCustomerReference

Optional (string)

 

Customer identifier you control.

SubscriptionValue

Optional (double)

 

Subscription value. The total costs incurred by the customer through the lifecycle of the subscription before you imported the item into the Avangate system.

When you send this parameter you must accompany it by ValueCurrency.

SubscriptionValueCurrency

Optional (string)

 

Mandatory when you also send the Value parameter. The currency associated to the subscription value.

AdditionalInfo

Optional (string)

 

Extra information that you can attach to a subscription, such as the source of the initial purchase.

NextRenewalPrice

Optional (double)

 

The future costs that subscribers would incur when their subscriptions are renewed. When provided, you must accompany it by NextRenewalPriceCurrency and CustomPriceBillingCyclesLeft.

NextRenewalPriceCurrency

Optional (string)

 

Mandatory when you send CustomPriceBillingCyclesLeft. The currency associated with the subscription next renewal price value.

CustomPriceBillingCyclesLeft

Optional (string)

 

Mandatory when you send NextRenewalPrice. Avangate applies the next renewal price to the number of billing cycles you define.

Test Optional (integer)
  Available only for eStore subscriptions. Use 1 to import a test subscription. Exclude the parameter or set the value to 0 to import regular subscriptions. Test subscriptions enable you to try out flows like manual and auto renewal, and upgrade.

CardPayment

Optional (object)

 

Include payment (credit/debit card) information that Avangate uses for recurring billing to renew imported subscriptions. Importing subscriptions with payment data is available only to eligible Avangate accounts. Contact Avangate directly for additional details.

Card payment

Add credit/debit card details when importing subscriptions. 2Checkout uses payment information in the recurring billing process. 

For imports of test subscriptions, use the credit card information from this article.

Parameters Type/Description

CardPayment

Object

CardNumber

Required (string)

 

The credit/debit card number.

CardType

Required (string)

 

VISA, VISAELECTRON, MASTERCARD, MAESTRO, AMEX, DISCOVER, DANKORT, CARTEBLEUE, JCB.

ExpirationYear

Required (string)

 

The year in which the card expires.

ExpirationMonth

Required (string)

 

The month in which the card expires.

HolderName

Required (string)

 

Card holder name.

CCID

Required (string)

 

Credit Card Identification - an extra ID printed on the card, usually a 3-4 digit number, the CVC2/CVV2.

HolderNameTime

Required (int)

 

The interval of time in seconds in which shoppers enter their name in the HolderName field. An abnormally short interval is usually a red flag for fraud attempts.

AutoRenewal

Optional (bool)

 

True or false, depending on whether the customer or you enabled or disabled subscription auto-renewals.

CardNumberTime

Optional (int)

 

The interval of time in seconds in which shopper enter their card number in the CardNumber field. An abnormally short interval is usually a red flag for fraud attempts.

Can be NULL, but not a negative number.

 

Unassign a product group

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 = 'AAA4643116';
$Code = "Code_12345AB";
try {
    $AssignedProductGroup = $client->unassignProductGroup($sessionID, $ProductCode, $Code);
}

catch (SoapFault $e) {
    echo "AssignedProductGroup: " . $e->getMessage();
    exit;
}

var_dump("AssignedProductGroup", $AssignedProductGroup);

?>

Save prices

Overview

Use the savePrices method to update product prices for a specific pricing configuration.

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.

Prices

BasicPrice Object

 

Details below.

Quantities

Object

 

Details below.

PriceOptions

Required (PriceOptionsAssigned object)

 

Details below.

PricingConfigCode

Required (string)

 

System-generated unique pricing configuration code. Read-only.

type

Require (string)

• REGULAR

• RENEWAL

 

Parameters Type/Description

BasicPrice

Object

Currency

String

 

The currency ISO code used for shipping costs - ISO 4217.

Amount

Float

 

Basic price.

 

Parameters Type/Description

Quantities

Object

MinQuantity

String

 

The minimum quantity of volume discounts. Default is 1.

MaxQuantity

String

 

The maximum quantity of volume discounts. Default is 99999.

 

Parameters Type/Description

PriceOptionsAssigned

Object

Code

String

 

Price option identifier.

Options

Array of strings

 

The pricing options group option code you configured that the Avangate system uses to calculate product prices for pricing configurations without a base price.

Response

bool(true)
<?php
require ('PATH_TO_AUTH');

/**
 * ProductCode = 'PDOWNFILE'
 * Default currency: EUR
 *
 * Dynamic pricing configuration
 *
 * Send two prices, including the required one for the default currency
 * The method will append the prices for the sent entries, without removing the previous values
 *
 * If the quantities intervals were not defined then they will be set.
 * If the quantities overlap with existing defined intervals, an Exception will be thrown.
 */
 
 
// make call
$Prices = array();
 
$Price = new stdClass(); // BasicPrice object
$Price->Amount = 140;
$Price->Currency = 'USD';
$Prices[] = $Price;
 
$Price = new stdClass(); // BasicPrice object
$Price->Amount = 80;
$Price->Currency = 'EUR';
$Prices[] = $Price;
 
$Quantities = new stdClass(); // QuantityInterval object
$Quantities->MinQuantity = 1;
$Quantities->MaxQuantity = 10;
 
$PriceOptions = array();
 
$PricingConfigurationCode = '5553603382';
$type = 'regular';
 
$jsonRpcRequest = array (
    'jsonrpc' => '2.0',
    'id' => $i++,
    'method' => 'savePrices',
    'params' => array($sessionID, $Prices, $Quantities, $PriceOptions, $PricingConfigurationCode, $type)
);

$response = callRPC((Object)$jsonRpcRequest, $host);
var_dump ($response);
 
// will output:
// bool(true)

 
/**
 * ProductCode = 'PDOWNFILE'
 * Default currency: EUR
 *
 * Flat pricing configuration
 * Has the VOLTAGE pricing option group assigned and marked as required.
 * If prices are sent WITHOUT setting the pricing option group and options will set the price but without setting values for the options prices.
 */
 
// Call the login method for authentication
$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$hash = hash_hmac('md5', $string, $key);
 
$i = 1; // counter for api calls
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash);
$jsonRpcRequest->id = $i++;
$sessionID = callRPC($jsonRpcRequest, $host);
 
// make call
$Prices = array();
 
$Price = new stdClass(); // BasicPrice object
$Price->Amount = 80;
$Price->Currency = 'EUR';
$Prices[] = $Price;
 
// if PricingOption group is not required, will set price for combination of QuantityInterval - no-pricing-option-value.
$PriceOptions = array();
 
// if PricingOption group is required, then send options by assigning a PriceOptionsAssigned object (group code and options)
// $optionAssigned = new stdClass(); // PriceOptionsAssigned
// $optionAssigned->Code = 'VOLTAGE';
// $optionAssigned->Options = array('220V'); // radio option group
// $PriceOptions = array($optionAssigned);
 
$Quantities = new stdClass(); // QuantityInterval object
$Quantities->MinQuantity = 1;
$Quantities->MaxQuantity = 99999; // default maximum value
 
$PricingConfigurationCode = '54AA62CA31'; // flat pricing configuration
$type = 'regular';
 
$jsonRpcRequest = array (
    'jsonrpc' => '2.0',
    'id' => $i++,
    'method' => 'savePrices',
    'params' => array($sessionID, $Prices, $Quantities, $PriceOptions, $PricingConfigurationCode, $type)
);
 
$response = callRPC((Object)$jsonRpcRequest, $host);
var_dump ($response);
 
 
/**
 * ProductCode = 'PDOWNFILE'
 * Default currency: EUR
 *
 * Flat pricing configuration
 * Has the COLOR and scalenotmandatory pricing option group assigned and marked as required.
 */
// Call the login method for authentication
$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$hash = hash_hmac('md5', $string, $key);
 
$i = 1; // counter for api calls
$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash);
$jsonRpcRequest->id = $i++;
$sessionID = callRPC($jsonRpcRequest, $host);
 
// make call
$Prices = array();
 
$Price = new stdClass(); // BasicPrice object
$Price->Amount = 10;
$Price->Currency = 'EUR';
$Prices[] = $Price;
 
$optionAssigned = new stdClass(); // PriceOptionsAssigned
$optionAssigned->Code = 'COLOR'; // checkbox pricing option group, multiple values are allowed
$optionAssigned->Options = array('cyan', 'magenta');
$PriceOptions = array($optionAssigned);
 
$optionAssigned = new stdClass(); // PriceOptionsAssigned
$optionAssigned->Code = 'scalenotmandatory'; // interval pricing option group
$optionAssigned->Options = array('scalenotmandatory-1-5');
$PriceOptions = array($optionAssigned);
 
$Quantities = new stdClass(); // QuantityInterval object
$Quantities->MinQuantity = 1;
$Quantities->MaxQuantity = 99999; // default maximum value
 
$PriceOptions = array();
 
$PricingConfigurationCode = '54AA62CA31'; // flat pricing configuration
$type = 'regular';
 
$jsonRpcRequest = array (
    'jsonrpc' => '2.0',
    'id' => $i++,
    'method' => 'savePrices',
    'params' => array($sessionID, $Prices, $Quantities, $PriceOptions, $PricingConfigurationCode, $type)
);
 
$response = callRPC((Object)$jsonRpcRequest, $host);
var_dump ($response);
?>

Extend a subscription

Overview

Extend the lifetime of a subscription in the 2Checkout system on-demand. Use the extendSubscription method to set a new expiration deadline 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)

 

Unique, system-generated subscription identifier.

days

Required (int)

 

2Checkout prolongs the lifetime of a subscription using the number of days you send, adding the interval on top of the expiration date.

 

Hint: Use a negative number to reduce the lifetime of a subscription.

 

Cannot be NULL.

Response

Parameters Type/Description

Boolean

true or false depending on whether the changes were successful or not.

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';
$days = 5;

try {
    $extendedSubscription = $client->extendSubscription($sessionID, $subscriptionReferenceTest, $days);
}
catch (SoapFault $e) {
    echo "extendedSubscription: " . $e->getMessage();
    exit;
}
var_dump("extendedSubscription", $extendedSubscription);

Shipping fees

Overview

Use this object via SOAP API 4.0 to retrieve information about shipping fees. 

Parameters

Parameter Type/Description

ShippingFee

Array of objects

Name

String

 

The name of the shipping fee configuration. 

Code String
  Unique, system-generated shipping fee identifier. 

Amount

String

 

The shipping costs

Currency

String

 

The currency ISO code used for shipping costs - ISO 4217.

ApplyTo

String

 

Possible values:

• PRODUCT

• ORDER

Type

String

 

 

Possible values:

• FIXED

• PERCENT

 

 

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo