Skip to main content

LCN Parameters

Overview

You can configure and set the LCN triggers and parameters right from your Merchant Control Panel so that you choose when to be notified about license changes and updates.

Configure LCN triggers and message

Navigate to LCN settings from your Merchant Control Panel, Dashboard → Integrations → Webhooks and API. Select the events for which 2Checkout sends notifications from the list of options available in the General LCN Settings section, under Triggers.

LCN Parameters

Depending on your LCN settings, the notifications contain all or a subset of the available parameters. 2Checkout continuously adds new LCN parameters. To include additional information in the notifications, enable new parameters on the LCN settings page in the Merchant Control Panel.

Parameter Description Type/Length
FIRST_NAME Customer first name String/40
LAST_NAME Customer last name String/40
COMPANY Company name String/40
EMAIL Customer email address String/40
PHONE Phone number String/40
FAX Fax number String/40
COUNTRY Country String/50
STATE State/County String/30
CITY City String/30
ZIP Zip code String/20
ADDRESS Customer address String/100
LICENSE_CODE System-generated, unique identifier for the subscriptions String/50
EXPIRATION_DATE The date when the subscription expires. For lifetime subscriptions, the value is: 9999-12-31 23:59:59. String/20
DATE_UPDATED The date when the 2Checkout system logs an update for a subscription String/20
AVANGATE_CUSTOMER_REFERENCE Default customer numerical (integer) IDs generated automatically by the 2Checkout system. String/10
EXTERNAL_CUSTOMER_REFERENCE Unique customer alphanumeric (string) identifiers that you control String/250
TEST

Possible values:

  • 1 for test subscriptions
  • 0 for 'real' subscriptions
String/1
CHANGED_BY

Reveals the author of subscription modifications. Possible values:

  • CUSTOMER
  • VENDOR
  • SYSTEM
String/8
LICENSE_TYPE

Possible values:

  • REGULAR
  • TRIAL
String/7
DISABLED

Subscription status.

  • 1 for Disabled
  • 0 for Enabled
String/1
RECURRING

The renewal license type

  • 1 for recurring billing
  • 0 for renewal that requires manual input from the customer
String/1
LICENSE_PRODUCT Product ID String/7
START_DATE Date when you schedule the subscription to start String/20
PURCHASE_DATE The initial date when a subscriber acquired the subscription String/20
LICENSE_LIFETIME

This parameter indicates whether the subscription is evergreen (lifetime)

  • 1 - lifetime
  • 0 - for subscriptions with a recurring billing cycle
String/1
BILLING_CYCLES

This parameter indicates the current, total number of billing cycles for a subscription since its creation/import, reflecting the number of renewals, but counting from the first payment made, equivalent with the initial billing cycle. For imported subscriptions, the first billing cycle starts immediately after import.

The default value is 1, for the initial billing. A subscription renewed once enters the second billing cycle, and the value of the parameter changes to 2. Similarly, the value increases to 3 for the third billing cycle, 4 for the fourth, and so on. It is the correspondent of the BILLING_CYCLES option in the LCN configuration page. Available only for subscriptions for which you configure a contract.

String/2
CONTRACT_CYCLES This parameter indicates the current subscription contract cycle. The default value is 1. For example, for a 12-month contract, the value of the CONTRACT_CYCLES is 1 for the first 12 months, 2 for the next 12 months after the contract is restarted, 3 for the following year, etc. String/2
BILLING_CYCLES_LEFT The number of billing cycles remaining until the contract restarts. 2Checkout counts down from the moment a subscription goes live. For example, the BILLING_CYCLES_LEFT value for a monthly subscription with a 12-month contract will be 11 the first month, 10 the second month, 9 the third, then 8, 7, 6, 5, 4, 3, 2, 1, and 0, before the contract restarts. String/2
CURRENT_BILLING_CYCLE This parameter indicates the current, total number of billing cycles of a subscription out of the duration of the current contract. For example, the CURRENT_BILLING_CYCLE value for a monthly subscription with a 12-month contract is 1 for the first month, 2 for the second month, and so forth until the twelfth billing cycle when the value reaches 12. Following the restart of the contract, the CURRENT_BILLING_CYCLE value is also restarted, starting with 1 for the first month of the new contract, 2 for the second, etc. String/2
NEXT_RENEWAL_PRICE Renewal price for the next billing cycle Int
NEXT_RENEWAL_CURRENCY Renewal currency for the next billing cycle String / 3
NEXT_RENEWAL_PRICE_TYPE GROSS/NET values depending on whether the price includes taxes String / 5
NEXT_RENEWAL_DATE Date of the next subscription renewal  
PARTNER_CODE

Possible values:

  • Empty - eCommerce order
  • Partner code
String/250
PSKU Product SKU (stock keeping unit) String/250
ACTIVATION_CODE Sends out the last used activation code String/250
STATUS

The status of the subscription. Possible values:

  • PENDING_ACTIVATION (subscription with delayed start date)
  • ACTIVE (for licenses/subscriptions still in use)
  • CANCELED (for canceled licenses/subscriptions)
  • EXPIRED (for expired licenses/subscriptions)
  • PASTDUE (for licenses/subscriptions in the grace period)
  • PAUSED (for licenses/subscriptions that were paused) 
String/18
EXPIRED
  • 1 - subscriptions/licenses expired. 
  • 0 - active subscriptions/licenses suffered modifications.
String/1
TIMEZONE_OFFSET The time zone you selected or the default GMT+2 time zone of the 2Checkout system String/9
LICENSE_GRACE_PERIOD The grace period impacting a subscription. Can have a numeric value (INT) representing the number of days sent as the grace period. Int/2
LICENSE_BILLING_TYPE

Designed to differentiate subscriptions leveraging usage pricing options groups from those without a metered cost component.

• PREPAID - subscription cost governed only by pricing options groups of the following type: Radio, Dropdown, Checkbox, and Scale (but without a metered cost component (usage scale pricing)).

• POSTPAID - subscription cost includes a metered cost component (usage scale pricing).

String/8
USAGE_BILLING_DATE

The date resulting from adding the Usage Billing Interval defined to the expiration deadline of the subscription.

For subscriptions with the automatic renewal system enabled and for which you uploaded usage data, the USAGE_BILLING_DATE represents the moment when 2Checkout attempts to automatically renew the subscription and charge the customer.

String/20
USAGE_STATUS

The status of usage data upload and processing.

  • UNREPORTED
  • REPORTED
  • PAID
String/10
LATEST_REPORTED_USAGE_DATE The most recent date when you uploaded usage data into the 2Checkout system for a subscription, preceding the renewal order before subscribers pay for the metered resources consumed. 2Checkout resets the counter after it renews the subscription. String/20
ACTION_AFTER_CYCLES

Indicates the action performed at the end of the subscription contract. Possible actions: subscription automatic renewal or expiration.

Possible values:

  • CANCEL
  • RESTART
  • NONE
String/7
HASH

Calculated HMAC_MD5 signature based on the sent LCN fields and the secret key

(Note: This parameter won't be used anymore for LCN validation as of 15th of August, 2024.)

String/32
SIGNATURE_SHA2_256 Calculated HMAC_SHA2_256 signature based on the sent LCN fields and the secret key String/64
SIGNATURE_SHA3_256 Calculated HMAC_SHA3_256 signature based on the sent LCN fields and the secret key String/64
COUNTRY_CODE Customer country code from the billing details String/2
END_USER_LANGUAGE The language used by the customer for placing the order String/2
DISPATCH_REASON

The reason why LCN was dispatched. Value depends on the change made on the license.

Possible values:

  • LICENCE_CHANGE - Licence change
  • LICENCE_EXPIRATION - Licence expiration
  •  LICENCE_PASTDUE - Licence past due 
  • LICENCE_CC_CHANGE - Licence payment method changes
  • LICENCE_IMPORTED - Licences changed via import
  • LICENCE_CPC_ACCEPTED-  Licences when a Churn Prevention Campaign was accepted
  • SCHEDULED_FOR_CANCELATION_ON_DEMAND - Scheduled cancellation event has been registered 
  •  REVERT_CANCELATION_ON_DEMAND - Scheduled cancellation event has been reverted
  • CANCELATION_ON_DEMAND - Scheduled cancellation actually has taken place
  • LICENCE_PENDING_ACTIVATION - Licence pending activation
  • LICENCE_GP_CHANGE - Licence grace period change
String/27
NEXT_RENEWAL_PAYMETHOD The payment method used in the upcoming renewal String/20
NEXT_RENEWAL_PAYMETHOD_CODE Code of the payment method String/15
NEXT_RENEWAL_CARD_LAST_DIGITS Last four digits of the debit/credit card used by the shopper String/4
NEXT_RENEWAL_CARD_TYPE Card type used by the customer String/12
NEXT_RENEWAL_CARD_EXPIRATION_DATE The expiration date of the card used by the customer String/6
ORIGINAL_ORDER_REFERENCE Reference of the order that generated the subscription String/8
LAST_ORDER_REFERENCE Reference of the last order generated on the subscription, such as a renewal or an upgrade String/8
LICENSE_PRODUCT_CODE The product identifier you create or a system-generated code that you control String
LCN_LICENSE_ADDITIONAL_INFO_CUSTOM_TEXT Name of the subscription additional information field String
LCN_LICENSE_ADDITIONAL_INFO_CUSTOM_VALUE Value of the subscription additional information field String/100
EXPIRATION_DATE_TIME   The date and time when a license/subscription expires. For lifetime licenses/subscriptions, the value will always be 9999-12-31 23:59:59. Date
START_DATE_TIME   The license/subscription start date and time Date
PURCHASE_DATE_TIME   The initial date and time when the license/subscription was purchased Date
RENEWALS_NUMBER   The number of renewals Int
UPGRADES_NUMBER   The number of upgrades Int
IS_TRIAL  

Possible values: 

  • 1 - for trial subscriptions
  • 0 - for regular subscriptions
Int/1
PAUSE_START_DATE Date when the subscription pause is scheduled to start or has started Date
PAUSE_END_DATE Date when the subscription pause will end and the next billing cycle starts Date
PAUSE_REASON The reason why the pause was set up, as specified by the merchant or shopper Date
PRODUCT_QUANTITY The number of units on the subscription Number
VENDOR_CODE Unique merchant identifier generated by the 2Checkout system String
MESSAGE_ID The sequence ID number of the sent message Integer
LCN_LICENSE_OPTIONS_TEXT

Array with the names of all the price options used on the product generating the license

For usage scale pricing option groups, 2Checkout returns the name of the pricing options as well as the number of units of metered resources consumed by the customer. Format: 'PricingOptionsGroupName: NumberOfUnitsConsumed', for example 'GBs: 100'.

Array of strings/250
LCN_LICENSE_OPTIONS_VALUE

Array with unique codes set up for the active pricing option groups of the product generating the license.

In the case of usage scale pricing options groups, 2Checkout returns both the unique code of the group as well as the number of units of metered resources consumed by the customer. Format: 'UniqueCode: NumberOfUnitsConsumed', for example 'metered GBs: 100'.

Array of strings/250
LCN_LICENSE_OPTIONS_PRICE Array with all prices corresponding to each active option (prices are in the order currency of the product generating the license). In the case of usage scale pricing options groups, it will return the price of the metered resources consumed by the customer in the order currency. Array of float numbers
LCN_LICENSE_OPTIONS_OPERATOR

Array with all price operators corresponding to each active price option, of the product generating the license.

Possible values:

• ADD

• SUBTRACT

Array of strings/9
LCN_LICENSE_OPTIONS_USAGE

Designed to differentiate usage pricing options groups from non-usage pricing options groups.

Possible values:

• PREPAID - for orders involving products with pricing options groups of the following type: Radio, Dropdown, Checkbox, and Scale (but without a metered cost component (usage scale pricing)). 
• POSTPAID - for orders involving products with a metered cost component (usage scale pricing).

String/8
LCN_LICENSE_OPTIONS_OPTIONAL_VALUE Array with optional codes (unique for pricing option group). In the case of usage scale pricing options groups, 2Checkout returns both the unique code of the group as well as the number of units of metered resources consumed by the customer. Format: 'UniqueCode: NumberOfUnitsConsumed', for example 'metered GBs: 100'. Array of strings/250
LCN_LICENSE_OPTIONS_IMPACT_SUBSCRIPTION

Array with operators showing the impact of the active pricing option on the subscription.

Possible values:

  • ADD
  • SUBTRACT
  • NONE
  • RECURRING
Array of strings/9
LCN_LICENSE_OPTIONS_IMPACT_SUBSCRIPTION_VALUE

Array with the values (number of months) which are the impact of the active pricing options.

When LCN_LICENSE_OPTIONS_IMPACT_SUBSCRIPTION returns “NONE” or “RECURRING”, LCN_LICENSE_OPTIONS_IMPACT_SUBSCRIPTION_VALUE will return 0.

Array of integer numbers
LCN_PRODUCT_GROUP_ID Group ID of the product generating the license String
LCN_PRODUCT_GROUP_NAME Group Name of the product generating the license String
PRODUCT_EXTERNAL_REFERENCE The external reference used to match the product with identifiers in your own system String
PRODUCT_VERSION_MODEL The version or model of the product String
CLIENT_DEAL_AUTO_RENEWAL Client option to automatically renew a deal contract at its expiration date String
MERCHANT_DEAL_AUTO_RENEWAL Merchant option to automatically renew a deal contract at its expiration date String
LAST_CHURN_REASONS The reason(s) provided by the shopper for disabling a subscription or cancelling the auto-renewal  String/20
LAST_CHURN_SOURCE The flow through which the subscription was disabled or the auto-renewal was cancelled String/10
LAST_CHURN_DATE The date when the subscription was disabled or the auto-renewal was cancelled String/255
CANCEL_ON_DEMAND_DATE   Latest churn cancel on demand date. String
CHURN_PREVENTION_CAMPAIGN_TYPE The type of the churn prevention campaign whose discount has been accepted by the shopper. String
CHURN_PREVENTION_CAMPAIGN_NAME The type of the churn prevention campaign whose discount has been accepted by the shopper. String
CHURN_PREVENTION_CAMPAIGN_DISCOUNT The value of the discount accepted via the churn prevention campaign/auto-renewal enrolment based on which the next renewal price is calculated. String

Volume discounts

Overview

Use Volume discounts to incentivize shoppers to purchase your products in large quantities/number of units. Set a different price per unit based on the total purchased quantity.

Volume discounts impact the unit price applied by the platform for Channel Manager and resellers if you (vendor) use the products in both channels.
 

Example:

Quantity interval Cost per unit
1 to 100 $59
101 to 500 $49
501  and more $39

For this example, a shopper purchasing 55 units would pay 55*59= $3,245. Another, purchasing a quantity of 600 would pay 600*39= $23,400.

Availability

All 2Checkout accounts.

Requirements

Create at least a product/subscription plan before defining pricing. 

Type 

  • Net: without taxes - 2Checkout applies extra taxes to the default price, such as Tax/VAT for US/EU orders during the ordering process. 
  • Gross: with taxes included - 2Checkout takes the taxes out of the costs paid by shoppers, without modifying the price during the ordering process. 

Currency 

When defining product prices you can:

  1. Configure the price only for the default currency - 2Checkout converts amounts in the cart based on the currency selected by/for shoppers. Currency rates are available here: https://secure.2checkout.com/content/...p?CURRENCY=USD

    This is an XML schema with the corresponding values for the other currencies compared to the one supplied in the CURRENCY query parameter.

  2. Specify prices in all currencies available for your account - 2Checkout serves shoppers the prices for all the currencies you set up without converting the amounts. 

Setup

Set volume discounts under the Pricing tab when editing or first configuring products. 

  • Products with dynamic pricing (with base price):
    1. Define your first quantity interval and click save. The initial discounted price per unit is the same as the default price; changes as needed for at least the default currency or for all currencies available for your account.
    2. Click the Add new volume discount link, define the interval, the discounted price per unit, and click Add interval.
    3. Repeat as needed. 
  • Static pricing (without base price)
    1. ​Create as many unit intervals for purchase volume discounts as you need and save the configuration. 
    2. Define prices for each possible option available to your shoppers in the Prices area. 

Limitations

Volumes not defined are not available for purchase to your shoppers. For example, if you define two intervals, 1 to 100 and 102 to 1,000, your shoppers will not be able to purchase 101 units or 1,200 units. 

 

Create product group

Overview

Use the addProductGroup method to create product groups for your account:

  • Send null for product group Code. 2Checkout ignores any values you send for Code and generates identifiers itself. 
  • Use unique product group names. 
  • 2Checkout throws an exception if you send a blank product group.
  • If you send only the name of the product group 2Checkout creates the new product group entity. 

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.

ProductGroup

Required (object)

 

Use this object to create product groups. Send null for the Code. 2Checkout generates unique product group code identifiers. 

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$ProductGroup = new stdClass();
$ProductGroup->Name = 'New Product Group from API';
$ProductGroup->Code = null;//Send null for the Code. 2Checkout generates unique product group code identifiers.
$ProductGroup->TemplateName = 'Default Template';//'001 - Two Column Billing'; //the name of the cart template you want to associate with the product group
$ProductGroup->Description = 'This is a generic description';
$ProductGroup->Enabled = true;

try {
    $NewProductGroup = $client->addProductGroup($sessionID, $ProductGroup);
}

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

var_dump("NewProductGroup", $NewProductGroup);


?>

Order with catalog products

Overview

The object below is returned directly or within a successful response from the following API requests:

Place orders with catalog product

Retrieve an order

Catalog order object

Parameters Type/Description

RefNo

String

 

2Checkout generates unique reference numbers for all orders (purchases). You can use this parameter to retry authorizations for orders with failed transactions by changing the payment method.

 

NULL when you place new orders.

ChargebackResolution String
 

Chargeback status information. Possible values:

· OPEN (chargeback is in progress)

· WON (chargeback won by you)

· LOST (chargeback won by the customer)

· ACCEPTED (you agreed to repay the value of the order to the customer)

· NONE (no chargeback initiated for the order)

To manage chargeback notifications navigate to Control Panel Dashboard →Integrations → Webhooks and API, and click on the IPN settings tab.

In the General IPN Settings section, under Triggers, make sure to check the boxes next to the following options:

· chargeback open (2Checkout sends an IPN when shoppers open a chargeback dispute).

· chargeback closed - (2Checkout sends an IPN when the parties involved resolve a chargeback dispute).

Also, check the checkbox next to the CHARGEBACK_RESOLUTION parameter featured in the Response tags area.

ChargebackReasonCode String
 

Identifier for the chargeback dispute reason from the 2Checkout system. Empty for orders with no chargeback dispute initiated.

Possible values:

  • MERCHANDISE_NOT_RECEIVED - Order not fulfilled/not delivered
  • NOT_AS_DESCRIBED - Product(s) not as described/unfunctional
  • DUPLICATE_TRANSACTION - Duplicate order
  • FRAUD / NOT_RECOGNIZED - Fraud/Order not recognized
  • CREDIT_NOT_PROCESSED - Agreed refund not processed
  • NOT_RECOGNIZED - New/renewal order not recognized
  • AUTHORIZATION_PROBLEM - Authorization problem
  • INFO_REQUEST - Information request
  • UNKNOWN - Unknown

OrderNo

String

 

The consecutive order number 2Checkout associates with orders and displays in the Order search area of your account.

ExternalReference

String

 

Set external reference identifiers for orders. Enables you to replicate the functionality of the REF parameter included into Buy Links. Maximum 100 characters. If there is a need for longer references, you can apply an md5 hash for any string value, resulting in a 32 characters string. You can verify the hash after the order notification, on the client side.

Status

String
 

The status of the order:

  • AUTHRECEIVED – 2Checkout blocks the amount corresponding to the transaction, but the process of collecting funds is incomplete.
  • PENDING - 2Checkout has yet to block the amount corresponding to the transaction or shoppers used an offline payment method like wire transfer.
  • COMPLETE – The shopper completed the transaction for the purchase and 2Checkout or you fulfilled the order (when required).
  • CANCELED – 2Checkout cancels orders for which shoppers fail to transfer funds in due time.
  • REVERSED – 2Checkout reverses order transactions that never reach the Complete/Finished stage. Shoppers never complete transactions for such purchases.
  • REFUND – 2Checkout refunds orders only after they reach the Complete/Finished stage and returns the funds collected to shoppers.

ApproveStatus

String
 

The status of the order resulted from the evaluation by the 2Checkout anti-fraud system or by a member of the anti-fraud department. This status varies for new purchases and for orders requiring customers to make manual payments.

Possible values:

  • WAITING: The 2Checkout anti-fraud system or a member of the anti-fraud department has yet to approve the order.
  • OK: The 2Checkout anti-fraud system or a member of the anti-fraud department approved the order.
  • INVALIDDATA: Shopper-supplied data is invalid – 2Checkout did not approve the order.
  • FRAUD: The order is fraudulent.

VendorApproveStatus

String
 

Shows if you approved or not a partner order. Possible values:

  • OK
  • WAITING
  • REJECTED

Language

String
 

ISO 639-1 two-letter code. Language used for the purchase process. Example: “en.”

OrderDate

String
 

Y-m-d H:i:s (2014-05-22 00:12:12) The datetime stamp (in the API time zone defined in cPanel) when customers place their orders.

FinishDate

String
 

Y-m-d H:i:s (2014-05-22 00:12:12) The datetime stamp (in the API time zone defined in cPanel) when the order reach the Complete status.

 

NULL for order that did not reach the Complete/Finished stage.

Source

String
 

The link source for the sale. Enables you to replicate the functionality of the SRC (separate link identifier) parameter when included into Buy Links. Use the SRC parameter to track sale sources.

Maximum length 255 characters. Cannot be null.

Affiliate Object
  Details below.
                   AffiliateCode String
  The unique code of the affiliate who refer orders.

                   AffiliateSource

String
  The link source for affiliate referred sales. Similar to the functionality of the SRC (separate link identifier) parameter included into Buy Links, but controlled by the AFFSRC parameter. Affiliates use the AFFSRC parameter to track sale sources for their referrals. Maximum length 255 characters.

                   AffiliateName

String

 

Affiliate name.

                   AffiliateUrl

String

 

Affiliate website URL from the Affiliate Details.

HasShipping

Boolean

 

true or false, depending on whether the order requires shipping.

DeliveryFinalized Boolean
  true or false, depending on whether product delivery has been completed.

BillingDetails

Object

   

Details below. 

   

FirstName

String

     

Shopper name.

   

LastName

String

     

Shopper surname.

   

CountryCode

String

     

Shopper country. ISO 3166 two-letter code.

   

State

String

     

The state in the shopper's country. Mandatory when you set the Billing Country to US, Turkey, India and Romania. Use case insensitive utf8 strings for the full name, or just the two letter code.

   

City

String

     

Shopper city.

   

Address1

String

     

Shopper address.

   

Address2

String

     

Shopper address.

   

Zip

String

     

ZIP/ Postal code.

   

Email

String

     

Shopper email address.

   

Phone

String

     

Shopper phone number. Mandatory when you set Brazil as the Billing Country. Can be NULL.

   

Company

String

     

Company name. Can be null for end users. When present, you also need to provide the FiscalCode.

 

FiscalCode

String 

   

• For companies, it needs to be the VAT ID. 2Checkout will validate the value provided and throw an error if the VAT ID is invalid/incorrect when calling setPaymentDetails. When present, you also need to provide the Company name.

• Mandatory when the Billing Country is set to Brazil. For Brazilian customers it represents the Fiscal Code (CPF/CNPJ).

• Mandatory when the Billing Country is set to India, and purchase is made by a Company.

• Can be null for end users.

DeliveryDetails

Object

Optional. When missing, 2Checkout uses the same details as for the BillingDetails object.

     

Details below. 

    FirstNameFirstName

 

String

       

Shopper name from the delivery details.

    LastName

 

String

       

Shopper surname from the delivery details.

    CountryCode

 

String

       

Shopper country. ISO 3166 two-letter code from the delivery details.

    State

 

String

       

The state in the shopper's country from the delivery details. Mandatory when you set the Billing Country to US, Turkey and Romania. Use case insensitive utf8 strings for the full name, or just the two letter code.

    City

 

String

       

Shopper city from the delivery details.

    Address1

 

String

       

Shopper address from the delivery details.

    Address2

 

String

       

Shopper address from the delivery details.

    Zip

 

String

       

ZIP/ Postal code from the delivery details.

    Email

 

String

       

Shopper email address from the delivery details.

    Phone

 

String

       

Shopper phone number from the delivery details. Mandatory when you set Brazil as the Billing Country. Can be NULL.

    Company

 

String

       

Company name from the delivery details. Can be null for end users. When present, you also need to provide the FiscalCode.

PaymentDetails

Optional (Object)

 

Adapt this object to the desired payment method.

 

Type

String

   

The payment method:

  • CC (credit/debit card - including local Brazilian cards).
  • PAYPAL
  • PAYPAL_EXPRESS
  • CCNOPCI (credit/debit card for non-PCI certified merchants).
  • TEST (for test orders).
  • PREVIOUS_ORDER (place new orders using the reference of a previous order).
  • EXISTING_PAYMENT_DATA  (use a card one of your customers already used to purchase from your account).
  • WIRE – the placeOrder response includes Wire payment details.
  • CHECK – the placeOrder response includes Check payment details.
  • PURCHASEORDER - use for orders with POs.
  • FREE – for 0 value orders for which you’re not requiring customers to provide payment details.
  • GOOGLE PAY
 

Currency

String

   

The currency ISO code for the payment - ISO 4217. Example: “usd.”

 

PaymentMethod

Optional (object)

   

Object structure and parameters differ according to payment method selected and API method (placing orders (POST) vs. retrieving order data (GET)). For payments with credit cards, PalPay Express, previous order reference and purchase order use the objects below.

 

For payments with check and wire, send only the ‘CHECH’ and ‘WIRE’ strings.

 

null for 0 value orders for which you’re not requiring customers to enter payment details.

                 RecurringEnabled Boolean
    true or false, depending on whether the shoppers checked the subscription auto-renewal checkbox or not, during the purchase process.
   

PaymentDetailsCard

Optional (object)

       

Details below. 

     

CardType

String

       

visa, visaelectron, mastercard, maestro, amex, discover, dankort, cartebleue, jcb, hipercard, elo

     

FirstDigits

String

       

First four digits of the credit card.

     

LastDigits

String

       

Last four digits of the credit card.

      RecurringEnabled Boolean
        true or false, depending whether the order has active recurring options
      Vendor3DSReturnURL String
        URL to which customers are redirected after a successful 3DS process.
      Vendor3DSCancelURL String
        URL to which customers are redirected after a failed 3DS process.
      InstallmentsNumber Integer
        Number of installments used for paying the order.
 

CheckPaymentDetails

Optional (Object)

     

Details below. 

   

Beneficiary

String

     

The beneficiary of the payment.

Can be NULL.

   

CheckPostalAddress

String

     

The address of the beneficiary.

Can be NULL.

   

Amount

Float

     

The total costs incurred by the customer for an order.

Can be NULL.

   

Currency

String

     

The currency ISO code of the order/payment - ISO 4217.

Can be NULL.

 

PayPalExpress

Object

       

Details below. 

     

Email

String

       

Email address customers use for their PayPal account.

     

ReturnURL

String

       

The PayPal Express Checkout redirect URL returned by calling the getPayPalExpressCheckoutRedirectURL method. The return URL is the page on your website to which PayPal redirects your buyer's browser after the buyer logs into PayPal and approves the payment. Typically, this is a secure page (https://...) on your site.

     

CancelURL

String

       

The cancel URL is the page on your website to which PayPal redirects your buyer's browser if the buyer does not approve the payment. Typically, this is the secure page (https://...) on your site from which you redirected the buyer to PayPal.

 

WirePaymentDetails

Object

     

Details below. 

   

Amount

Float

     

The total costs customers incur.

Can be NULL.

   

Currency

String

     

The currency ISO code of the order - ISO 4217.

Can be NULL.

   

PaymentReference

String

     

Transaction identifier.

Can be NULL.

   

RoutingNumber

String

     

Identification number assigned to financial institutions.

Can be NULL.

   

BankAccounts

Optional (Array of objects)

       

Details below. 

     

Beneficiary

String

       

The beneficiary of the payment.

Can be NULL.

     

BankName

String

       

The name of the beneficiary's bank.

Can be NULL.

     

BankCountry

String

       

The country of the beneficiary's bank.

Can be NULL.

     

BankCity

String

       

The city of the beneficiary's bank.

Can be NULL.

     

BankAddress

String

       

The address of the beneficiary's bank.

Can be NULL.

     

BankAccount

String

       

The number for the account in which customers transfer the funds.

Can be NULL.

     

BankAccountIban

String

       

The IBAN of the beneficiary's bank.

Can be NULL.

     

BankAccountSwiftCode

String

       

The Swift Code of the beneficiary's bank.

Can be NULL.

     

Currency

String

       

The currency ISO code for the bank account - ISO 4217.

Can be NULL.

 

CustomerIP

String

   

Shopper IP.

CustomerDetails

Object

2Checkout populates the parameters of the customer entity with information from the customer whose AvangateCustomerReference or ExternalCustomerReference you send during the purchase.

   

Details below. 

 

AvangateCustomerReference

Integer

   

System-generated 2Checkout customer reference. Aggregate subscriptions under the same Customer account if the products they're associated to are purchased by the same shopper by adding the AV_CUSTOMERID (case sensitive) parameter to buy links. The 2Checkout system generates default customer numerical (integer) IDs (AV_CUSTOMERID) automatically for all orders containing products that feature subscriptions.

 

ExternalCustomerReference

String

   

The external customer reference you control. Aggregate subscriptions under the same Customer account if the products they're associated to are purchased by the same shopper by adding the CUSTOMERID (case sensitive) parameter  to buy links.

 

FirstName

String

   

Customer's first name. 

 

LastName

String

   

Customer's last name.

 

CountryCode

String

   

Customer's country code (ISO 3166 two-letter code).

 

State

String

   

Customer's state. For example, "Alabama","Alaska","Arizona".

 

City

String

   

Customer's city.

 

Address1

String

   

Customer's address.

 

Address2

String

   

Customer's address.

 

Zip

String

   

Zip code.

 

Email

String

   

Customer's email.

 

Phone

String

   

Customer's phone number.

 

Company

String

   

Company name.

 

FiscalCode

String

   

For companies, it needs to be the VAT ID. 2Checkout validates this values and throws an error if the VAT ID is invalid/incorrect. When present, you need to also provide Company name.

 

Can be null for end users.

 

Fax

String

   

Customer's fax number.

 

Enabled

Boolean

   

true or false, depending on whether the customer account is active or inactive. An active customer account features at least one Active or Past due subscription.

 

Trial

Boolean

   

true or false, depending on whether the customer account features only trials or also paid subscriptions.

 

Language

String

   

ISO 639-1 two-letter code. Example: “en.”

 

ExistingCards

Array of objects

     

Details below. 

   

TransientToken

Object

     

Populated only when you retrieve customer information by SSOToken.

     

Token

String

       

Token for the EXISTING_PAYMENT_DATA flow. Use it to charge customers using cards they used in the past for purchases from your 2Checkout account.

   

CardType

String

     

visa, visaelectron, mastercard, maestro, amex, discover, dankort, cartebleue, jcb, hipercard, elo

   

LastDigits

String

     

Last four digits of the credit card.

   

ExpirationMonth

String

     

Card expiration month.

   

ExpirationYear

String

     

Card expiration year.

   

NameOnCard

String

     

Card holder name.

Origin

String

 

2Checkout automatically tracks the source of purchases:

 

  • Web – When customers use the desktop version of the 2Checkout shopping cart.
  • API - When customers use a custom, API-based ordering interface.
  • Mobile - When customers use the mobile version of the 2Checkout shopping cart.
  • Automatic Billing – For auto-renewals and trial conversions.

AvangateCommission

Optional (Int)

 

2Checkout's commission for the order.

OrderFlow

String

 

PURCHASE_ORDER - Sent only when shoppers used Purchase Orders.

REGULAR - Sent in all other cases.

GiftDetails

Optional (object)

 

Contains contact details for the recipient of a gift purchase.

 

FirstName

String

   

First name of gift recipient.

 

LastName

String

   

Last name of gift recipient.

 

Email

String

   

Email of gift recipient. 2Checkout uses this email for the delivery/fulfillment process.

 

GiftNote

String

   

Custom text shoppers provide as a message to the gift recipient.

PODetails

Object (optional)

   

Details below. 

 

Status

String

   

PO status. Possible values:

 

PO status API

PO status cPanel

AWAITING_UPLOAD

Awaiting form submission - Waiting for the customer to submit the PO form

TIME_EXPIRED

Expired, form not received - The customer did not submit the PO form

AWAITING_MERCHANT

Awaiting your confirmation - PO approved by 2Checkout, awaiting vendor confirmation

MERCHANT_TIME_EXPIRED

Expired, PO not confirmed - You didn't confirm/reject the PO

AWAITING_MERCHANT

Rejected - You rejected the PO

AWAITING_PAYMENT

Awaiting payment - You approved the PO, waiting for payment

AWAITING_PAYMENT

Expired, not paid - The customer did not complete the PO payment. 2Checkout accepts  payments up to 30 days after the PO payment interval expires

NOT_PAID

Canceled, not paid - The customer did not complete the PO payment

NOT_PAID

Canceled by 2Checkout - 2Checkout canceled the PO

NOT_PAID

Canceled via API - You canceled the PO (via API)

PAID

Complete - Customer paid the PO. The order is complete

 

AutoApprove

Boolean

 

TRUE or FALSE, depending on whether you set POs to auto-approve or not.

 

RequireDocumentUpload

Boolean

 

TRUE or FALSE, depending on whether require document upload or not.

 

NetPaymentTerms

Integer

 

The term of net payment in days.

 

CopyPreviousDocuments

Boolean

 

TRUE or FALSE, depending on whether copy documents from previous order or not.

 

PdfFormUrl

String

 

URL of Purchase Order form which needs to be printed, signed and uploaded.

 

InternalPONumber

String

 

Identifier that business customers use internally in their organization to track and manage Purchase Orders (PO). Can be NULL.

ExtraInformation

Optional (Object)

 

Details below. 

 

PaymentLink

String

 

 

Can be:

1. The PO doc upload link - If you set AutoApprove as FALSE on the original order and before shoppers upload the PO. 

2. Payment link for orders with POs. Business customers can use the PaymentLink to finalize payment for orders with POs. If you set AutoApprove as TRUE on the original order and if 2Checkout and you approve the PO. 

PaymentLink

String

 

In scenarios in which an issue blocks the transaction from finalizing, 2Checkout provides a retry link where shopper can complete their purchase by providing new payment details.

PartnerCode

String

 

Partner code you configured for your partner. NULL for eStore orders.

PartnerMargin

Float

 

Partner margin you set for the order. NULL for eStore orders.

PartnerMarginPercent

Float

 

The percentage of the partner margin from the net value of the products ordered, minus the value of any discounts. NULL for eStore orders.

ExtraMargin

Float

 

Extra margin you offer by editing partner orders. NULL for eStore orders.

ExtraMarginPercent

Float

 

The percentage of the extra partner margin from the net value of the products ordered, minus the partner margin and the value of any discounts. NULL for eStore orders.

ExtraDiscount

Float

 

Extra discount you offer by editing partner orders. NULL for eStore orders.

ExtraDiscountPercent

Float

 

The percentage of the partner margin from the net value of the products ordered, minus the value of any coupon discounts. NULL for eStore orders.

LocalTime

String

 

Local shopper time in the following format: Y-m-d H:i:s.

This parameter can impact the fraud score of an order when it's missing, NULL or incorrectly formatted.

TestOrder

Boolean

 

True for test orders. False of regular orders.

Errors

Array of strings

 

Payment gateway processing errors.

Items

Array of objects

   

Details below. 

 

ProductDetails

Object

   

Name

String

     

Product name.

    ShortDescription String
      Product short description.
    Tangible Boolean
      true or false, depending on product delivery type.
    IsDynamic Boolean
     

Possible values:

  • true - dynamic product information
  • false - catalog products
   

ExtraInfo

String

     

The text entered in the Additional information field when generating Buy links, or via the INFO[PRODUCT_ID] parameter used in Buy links.

   

RenewalStatus

Boolean

     
  • true for orders renewing subscriptions.
  • false for all other orders: new purchases, upgrades.
    DeliveryInformation

Object

Details below

          Delivery   String
     

Possible values:

  • BY_VENDOR
  • NO_DELIVERY
  • BY_AVANGATE
          DownloadFile   Object
      Information related to the download file.
          DeliveryDescription   String
      Delivery description.
          CodesDescription   String
      Description of codes delivered.
          Codes   Array of strings
              Array with the codes delivered
   

Subscriptions

Object

     

SubscriptionReference

String

       

Unique, system-generated subscription identifier.

     

PurchaseDate

String

       

The date time stamp when shoppers acquired their subscriptions corresponding to the moment when the 2Checkout system marks the purchase as finished. Format (YYYY-MM-DD HH:mm:ss). Default GMT+02:00.

 

e.g. 2015-08-11 15:18:52

     

SubscriptionStartDate

String

       

 

Example: 2015-09-29 17:57:59

     

ExpirationDate

String

       

The date time stamp of upcoming renewal/expiration for subscriptions not taking into account grace period settings.

 

Format (YYYY-MM-DD HH:mm:ss). Default GMT+02:00.

 

e.g. 2015-09-11 15:18:52

     

Lifetime

Boolean

       
  • true – For non-recurring, evergreen subscriptions.
  • false – For recurring subscriptions with a specific billing cycle from 7 days to 36 months.
     

Trial

Boolean

       
  • true – For trial subscriptions.
  • false – For non-trial, recurring subscriptions with a specific billing cycle from 7 days to 36 months.
     

Enabled

Boolean

       
  • true – For active and past due subscriptions.
  • false – For expired and cancelled subscriptions.
     

RecurringEnabled

Boolean

         

                   

PriceOptions

Array of strings

   

Array of price option codes.

   

Code

Strings

     

Unique code that the 2Checkout system generates or that you set for each pricing options group.

   

Required

Boolean

     
  • true – you require shoppers to select the price option  through the way in which you configured pricing.
  • false – you do not require shoppers to select the price option.
   

Options

Array of strings

     

The code you set or that the 2Checkout system generates for each price option child inside a pricing options group parent.

 

Price

Object

   

This object returns the price per unit at order line level.

 

In the case of trials, the object returns the costs for the trial to full subscription conversion.

   

UnitNetPrice

Float

     

The value per product unit, excluding sales tax/VAT expressed in the payment currency.

   

UnitGrossPrice

Float

     

Total value per product unit, including sales tax/VAT expressed in the payment currency. UnitGrossPrice does not reflect any discounts.

   

UnitVAT

Float

     

Sales tax/VAT per product unit expressed in the payment currency.

   

UnitDiscount

Float

     

Value of the discount per product unit expressed in the payment currency.

   

UnitNetDiscountedPrice

Float

     

The value per product unit, expressed in the payment currency, excluding sales tax/VAT, from which 2Checkout deducts the unit discount.

   

UnitGrossDiscountedPrice

Float

     

Total costs shoppers incur per product unit, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts.

   

UnitAffiliateCommission

Float

     

Value of the affiliate commission per product unit calculated expressed in the payment currency.

 

2Checkout deducts discounts from the costs incurred by shoppers before calculating affiliate commissions.

 

2Checkout does not take into account shipping costs when calculating affiliate commissions.

 

NULL when 2Checkout does not apply an affiliate commission.

   

Currency

String

     

The currency ISO code for the payment - ISO 4217. Example: usd.

   

NetPrice

Float

     

The value per order line, excluding sales tax/VAT expressed in the payment currency.

   

GrossPrice

Float

     

Total value per order line, including sales tax/VAT expressed in the payment currency. UnitGrossPrice does not reflect any discounts.

   

NetDiscountedPrice

Float

     

The NetPrice value per order line (in the payment currency), excluding sales tax/VAT, from which 2Checkout deducts discounts.

   

GrossDiscountedPrice

Float

     

Total costs shoppers incur per order line, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts.

 

Example:

  • UnitNetPrice: 99
  • UnitGrossPrice: 120.39
  • UnitVAT: 21.39
  • UnitDiscount: 9.9
  • UnitNetDiscountedPrice: 89.1
  • UnitGrossDiscountedPrice: 110.49
  • UnitAffiliateCommission: 22.28
  • Currency: "usd"
  • NetPrice: 198
  • GrossPrice: 240.77
  • NetDiscountedPrice: 178.2
  • GrossDiscountedPrice: 220.97
  • Discount: 19.8
  • VAT: 42.77
  • AffiliateCommission: 44.56
   

Discount

Float

     

Value of the discounts per order line expressed in the payment currency.

   

VAT

Float

     

Value of sales tax/VAT per order line expressed in the payment currency.

   

AffiliateCommission

Float

     

Value of the affiliate commission per order line, calculated from the NetDiscountedPrice expressed in the payment currency. Or NULL. 2Checkout does not take into account shipping costs when calculating affiliate commissions.

    VATPercent Integer
      Percentage of the VAT/tax applied to the order.
    HandlingFeeNetPrice Integer
      Handling fee applied to the NET price configuration.
    HandlingFeeGrossPrice Integer
      Handling fee applied to the GROSS price configuration.
  LineItemReference String
    System-generated reference for the product item.
  PurchaseType String
   

Possible values:

  • PRODUCT
  • SHIPPING
  • TAX
  • COUPON
 

Code

String

   

Unique product identifier your control. Max length 256 characters.

 

Quantity

Integer

   

Number of units

 

SKU

String

   

SKU identifier.

 

CrossSell

Object

     

Details below. 

   

ParentCode

String

     

The product code of the master product you set to trigger the campaign.

   

CampaignCode

String

     

Unique, system-generated identifier for cross-sell campaigns.

 

Trial

Object

     

Details below. 

   

Period

Integer

     

The length of the trial subscription lifetime in days.

   

GrossPrice

Float

     

Total trial price in the payment currency before 2Checkout deducts any taxes, discounts, etc.

   

VAT

Float

     

The total value of taxes for the trial in the payment currency, before 2Checkout deducts any discounts.

   

NetPrice

Float

     

Total trial price in the payment currency, not including taxes, before 2Checkout deducts any discounts.

 

AdditionalFields

Array of objects

     

Details below. 

   

Code

String

     

The alpha-numeric characters, underscores and dashes that are set as the field identifier.

   

Text

String

     

Field text visible to shoppers in the cart.

   

Value

String

     

Selected field value.

 

Promotion

Object

     

Details below. 

   

Name

String

     

Promotion name.

   

Description

String

     

Promotion description.

   

StartDate

String

     

The date when you set the promotion to start. NULL for promotions that start immediately after you create them.

   

EndDate

String

     

The date when you set the promotion to end. NULL for promotions you want active indefinitely.

   

MaximumOrdersNumber

Integer

     

2Checkout only applies the promotion to a maximum number of orders you define.

 

Can be NULL if you want the promotion to apply to an unlimited number of orders.

   

MaximumQuantity

Integer

     

Discount only applies to a maximum number of units purchased through a single order, smaller than the quantity you defined. Shoppers purchase any extra units at full price. Can be NULL if you want the promotion to apply to an unlimited number units.

   

InstantDiscount

Boolean

     

The instant discount option auto-applies the discount for ALL selected products, without the need for shoppers to enter a discount coupon.

   

Coupon

String

     

Promotion coupon/voucher.

   

DiscountLabel

String

     

Discounts can be set as a percentage from the product price or as a fixed amount in the chosen currency.

   

Enabled

String

     

true or false, depending on whether a promotion is active or disabled. 

   

Type

String

     
  • REGULAR – product/cart line level discounts.
  • ORDER – quantity discounts.
  • GLOBAL – order-level discounts.
  • AFFILIATE – for discounts created by affiliates.

Promotions

Array of objects

   

Details below. 

 

Name

String

   

Promotion name.

 

Description

String

   

Promotion description.

 

StartDate

String

   

The date when you set the promotion to start. NULL for promotions that start immediately after you create them.

 

EndDate

String

   

The date when you set the promotion to end. NULL for promotions you want active indefinitely.

 

MaximumOrdersNumber

Integer

   

2Checkout only applies the promotion to a maximum number of orders you define.

 

Can be NULL if you want the promotion to apply to an unlimited number of orders.

 

MaximumQuantity

Integer

   

Discount only applies to a specific number of units purchased at once, smaller than the maximum quantity you defined. Shoppers purchase any extra units at full price. Can be NULL if you want the promotion to apply to an unlimited number units.

 

InstantDiscount

Boolean

   

The instant discount option auto-applies the discount for ALL selected products, without the need for shoppers to enter a discount coupon.

 

Coupon

String

   

Promotion coupon/voucher.

 

DiscountLabel

String

   

Discounts can be set as a percentage from the product price or as a fixed amount in the payment currency.

 

Enabled

String

   

true or false, depending on whether a promotion is active or disabled. 

 

Type

String

   
  • REGULAR – product/cart line level discounts.
  • ORDER – quantity discounts.
  • GLOBAL – order-level discounts.
  • AFFILIATE – for discounts created by affiliates.

AdditionalFields

Array of objects

   

Details below. 

 

Code

String

   

The alpha-numeric characters, underscores and dashes that are set as the field identifier.

 

Text

String

   

Field text visible to shoppers in the cart.

 

Value

String

   

Selected field value.

Currency

String

 

The currency ISO code for the payment - ISO 4217. Example: usd.

NetPrice

Float

 

Order value excluding sales tax/VAT expressed in the payment currency.

GrossPrice

Float

 

Total order value, including sales tax/VAT expressed in the payment currency. GrossPrice does not reflect any discounts.

NetDiscountedPrice

Float

 

The NetPrice order value excluding sales tax/VAT, from which 2Checkout deducts discounts. NetDiscountedPrice is expressed in the payment currency.

GrossDiscountedPrice

Float

 

Total costs shoppers incur, expressed in the payment currency. This value includes sales tax/VAT, 2Checkout and affiliate commissions, but 2Checkout deducts the value of any discounts.

 

For example:

  • Currency: "usd"
  • NetPrice: 396
  • GrossPrice: 486.29
  • NetDiscountedPrice: 376.2
  • GrossDiscountedPrice: 466.49
  • Discount: 19.8
  • VAT: 90.29
  • AffiliateCommission: 94.05

Discount

Float

 

Value of the discounts for an order expressed in the payment currency.

VAT

Float

 

Value of sales tax/VAT expressed in the payment currency.

AffiliateCommission

Float

 

Value of the affiliate commission for the order calculated from the NetDiscountedPrice expressed in the payment currency. Or NULL. 2Checkout does not take into account shipping costs when calculating affiliate commissions.

FxRate Integer
  Exchange rate used by 2Checkout for converting the order to your payout currency.
FxMarkup Integer
  Exchange rate markup for the order.
PayoutCurrency String
  The ISO code of your account's payout currency - ISO 4217.

Create price option groups

Overview

Use the addPriceOptionGroup method to create price options for your subscription plans/products.

  • Send options for each pricing group or 2Checkout throws an exception.
  • When adding an interval with no min/max values or overlapping values, 2Checkout throws an exception. 

Parameters

Parameters Type/Description

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.

PriceOptionsGroup

Required (object)

 

Use this object to create a new price option group for your account.

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$PriceOptionGroup = new stdClass();
$PriceOptionGroup->Name = 'New Multi Users';
$PriceOptionGroup->Description = 'Quos aut ipsam ipsum omnis aut molestiae. Et quod molestias distinctio. Fugiat sit asperiores reprehenderit officia eaque quae quia. Aperiam quia quia illo eos nesciunt accusamus.';
$PriceOptionGroup->Translations = array();
$PriceOptionGroup->Translations[0] = new stdClass();
$PriceOptionGroup->Translations[0]->Name = 'xdrki7ljix';
$PriceOptionGroup->Translations[0]->Description = 'Beatae doloribus ipsam voluptatem et. Iure dignissimos non amet. Quibusdam fugiat dolor repudiandae temporibus harum.';
$PriceOptionGroup->Translations[0]->Language = 'en';
$PriceOptionGroup->Translations[1] = new stdClass();
$PriceOptionGroup->Translations[1]->Name = '37wr8ie2dj';
$PriceOptionGroup->Translations[1]->Description = 'Esse distinctio voluptatibus omnis et et quia dolor. Quibusdam dicta dolores odio consequatur velit voluptate. Laboriosam reiciendis libero vel quae molestiae ad.';
$PriceOptionGroup->Translations[1]->Language = 'ru';
$PriceOptionGroup->Type = 'RADIO';
$PriceOptionGroup->Options = array();
$PriceOptionGroup->Options[0] = new stdClass();
$PriceOptionGroup->Options[0]->Name = 'SingleUser';
$PriceOptionGroup->Options[0]->Description = 'Nisi ea autem a labore similique. Minus natus cumque nemo. Aut aliquam laboriosam dolorem ad.';
$PriceOptionGroup->Options[0]->Translations = array();
$PriceOptionGroup->Options[0]->Translations[0] = new stdClass();
$PriceOptionGroup->Options[0]->Translations[0]->Name = '0q2r3kcj0q';
$PriceOptionGroup->Options[0]->Translations[0]->Description = 'Voluptatem in vitae rerum ea tempore. Non cumque ullam optio quis. Laborum maxime sunt facere. Dolor fugit a fugiat quasi facere totam.';
$PriceOptionGroup->Options[0]->Translations[0]->Language = 'en';
$PriceOptionGroup->Options[0]->Translations[1] = new stdClass();
$PriceOptionGroup->Options[0]->Translations[1]->Name = 'dwfxuw4lrn';
$PriceOptionGroup->Options[0]->Translations[1]->Description = 'Debitis omnis maiores quia praesentium totam error corrupti. Consectetur eum magnam quam vero. Sit aperiam natus perspiciatis iusto sint ut fugit. Adipisci illum non voluptatem voluptas.';
$PriceOptionGroup->Options[0]->Translations[1]->Language = 'it';
$PriceOptionGroup->Options[0]->Code = 'singleuser1';
$PriceOptionGroup->Options[0]->SubscriptionImpact = new stdClass();
$PriceOptionGroup->Options[0]->SubscriptionImpact->Impact = 'Add';
$PriceOptionGroup->Options[0]->SubscriptionImpact->Months = 1;
$PriceOptionGroup->Options[0]->PriceImpact = new stdClass();
$PriceOptionGroup->Options[0]->PriceImpact->Method = 'FIXED';
$PriceOptionGroup->Options[0]->PriceImpact->Amounts = array();
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[0] = new stdClass();
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[0]->Currency = 'USD';
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[0]->Amount = 90.61;
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[1] = new stdClass();
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[1]->Currency = 'EUR';
$PriceOptionGroup->Options[0]->PriceImpact->Amounts[1]->Amount = 6.70;
$PriceOptionGroup->Options[0]->PriceImpact->ImpactOn = 'BASE';
$PriceOptionGroup->Options[0]->PriceImpact->Impact = 'ADD';
$PriceOptionGroup->Options[0]->PriceImpact->Percent = 39;
$PriceOptionGroup->Options[0]->Default = false;
$PriceOptionGroup->Options[1] = new stdClass();
$PriceOptionGroup->Options[1]->Name = 'MultiUser';
$PriceOptionGroup->Options[1]->Description = 'Vero voluptatum fuga et repellendus sed qui. Dolores molestiae error non ad aperiam. In error quos eum quas repudiandae pariatur et suscipit.';
$PriceOptionGroup->Options[1]->Translations = array();
$PriceOptionGroup->Options[1]->Translations[0] = new stdClass();
$PriceOptionGroup->Options[1]->Translations[0]->Name = 'MultiUser';
$PriceOptionGroup->Options[1]->Translations[0]->Description = 'Debitis et saepe facere blanditiis. Tempore et nemo aut ullam possimus ipsum nisi. Ad libero et consequuntur aliquam libero. Rerum aut illum eveniet earum.';
$PriceOptionGroup->Options[1]->Translations[0]->Language = 'en';
$PriceOptionGroup->Options[1]->Translations[1] = new stdClass();
$PriceOptionGroup->Options[1]->Translations[1]->Name = 'dw5zgkcki9';
$PriceOptionGroup->Options[1]->Translations[1]->Description = 'Vel et excepturi veniam. In iusto eveniet pariatur hic labore. Et qui dolorem accusantium molestias iusto.';
$PriceOptionGroup->Options[1]->Translations[1]->Language = 'pt';
$PriceOptionGroup->Options[1]->Code = 'multiuser999';
$PriceOptionGroup->Options[1]->SubscriptionImpact = new stdClass();
$PriceOptionGroup->Options[1]->SubscriptionImpact->Impact = 'ADD';
$PriceOptionGroup->Options[1]->SubscriptionImpact->Months = 2;
$PriceOptionGroup->Options[1]->PriceImpact = new stdClass();
$PriceOptionGroup->Options[1]->PriceImpact->Method = 'FIXED';
$PriceOptionGroup->Options[1]->PriceImpact->Amounts = array();
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[0] = new stdClass();
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[0]->Currency = 'USD';
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[0]->Amount = 65.03;
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[1] = new stdClass();
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[1]->Currency = 'EUR';
$PriceOptionGroup->Options[1]->PriceImpact->Amounts[1]->Amount = 64.58;
$PriceOptionGroup->Options[1]->PriceImpact->ImpactOn = 'BASE';
$PriceOptionGroup->Options[1]->PriceImpact->Impact = 'ADD';
$PriceOptionGroup->Options[1]->PriceImpact->Percent = 51;
$PriceOptionGroup->Options[1]->Default = true;
$PriceOptionGroup->Code = null;
$PriceOptionGroup->Required = false;

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'addPriceOptionGroup',
'params' => array($sessionID, $PriceOptionGroup)
);

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

?>

Pay-per-Usage

Use this option to create and assign PAYPERUSE price options to your portfolio.

For non PAYPERUSAGE cases, the Usage and UsagePricingModel fields are not required.

 Request sample with PAYPERUSE

<?php
declare(strict_types=1);

class Configuration
{
    public const MERCHANT_CODE = '';
    public const MERCHANT_KEY = '';
    public const URL = 'http://api.2checkout.com/rpc/6.0';
    public const ACTION = 'addPriceOptionGroup';
    public const ADDITIONAL_OPTIONS = null;
    //array or JSON
    public const PAYLOAD = <<<JSON
{
    "Type": "INTERVAL",
    "Code": "PayPerUsage-CODE",
    "Required": false,
    "Name": "Pay per usage pricing option group",
    "Description": "Test option description",
    "Usage": "PAYPERUSAGE",
    "UsagePricingModel": "STEPPED",
    "Options": [
        {
            "Code": "9876545678",
            "ScaleMin": "1",
            "ScaleMax": "9",
            "SubscriptionImpact": {
                "Months": "0.00",
                "Impact": null
            },
            "PriceImpact": {
                "Amounts": {
                    "USD": {
                        "Currency": "USD",
                        "Amount": "1.00"
                    },
                    "EUR": {
                        "Currency": "EUR",
                        "Amount": "6.00"
                    }
                },
                "ImpactOn": null,
                "Method": "FIXED",
                "Percent": null,
                "Impact": null
            },
            "Default": false,
            "Name": "translation_5f90150268bef",
            "Description": "Translation value",
            "Translations": [
                {
                    "Name": "translation_5f90150268bf7",
                    "Description": "Translation value",
                    "Language": "RO"
                },
                {
                    "Name": "translation_5f90150268bef",
                    "Description": "Translation value",
                    "Language": "EN"
                },
                {
                    "Name": "translation_5f90150268bf9",
                    "Description": "Translation value",
                    "Language": "FR"
                },
                {
                    "Name": "translation_5f90150268bf5",
                    "Description": "Translation value",
                    "Language": "RU"
                }
            ]
        },
        {
            "Code": "98765456789",
            "ScaleMin": "10",
            "ScaleMax": "19",
            "SubscriptionImpact": {
                "Months": "0.00",
                "Impact": null
            },
            "PriceImpact": {
                "Amounts": {
                    "USD": {
                        "Currency": "USD",
                        "Amount": "1.00"
                    },
                    "EUR": {
                        "Currency": "EUR",
                        "Amount": "6.00"
                    }
                },
                "ImpactOn": null,
                "Method": "FIXED",
                "Percent": null,
                "Impact": null
            },
            "Default": false,
            "Name": "translation_5f90150268bef",
            "Description": "Translation value",
            "Translations": [
                {
                    "Name": "translation_5f90150268bf7",
                    "Description": "Translation value",
                    "Language": "RO"
                },
                {
                    "Name": "translation_5f90150268bef",
                    "Description": "Translation value",
                    "Language": "EN"
                },
                {
                    "Name": "translation_5f90150268bf9",
                    "Description": "Translation value",
                    "Language": "FR"
                },
                {
                    "Name": "translation_5f90150268bf5",
                    "Description": "Translation value",
                    "Language": "RU"
                }
            ]
        }
    ],
    "Translations": [
        {
            "Name": "Pay per usage pricing option group",
            "Description": "Test option description",
            "Language": "EN"
        }
    ]
}
JSON;
}

class Client
{
    private const LOGIN_METHOD = 'login';
    private $calls = 1;
    private $sessionId;


    private function generateAuth(): array
    {
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $date = gmdate('Y-m-d H:i:s');
        $string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
        $hash = hash_hmac('md5', $string, $key);

        return compact('merchantCode', 'date', 'hash');
    }


    public function login(string $url)
    {
        $payload = $this->generateAuth();
        $response = $this->call($url, array_values($payload), self::LOGIN_METHOD);
        $this->sessionId = $response['result'];
    }


    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ): ?array {
        if (empty($this->sessionId) && $action !== self::LOGIN_METHOD) {
            $this->login($url);
        }
        if(is_string($payload)) {
            $payload = json_decode($payload, true);
        }
        if (!empty($this->sessionId)) {
            $payload = [$this->sessionId, $payload, Configuration::ADDITIONAL_OPTIONS];
        }
        $payload = array_filter($payload);

        $request = json_encode([
            'jsonrpc' => '2.0',
            'method' => $action,
            'params' => $payload,
            'id' => $this->calls++,
        ]);
        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($curl, CURLOPT_SSLVERSION, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Cookie: XDEBUG_SESSION=PHPSTORM'));
        curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
        $response = curl_exec($curl);
        if(empty($response)) {
            die('Server unavailable');
        }
        echo $response . '</br>';
        return json_decode($response, true);;
    }
}
$client = new Client();
$result = $client->call();
var_dump($result);

 Request sample without PAYPERUSE

<?php
declare(strict_types=1);

class Configuration
{
    public const MERCHANT_CODE = '';
    public const MERCHANT_KEY = '';
    public const URL = 'http://api.2checkout.com/rpc/6.0';
    public const ACTION = 'addPriceOptionGroup';
    public const ADDITIONAL_OPTIONS = null;
    //array or JSON
    public const PAYLOAD = <<<JSON
{
    "Type": "RADIO",
    "Code": "RADIO-CODE",
    "Required": false,
    "Name": "Radio pricing option group",
    "Description": "Test option description",
    "Options": [
        {
            "Code": "9876545678",
            "ScaleMin": "1",
            "ScaleMax": "9",
            "SubscriptionImpact": {
                "Months": "0.00",
                "Impact": null
            },
            "PriceImpact": {
                "Amounts": {
                    "USD": {
                        "Currency": "USD",
                        "Amount": "1.00"
                    },
                    "EUR": {
                        "Currency": "EUR",
                        "Amount": "6.00"
                    }
                },
                "ImpactOn": null,
                "Method": "FIXED",
                "Percent": null,
                "Impact": null
            },
            "Default": false,
            "Name": "translation_5f90150268bef",
            "Description": "Translation value",
            "Translations": [
                {
                    "Name": "translation_5f90150268bf7",
                    "Description": "Translation value",
                    "Language": "RO"
                },
                {
                    "Name": "translation_5f90150268bef",
                    "Description": "Translation value",
                    "Language": "EN"
                },
                {
                    "Name": "translation_5f90150268bf9",
                    "Description": "Translation value",
                    "Language": "FR"
                },
                {
                    "Name": "translation_5f90150268bf5",
                    "Description": "Translation value",
                    "Language": "RU"
                }
            ]
        },
        {
            "Code": "98765456789",
            "ScaleMin": "10",
            "ScaleMax": "19",
            "SubscriptionImpact": {
                "Months": "0.00",
                "Impact": null
            },
            "PriceImpact": {
                "Amounts": {
                    "USD": {
                        "Currency": "USD",
                        "Amount": "1.00"
                    },
                    "EUR": {
                        "Currency": "EUR",
                        "Amount": "6.00"
                    }
                },
                "ImpactOn": null,
                "Method": "FIXED",
                "Percent": null,
                "Impact": null
            },
            "Default": false,
            "Name": "translation_5f90150268bef",
            "Description": "Translation value",
            "Translations": [
                {
                    "Name": "translation_5f90150268bf7",
                    "Description": "Translation value",
                    "Language": "RO"
                },
                {
                    "Name": "translation_5f90150268bef",
                    "Description": "Translation value",
                    "Language": "EN"
                },
                {
                    "Name": "translation_5f90150268bf9",
                    "Description": "Translation value",
                    "Language": "FR"
                },
                {
                    "Name": "translation_5f90150268bf5",
                    "Description": "Translation value",
                    "Language": "RU"
                }
            ]
        }
    ],
    "Translations": [
        {
            "Name": "Radio pricing option group",
            "Description": "Test option description",
            "Language": "EN"
        }
    ]
}
JSON;
}

class Client
{
    private const LOGIN_METHOD = 'login';
    private $calls = 1;
    private $sessionId;


    private function generateAuth(): array
    {
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $date = gmdate('Y-m-d H:i:s');
        $string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
        $hash = hash_hmac('md5', $string, $key);

        return compact('merchantCode', 'date', 'hash');
    }


    public function login(string $url)
    {
        $payload = $this->generateAuth();
        $response = $this->call($url, array_values($payload), self::LOGIN_METHOD);
        $this->sessionId = $response['result'];
    }


    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ): ?array {
        if (empty($this->sessionId) && $action !== self::LOGIN_METHOD) {
            $this->login($url);
        }
        if(is_string($payload)) {
            $payload = json_decode($payload, true);
        }
        if (!empty($this->sessionId)) {
            $payload = [$this->sessionId, $payload, Configuration::ADDITIONAL_OPTIONS];
        }
        $payload = array_filter($payload);

        $request = json_encode([
            'jsonrpc' => '2.0',
            'method' => $action,
            'params' => $payload,
            'id' => $this->calls++,
        ]);
        $curl = curl_init($url);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
        curl_setopt($curl, CURLOPT_SSLVERSION, 0);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Cookie: XDEBUG_SESSION=PHPSTORM'));
        curl_setopt($curl, CURLOPT_POSTFIELDS, $request);
        $response = curl_exec($curl);
        if(empty($response)) {
            die('Server unavailable');
        }
        echo $response . '</br>';
        return json_decode($response, true);;
    }
}
$client = new Client();
$result = $client->call();
var_dump($result);

 

Cross-sell

Overview

Use this object to retrieve information about the cross-sell campaigns you configured for your account. 

Parameters

Parameter Type/Description

CrossSellCampaign

Object

MasterProducts

Array

 

Array of product codes for the items you set to trigger the cross-sell campaign.

DisplayType

String

 

  • cart – Shopping cart
  • review – Review page
  • finish – Thank you page

DisplayInEmail

Boolean

 

True or false depending on whether you set the cross-sell campaign to display in payment receipt emails or not.

Products

Array of objects

 

Details below

 

ProductCode

String

 

 

Product code for the item you set as recommended for the cross-sell campaign.

 

Discount

String

 

 

Value of the discount. This is a percentage.

 

DiscountType

String

 

 

PERCENT – you can only set discounts as a percentage from the product price.

CampaignCode

String

 

Unique, system-generated cross-sell campaign code.

Name

String

 

Campaign name.

StartDate

String

 

YYYY-MM-DD. The start date you set for the cross-sell campaign.

EndDate

String

 

YYYY-MM-DD. The end date you set for the cross-sell campaign.

 

Search subscriptions

Overview

Extract information on your account’s subscriptions. Use the searchSubscriptions method to retrieve details about your account’s subscriptions, based on a set of filters.

Subscriptions can be retrieved starting with 5 minutes after their orders are generated in the 2Checkout system.

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.

searchBy

Optional (Object)

  Contains any combination of the available additional search filters.

Additional search filters

SubscriptionSearchOptions Parameters Type/Description

CustomerEmail

Optional (string)

 

Customer email address. Can be NULL.

Note: The CustomerEmail parameter must be paired always with another reference pointing to the correct customer, such as the 2CheckoutCustomerReference parameter or the ExternalCustomerReference parameter. Otherwise, the search call will return partial hits on the customer email address.

ExactMatchEmail Optional (Boolean)
  Force search by email to perform exact match; recommended to keep this option set to true in order to avoid matching similar email addresses from multiple customers.

DeliveredCode

Optional (string)

 

Activation key/code. Can be NULL.

AvangateCustomerReference

Optional (int)

 

System-generated customer reference. Can be NULL.

ExternalCustomerReference

Optional (string)

 

External customer reference that you control. Can be NULL.

Aggregate

Optional (boolean)

 

true - search will work across all your aggregated 2Checkout accounts.

false - default value. You limit the search to the account whose details you used for authentication.

Can be NULL.

SubscriptionEnabled

Optional (boolean)

 

true for enabled subscriptions.

false for disabled subscriptions.

Can be NULL.

RecurringEnabled

Optional (StringArray)

 

true – 2Checkout charges customers using recurring billing for subscriptions.

false – customers need to make manual payments to renew their subscriptions.

Can be NULL.

ProductCodes

Optional (StringArray)

 

Product identifier that you control. Can be NULL.

CountryCodes

Optional (string)

 

Country code (ISO 3166 two-letter code). Can be NULL.

PartnerCode Optional (string)
  Can be NULL.

PurchasedAfter

Optional (string)

 

YYYY-MM-DD. Subscription search interval start. You can search for subscriptions purchased between the dates you set using PurchasedAfter and PurchasedBefore. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

PurchasedBefore

Optional (string)

 

YYYY-MM-DD. Subscription search interval end. You can search for subscriptions purchased between the dates you set using PurchasedAfter and PurchasedBefore. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

ExpireAfter

Optional (string)

 

YYYY-MM-DD. Search subscriptions set to expire after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

ExpireBefore

Optional (string)

 

YYYY-MM-DD. Search subscriptions set to expire before a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

ModifiedAfter Optional (string)
  YYYY-MM-DD. Search subscriptions modified after a specific date.
ModifiedBefore Optional (string)
  YYYY-MM-DD. Search subscriptions modified before a specific date.

RenewedAfter

Optional (string)

 

YYYY-MM-DD. Search subscriptions renewed after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

RenewedBefore

Optional (string)

 

YYYY-MM-DD. Search subscriptions renewed before a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

NotificationAfter

Optional (string)

 

YYYY-MM-DD. Search subscriptions for which the 2Checkout system sent out notifications after a specific date. Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

NotificationBefore

Optional (string)

 

YYYY-MM-DD. Search subscriptions for which the 2Checkout system sent out notifications before a specific date Note: The default 2Checkout API time zone is GMT+02:00. Can be NULL.

NextBillingDateAfter Optional (string)
  YYYY-MM-DD. Search subscriptions with the next billing date after the specified date
NextBillingDateBefore Optional (string)
  YYYY-MM-DD. Search subscriptions with the next billing date before the specified date

Type

Optional (string)

 

trial - trial subscriptions.

regular - all generated subscriptions that are not trials.

regularfromtrial - subscriptions generated from a trial conversion.

Can be NULL.

TestSubscription

Optional (boolean)

 

true

false, depending on whether you want to include test subscriptions in the search or not. Can be NULL.

LifetimeSubscription

Optional (boolean)

 

true – evergreen subscriptions.

false - subscriptions with a limited recurring billing cycle, typically no larger than 36 months.

Can be NULL.

Page

Optional (int)

 

A specific page of search results. Default value is 1.

Can be NULL.

Limit

Optional (int)

 

Number of results (subscriptions) displayed per page. Default value is 10.

Can be NULL.

Response

Parameters Type/Description

Subscription

Array of objects

Request

<?php

require ('PATH_TO_AUTH');

$SubscriptionSearch = new stdClass();
$SubscriptionSearch->CustomerEmail  = 'example@email.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; 
$SubscriptionSearch->Pagination = new stdClass();
$SubscriptionSearch->Pagination->Page = 1;
$SubscriptionSearch->Pagination->Limit = 10;  //maximum value is 200;


try {
    $accountSubscriptions = $client->searchSubscriptions($sessionID, $SubscriptionSearch);
}
catch (SoapFault $e) {
    echo "accountSubscriptions: " . $e->getMessage();
    exit;
}
var_dump("accountSubscriptions", $accountSubscriptions);;

?>

Perform action

Overview

Use the performAction method via SOAP APIv6 to execute an action on the proposal.

Request parameters

Request parameters for the performAction method via SOAP APIv6

Action Parameters Type Required/Optional Description
  sessionId String Required Unique 2Checkout session ID code.

 

 

 

 

 

 

 

 

SEND

proposalId String Required The unique merchant proposal ID generated by the 2Checkout system.
exirationDate Date Required The date at which the proposal expires; date-time ISO 8601 format
userId String Optional The unique user ID generated by the 2Checkout system.
action String Required The action to be executed on the proposal.
statusComment String Optional Free text comments that can accompany a status.
sentBy String Required Represents the account manager of the merchant.

FirstName

String Required The first name of the email sender.

LastName

String Required The last name of the email sender.

Email

String Required The email address of the email sender.

 

ACCEPT

action String Required The action to be executed on the proposal.
statusComment String Optional Free text comments that can accompany a status.

 

 

CLOSE

action String Required The action to be executed on the proposal.
statusComment String Optional Free text comments that can accompany a status.
userId String Optional The unique user ID generated by the 2Checkout system.

 

 

DISCARD

action String Required The action to be executed on the proposal.
statusComment String Optional Free text comments that can accompany a status.
userId String Optional The unique user ID generated by the 2Checkout system.

 

 

REOPEN

action String Required The action to be executed on the proposal.
statusComment String Optional Free text comments that can accompany a status.
userId String Optional The unique user ID generated by the 2Checkout system.

 

DECLINE

action String Required The action to be executed on the proposal.
statusComment String Optional Free text comments that can accompany a status.

Request sample

<?php

require ('PATH_TO_AUTH');

$proposalId = "0573e71d-38bb-4d61-88ca-b3c557517c68";

$actionPayload = new stdClass();
$actionPayload->ExpirationDate = "2021-01-05T17:21:42+00:00";
$actionPayload->UserId = "john.doe@email.com";
$actionPayload->action = "decline";
$actionPayload->StatusComment = "The price is too high for the first product";
$actionPayload->SentBy = new stdClass();
$actionPayload->SentBy->FirstName = "John";
$actionPayload->SentBy->LastName = "Doe";
$actionPayload->SentBy->Email = "john.doe@email.com";

try {
    $results = $soapClient->performAction($sessionID, $proposalId , $actionPayload);
    echo "Performing action: </br>", 
    var_dump($results);
}
catch (SoapFault $e) {
    echo "Could not perform action: " . $e->getMessage();
    exit;
}

Response

The performAction call via SOAP APIv6 returns the Proposal object.

Retrieve all campaigns

Overview

Use the searchCrossSellCampaigns method to extract information about the cross-sell campaigns you configured.

Parameters

Parameters 

Type 

Required

Description 

CampaignName 

String 

Optional 

The name of the campaign.

Status 

String 

Optional 

The status of the campaign; can be ACTIVE/INACTIVE.

Products 

Array of strings 

Optional 

Array of product codes to apply to this campaign. 

RecommendedProducts 

Array of strings 

Optional 

Array of product codes recommended to the shopper.

StartDate 

String 

Optional 

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

EndDate 

String 

Optional 

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

Type String Optional Can be MERCH/AFF.

Pagination 

Object 

Optional 

  

Page 

Int 

Optional 

The page number of the results.

Limit 

Int 

Optional 

The number of results per page.

Response

Parameters Type/Description
Items An array of CrossSellCampaign Objects
Pagination Pagination Object with the following parameters: Page, Limit, Count

Request

<?php

require ('PATH_TO_AUTH');

try {
    $AllCrossSellCampaigns = $client->searchCrossSellCampaigns($sessionID);
}

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

var_dump("AllCrossSellCampaigns", $AllCrossSellCampaigns);

Retrieve a customer

Overview

Use the getCustomerInformation method to retrieve the details of a customer entity from the 2Checkout system.

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.

AvangateCustomerReference

Required (int)

 

System-generated customer reference. Required unless you prefer to use ExternalCustomerReference.

ExternalCustomerReference

Optional (string)

 

External customer reference that you control. Optional when you use AvangateCustomerReference. If you include it, it needs to belong to the same customer as the AvangateCustomerReference.

Response

Customer

Object

Request


<?php
$host   = "https://api.2checkout.com";
$client = new SoapClient($host . "/soap/6.0/?wsdl", array(
    'location' => $host . "/soap/6.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 = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.2checkout.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.2checkout.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;
}
$customerReference = 298084139;
$externalCustomerReference = 'Apitest123456'; //Optional, but if you include it it needs to belong to the same customer as the internal 2Checkout customer reference
try {
    $customerInfo = $client->getCustomerInformation($sessionID, $customerReference, $externalCustomerReference);
}
catch (SoapFault $e) {
    echo "customerInfo: " . $e->getMessage();
    exit;
}
var_dump("customerInfo", $customerInfo);

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