Skip to main content

INS parameters

Overview

Depending on your INS settings, notifications contain all or a subset of the available parameters. 2Checkout sends INS parameters in the exact order listed in this article.

For each trigger enabled, you are able to select which URL endpoint receives the notification, as well as customize the list of parameters included in the notification. Read more about INS parameters here.

Note: 2Checkout continues to add new INS parameters on an ongoing basis. To include additional information in the notifications, enable new parameters in the INS settings page.

Parameter Description Type
message_type Indicates the type of message String
message_description The description of message_type String
timestamp Timestamp of event; format YYYY-MM-DD HH:MM:SS ZZZ Timestamp
md5_hash Hash calculated for the notification. String
message_id This number is incremented for each message sent to a given seller Integer
key_count Indicates the number of parameters sent in a message Integer
vendor_id Merchant account number Integer
sale_id 2Checkout sale number Integer
sale_date_placed Date of sale; format YYYY-MM-DD Date
vendor_order_id Custom order id provided by seller, if available. (“merchant_order_id” can be passed into the checkout with the sale parameters) String
invoice_id 2Checkout invoice number; Each sale can have several invoices, most commonly one per installment billed on a recurring order. Integer
recurring recurring=1 if any item on the invoice is a recurring item, 0 otherwise Integer
payment_type Customer’s payment method. String
list_currency 3-Letter ISO code for seller currency String
cust_currency 3-Letter ISO code for customer currency String
auth_exp The date credit authorization will expire; format YYYY-MM-DD Date
invoice_status Status of a transaction (approved, pending, deposited, or declined) String
fraud_status Status of 2Checkout fraud review (pass, fail, or wait); Can be NULL. String
invoice_list_amount Total in seller pricing currency; format as appropriate to currency (2 decimal places for most, integer for JPY) Integer
invoice_usd_amount Total in US Dollars; format with 2 decimal places Integer
invoice_cust_amount Total in customer currency; format as appropriate to currency (2 decimal places for most, integer for JPY) Integer
customer_first_name Customer’s first name (may not be available on older sales) String
customer_last_name Customer’s last name (may not be available on older sales) String
customer_name Customer’s full name (name as it appears on credit card) String
customer_email Customer’s email address String
customer_phone Customer’s phone number; all but digits stripped out Integer
customer_ip Customer’s IP address at time of sale String
customer_ip_country Country of record for customer’s IP address at time of sale; Please note in some cases what is returned is not a country, Ex. Satellite Provider String
bill_street_address Billing street address String
bill_street_address2 Billing street address line 2 String
bill_city Billing address city String
bill_state Billing address state or province String
bill_postal_code Billing address postal code String
bill_country 3-Letter ISO country code of billing address String
ship_status Value will be not_shipped, shipped, or empty (if intangible / does not need shipped) String
ship_tracking_number Tracking Number as entered in Seller Admin String
ship_name Shipping Recipient’s name (as it should appears on shipping label) String
ship_street_address Shipping street address String
ship_street_address2 Shipping street address line 2 String
ship_city Shipping address city String
ship_state Shipping address state or province String
ship_postal_code Shipping address postal code String
ship_country 3-Letter ISO country code of shipping address String
item_count Indicates how many numbered sets of item parameters to expect Integer
item_name_# Product name String
item_id_# Seller product id String
item_list_amount_# Total in seller pricing currency; format as appropriate to currency (2 decimal places for most, integer for JPY) Integer
item_usd_amount_# Total in US Dollars; format with 2 decimal places Integer
item_cust_amount_# Total in customer currency; format as appropriate to currency (2 decimal places for most, integer for JPY) Integer
item_type_# Indicates if item is a bill or refund; Value will be bill or refund String
item_duration_# Product duration, how long it re-bills for Ex. 1 Year String
item_recurrence_# Product recurrence, how often it re-bills Ex. 1 Month String
item_rec_list_amount_# Product price; format as appropriate to currency (2 decimal places for most, integer for JPY) Integer
item_rec_status_# Indicates status of recurring subscription. Ex: canceled, completed String
item_rec_date_next_# Date of next recurring installment; Date
item_rec_install_billed_# The number of successful recurring installments successfully billed Integer
order_ref The reference number of the 2Checkout order. String
order_no The number of the 2Checkout order. Available only after the sale is risk approved. String

 Proposal Updated Parameters

Parameter Description Type
message_id The unique identifier of the proposal message. String
updated_date The date and time when then the proposal was last time updated; format YYYY-MM-DD HH:MM:SS ZZZ. Datetime
source The platform where the proposal was created. String
tac The Terms and Conditions content. String
accepted_date The date and time when then the proposal was accepted; format YYYY-MM-DD HH:MM:SS ZZZ. Datetime
status

The proposal status. Possible values:

  • opened
  • sent
  • closed_won
  • closed_lost
  • declined
  • expired
  • accepted
String
message_type The type of message sent with the proposal. String
key_count Indicates the number of parameters sent in a message. Number
proposal_id Unique identifier of the proposal generating the offer. Can be found in Order additional information as text. String
created_by The unique external system user identifier that created the proposal. String
content The proposal content. String
type The type of proposal (new acquisition, renewal, upgrade). String
expiration_date The UTC expiration date for the proposal, set only when the status is changed to "sent". Datetime
message_description The description of message_type. String
version The proposal version. Integer
updated_by The external system user ID that performed the last update on the proposal. String
bill_to Billing details. String
sent_by The account manager who sent out the proposal. String
status_comment The associated comment on the status of the proposal. String
timestamp Timestamp of event; format YYYY-MM-DD HH:MM:SS ZZZ. Datetime
created_date The date and time when then the proposal was created; format YYYY-MM-DD HH:MM:SS ZZZ. Datetime
locked The proposal is locked to buy modifications. String
name The name of the proposal. String
links

The proposal links details. Can be:

  • Proposal User Interface Access URL
  • Download PDF URL
String
sell_to The entity using the proposal service. String
md5_hash Hash calculated for the notification. String

 

Order session content object

Overview

Use this object to retrieve session content and to guide shoppers through advanced payment flows, such as those of PayPal, PayPal Express, Wire, Check, etc. 

Attributes

Order session  contents

Type/Description

Errors

Optional (StringArray)

 

Payment gateway processing errors.

Items

Array of objects

    Details below. 

 

ProductDetails

Object

      Details below. 

 

 

Name

Optional (string)

 

 

 

Product name.

 

 

ExtraInfo

Optional (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

Optional (boolean)

 

 

 

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

 

 

Subscriptions

Object

        Details below. 

 

 

 

SubscriptionReference

Optional (string)

 

 

 

 

Unique, system-generated subscription identifier.

 

 

 

PurchaseDate

Optional (string)

 

 

 

 

The date time stamp when shoppers acquired their subscriptions corresponding to the moment when the Avangate 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

Optional (string)

 

 

 

 

 

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

 

 

 

ExpirationDate

Optional (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

Optional (boolean)

 

 

 

 

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

 

 

 

Trial

Optional (boolean)

 

 

 

 

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

 

 

 

Enabled

Optional (boolean)

 

 

 

 

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

 

 

 

RecurringEnabled

Optional (boolean)

 

 

 

 

 

                    

PriceOptions

Optional (Array of strings)

 

 

Product price options.

 

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

Optional (double)

 

 

 

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

 

 

UnitGrossPrice

Optional (double)

 

 

 

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

 

 

UnitVAT

Optional (double)

 

 

 

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

 

 

UnitDiscount

Optional (double)

 

 

 

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

 

 

UnitNetDiscountedPrice

Optional (double)

 

 

 

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

 

 

UnitGrossDiscountedPrice

Optional (double)

 

 

 

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

 

 

UnitAffiliateCommission

Optional (double)

 

 

 

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

 

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

 

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

 

NULL when Avangate does not apply an affiliate commission.

 

 

Currency

Optional (string)

 

 

 

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

 

 

NetPrice

Optional (double)

 

 

 

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

 

 

GrossPrice

Optional (double)

 

 

 

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

 

 

NetDiscountedPrice

Optional (double)

 

 

 

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

 

 

GrossDiscountedPrice

Optional (double)

 

 

 

Total costs shoppers incur per order line, expressed in the payment currency. This value includes sales tax/VAT, Avangate and affiliate commissions, but Avangate 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

Optional (double)

 

 

 

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

 

 

VAT

Optional (double)

 

 

 

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

 

 

AffiliateCommission

Optional (double)

 

 

 

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

 

Code

Optional (string)

 

 

Unique product identifier your control. Max length 256 characters.

 

Quantity

Optional (integer)

 

 

Number of units

 

SKU

Optional (string)

 

 

SKU identifier.

 

CrossSell

Optional (Object)

      Details below. 

 

 

ParentCode

Optional (string)

 

 

 

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

 

 

CampaignCode

Optional (string)

 

 

 

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

 

Trial

Optional (Object)

      Details below. 

 

 

Period

Optional (integer)

 

 

 

The length of the trial subscription lifetime in days.

 

 

GrossPrice

Optional (double)

 

 

 

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

 

 

VAT

Optional (double)

 

 

 

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

 

 

NetPrice

Optional (double)

 

 

 

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

 

AdditionalFields

Optional (array of objects)

      Details below. 

 

 

Code

Optional (string)

 

 

 

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

 

 

Text

Optional (string)

 

 

 

Field text visible to shoppers in the cart.

 

 

Value

Optional (string)

 

 

 

Selected field value.

 

Promotion

Optional (object)

      Details below. 

 

 

Name

Optional (string)

 

 

 

Promotion name.

 

 

Description

Optional (string)

 

 

 

Promotion description.

 

 

StartDate

Optional (string)

 

 

 

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

 

 

EndDate

Optional (string)

 

 

 

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

 

 

MaximumOrdersNumber

Optional (integer)

 

 

 

Avangate 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

Optional (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

Optional (boolean)

 

 

 

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

 

 

Coupon

Optional (string)

 

 

 

Promotion coupon/voucher.

 

 

DiscountLabel

Optional (string)

 

 

 

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

 

 

Enabled

Optional (string)

 

 

 

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

 

 

Type

Optional (string)

 

 

 

  • REGULAR – product/cart line level discounts.
  • ORDER – quantity discounts.
  • GLOBAL – order-level discounts.

Promotions

Optional (Array of objects)

    Details below. 

 

Name

Optional (string)

 

 

Promotion name.

 

Description

Optional (string)

 

 

Promotion description.

 

StartDate

Optional (string)

 

 

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

 

EndDate

Optional (string)

 

 

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

 

MaximumOrdersNumber

Optional (integer)

 

 

Avangate 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

Optional (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

Optional (boolean)

 

 

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

 

Coupon

Optional (string)

 

 

Promotion coupon/voucher.

 

DiscountLabel

Optional (string)

 

 

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

 

Enabled

Optional (string)

 

 

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

 

Type

Optional (string)

 

 

  • REGULAR – product/cart line level discounts.
  • ORDER – quantity discounts.
  • GLOBAL – order-level discounts.

AdditionalFields

Optional (array of objects)

    Details below. 

 

Code

Optional (string)

 

 

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

 

Text

Optional (string)

 

 

Field text visible to shoppers in the cart.

 

Value

Optional (string)

 

 

Selected field value.

Currency

Optional (string)

 

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

NetPrice

Optional (double)

 

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

GrossPrice

Optional (double)

 

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

NetDiscountedPrice

Optional (double)

 

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

GrossDiscountedPrice

Optional (double)

 

Total costs shoppers incur, expressed in the payment currency. This value includes sales tax/VAT, Avangate and affiliate commissions, but Avangate 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

Optional (double)

 

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

VAT

Optional (double)

 

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

AffiliateCommission

Optional (double)

 

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

 

IPN triggers

Set IPN triggers and contents 

In your Control Panel account, navigate to Dashboard → Integrations → Webhooks and API and click on the IPN Settings tab. In the General IPN Settings section, under Triggers, select the events for which 2Checkout sends notifications.

Instant Payment Notification (IPN) provides automatic notifications for orders from the 2Checkout system, based on the following list of triggers you control:

IPN triggers

General

Trigger

ORDERSTATUS

Description

Pending orders

PENDING

Shopper places the order. 2Checkout is waiting for bank authorization.

 

PURCHASE_PENDING

Shopper places the order using a Purchase Order (PO). 2Checkout approves the PO document and you also approve the PO document. Shopper has yet to finalize the payment.

 

Alternatively, you use the AutoApprove API flow and do not require a PO document but the shopper has yet to finalize the payment.

Orders waiting to be processed by 2Checkout system / Orders under 2Checkout review

PENDING_APPROVAL

Order is waiting for the 2Checkout system to process it or for anti-fraud review.

Authorized and approved orders (sent before electronic delivery)

PAYMENT_AUTHORIZED

The bank authorized the payment.

 

PAYMENT_RECEIVED

2Checkout sends a notification when it receives payments for offline orders (e.g. Bank/Wire transfer) but only before fulfillment/delivery.

 

PENDING_ORDER_APPROVAL

2Checkout sends this status for products/subscriptions configured with the “Requires delivery confirmation” setting.

Authorized and approved orders (sent after electronic delivery)

PAYMENT_AUTHORIZED

The bank authorized the payment.

  COMPLETE

2Checkout marks the order as finished and fulfilled.

Order approved for delivery

PAYMENT_AUTHORIZED

You approved an order for fulfillment/delivery.

Completed orders / Invoice generated

COMPLETE

2Checkout marks the order as finished and fulfilled.

 

2Checkout can resend this notification when it generates invoices.

Order shipped (only for tangible products) PAYMENT_AUTHORIZED

You marked the order as shipped, and the delivery process has started.

2Checkout sends a notification to customers once orders are marked as shipped.

Refunds and chargebacks

Trigger

ORDERSTATUS

Description

Invalid orders

INVALID

Shopper provides invalid billing and/or delivery information. (Not available by default, contact 2Checkout directly to enable it)

Suspect orders

SUSPECT

The 2Checkout Risk department is reviewing the order for possible fraud. (Not available by default, contact 2Checkout directly to enable it)

Canceled orders

CANCELED

The 2Checkout system can send out notifications for:

  • eStore orders canceled by 2Checkout representatives (only for orders that are not authorized/paid, otherwise a reverse or refund action is required).
  • Partner (Channel Manager) orders canceled by you.
  • Purchase Orders not approved/submitted in due time

 

Chargeback open

COMPLETE

ORDERSTATUS is COMPLETE for chargebacks. 2Checkout details information about disputes in the CHARGEBACK_RESOLUTION and CHARGEBACK_REASON_CODE fields.

Chargeback closed / Invoice generated

COMPLETE

ORDERSTATUS is COMPLETE for chargebacks. 2Checkout details information about disputes in the CHARGEBACK_RESOLUTION and CHARGEBACK_REASON_CODE fields.

 

2Checkout can resend this notification when it generates chargeback invoices.

Reversed and refund orders

REVERSED

2Checkout reverses transactions and releases funds back to shoppers for Authorized payments that never reach the Complete status.

 

REFUND

2Checkout repays funds back to shoppers for Complete orders.

 

2Checkout can resend this notification when it generates refund invoices.

Purchase orders

Trigger

ORDERSTATUS

Description

Approved

PURCHASE_PENDING

You approve the PO document.

Rejected

CANCELED

You reject the PO document.

Completed

COMPLETE

Customer pays the PO.

Expired, not paid

CANCELED

You don’t approve nor reject the PO within time interval.

Canceled

CANCELED

You cancel the PO or 2Checkout cancels the order.

Channel manager

 

Trigger

ORDERSTATUS

Description

Pending approval orders from partners

PENDING

Resellers place order that await your approval.

Approved orders from partners

PENDING

You approve partner orders.

Delivered orders from partners

PENDING

2Checkout fulfills partner orders.

Retrieve SKU details

Overview

Parameters

Response

Request

<?php
require ('PATH_TO_AUTH');

$sku = 'YOUR_SKU_CODE';

try {
    $getSkuDetails = $client->getSkuDetails($sessionID, $sku);
} catch (SoapFault $e) {
    echo  $e->getMessage();
}
var_dump($getSkuDetails);

Update price options

Overview

Use the updatePriceOptionGroup method to update/edit an existing price options group you configured for your account.

  • Price options intervals cannot overlap.

Parameters

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.

PriceOptionsGroup

Required (object)

 

Use this object to update/edit a new price option group for your account.

You cannot update the

  • Code of the price options group.

Response

bool(true)

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;
}

$SearchOptions       = new stdClass();
$SearchOptions->Name = 'New Users from API';

$SearchOptions->Types = array(
    'INTERVAL',
    'RADIO',
    'COMBO'
); //RADIO, CHECKBOX, INTERVAL, COMBO, INTERVAL

$SearchOptions->Limit = 10;
$SearchOptions->Page  = 1;

try {
    $existentPriceOptions = $client->searchPriceOptionGroups($sessionID, $SearchOptions);
}

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

var_dump("existentPriceOptionst", $existentPriceOptions);

$existentPriceOptions[0]->Translations[0]->Name     = 'New Users from API_1';
$existentPriceOptions[0]->Translations[0]->Language = 'EN';
$existentPriceOptions[0]->Required                  = FALSE;

echo "\n";

var_dump($existentPriceOptions);


try {
    $NewPriceOptionGroup = $client->updatePriceOptionGroup($sessionID, $existentPriceOptions[0]);
}

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

var_dump("NewPriceOptionGroup", $NewPriceOptionGroup);


?>

Add leads for catalog products

Overview

The lead management functionality that exists for the ConvertPlus cart can be also integrated with a self-hosted cart.

Use the addLead method to create a lead when a customer abandons the cart before placing an order.

Request Parameters

Parameters Required Type/Description
Items Required Purchased products.
BillingDetails Required Array of strings. Billing information for the order.
DeliveryDetails Required Array of strings. Delivery information for the order.

Request Example

<?php

require ('PATH_TO_AUTH');

$Lead = new stdClass();

$Lead->CartId = "CartIdValue";
$Lead->Currency = "EUR";
$Lead->Language = "EN";
$Lead->ExternalReference = "REST_API_2CHECKOUT";
$Lead->Source = "testAPI.com";
$Lead->CustomerReference = "asdf1";
$Lead->MachineId = "123asd";

$Lead->Items = [];

$Item = new stdClass();
$Item->Code = "04C26C50F8";
$Item->Quantity = 2;
$Item->IsDynamic = false;
$Item->Tangible = true;
$Item->PurchaseType = "PRODUCT";
$Item->PriceOptions = [];

$priceOption = new stdClass();
$priceOption->Name = "group name 1";
$priceOption->Required = false;
$option = new stdClass();
$option->Name = 'add25';
$option->Value = 'add25';
$option->Surcharge = 100;
$priceOption->Options[] = $option;

$Item->PriceOptions[] = $priceOption;

$recurringOptions = new stdClass();
$recurringOptions->CycleLength = 6;
$recurringOptions->CycleUnit = 'MONTH';
$recurringOptions->CycleAmount = 100;
$recurringOptions->ContractLength = 2;
$recurringOptions->ContractUnit = 'YEAR';
$Item->RecurringOptions = $recurringOptions;

$marketingCampaigns = new stdClass();
$marketingCampaigns->Type = 23;
$marketingCampaigns->ParentCode = "m";
$marketingCampaigns->CampaignCode = 23;
$Item->MarketingCampaigns = $marketingCampaigns;

$Item->Price = new stdClass();
$Item->Price->Amount = 20;
$Item->Price->Type = "CUSTOM";

$additionalFields = [];

$additionalField = new stdClass();
$additionalField->Code = "TestFieldOne";
$additionalField->Text = "test text";
$additionalField->Value = "test value";
$additionalFields[] = $additionalField;
$Item->AdditionalFields = $additionalFields;

$Item->SubscriptionStartDate = date("Y-m-d H:i:s");

$Lead->Items[] = $Item;

$billingDetails = new stdClass();
$billingDetails->FirstName = "Customer";
$billingDetails->LastName = "2Checkout";
$billingDetails->Phone = null;
$billingDetails->Company = null;
$billingDetails->FiscalCode = "32423423";
$billingDetails->Email = "customer@2checkout.com";
$billingDetails->Address1 = "Test Address";
$billingDetails->Address2 = null;
$billingDetails->City = "LA";
$billingDetails->Zip = "12345";
$billingDetails->CountryCode = "RO";
$billingDetails->State = "CA";

$Lead->BillingDetails = $billingDetails;
$Lead->DeliveryDetails = clone($billingDetails);

$Lead->DeliveryInformation = new stdClass();
$Lead->DeliveryInformation->ShippingMethod = new stdClass();
$Lead->DeliveryInformation->ShippingMethod->Code = "sdfsd";

$Lead->PaymentDetails = new stdClass();
$Lead->PaymentDetails->Type = "CC";
$Lead->PaymentDetails->Currency = "EUR";
$Lead->PaymentDetails->PaymentMethod = new stdClass();
$Lead->PaymentDetails->PaymentMethod->RecurringEnabled = false;
$Lead->PaymentDetails->PaymentMethod->CardPayment = new stdClass();
$Lead->PaymentDetails->PaymentMethod->CardPayment->InstallmentsNumber = 23;
$Lead->PaymentDetails->CustomerIP = "1.2.3.4";

$Lead->LocalTime = date("Y-m-d H:i:s");


try {
    $leadData = $client->addLead($sessionID, $Lead);
} catch (SoapFault $e) {
    echo "addLead: " . $e->getMessage();
    exit;
}

var_dump("addLead", $leadData);

Response Example

class stdClass#18 (3) {
  public $LeadCode =>
  string(10) "60E6C4B574"
  public $CreatedAt =>
  string(19) "2019-11-05T16:39:36"
  public $Errors =>
  array(0) {
  }
}

 

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. 2Checkout 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 2Checkout system uses to calculate product prices for pricing configurations without a base price.

Response

bool(true)
<?php

require ('PATH_TO_AUTH');

$Prices = array();
$Prices[0] = new stdClass();
$Prices[0]->Currency = 'USD';
$Prices[0]->Amount = 999.99;
$Prices[1] = new stdClass();
$Prices[1]->Currency = 'EUR';
$Prices[1]->Amount = 111.99;
$Quantities = new stdClass();
$Quantities->MinQuantity = 1;
$Quantities->MaxQuantity = 99999;
$PriceOptions = null;
/*
$PriceOptions = array();
$PriceOptions[0] = new stdClass();
$PriceOptions[0]->Code = '04WCPNHWQ5';
$PriceOptions[0]->Options = array();
$PriceOptions[0]->Options[0] = 'loqmhwcpwk';
$PriceOptions[0]->Options[1] = 'n7332ux312';
$PriceOptions[1] = new stdClass();
$PriceOptions[1]->Code = '4CU1OVAGAA';
$PriceOptions[1]->Options = array();
$PriceOptions[1]->Options[0] = 'dvk7hv62jg';
$PriceOptions[1]->Options[1] = 'uf1svzaxcd';
*/
$PricingConfig              = new stdClass();
$PricingConfig->ProductCode = 'NewSubscriptionPlan_Code_12345';
$PricingConfig->Country     = null;
$type                       = 'REGULAR';

try {
    $NewPrice = $client->savePrices($sessionID, $Prices, $Quantities, $PriceOptions, $PricingConfig, $type);
}

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

var_dump("NewPrice", $NewPrice);


?>

Retrieve all groups

Overview

Use the getProductGroups method to extract information about the product groups you created for your account.

Parameters

Parameters Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

Response

Parameters Type/Description

ProductGroup

Array of objects

Request

 <?php

require ('PATH_TO_AUTH');

try {
    $ProductGroups = $client->getProductGroups($sessionID);
}

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

var_dump("ProductGroups", $ProductGroups);


?>

Expose merchant information for 2CO shopping cart

Overview

Disclaimer: the following method is intended for internal purposes only.

Use the getMerchantInforamtion method for retrieving vendor information required by the 2CO shopping cart into a single call.

This API method is protected through a special authentication header that the 2CO cart should sent. Click here to learn more about the X - header authentication.

Requirements

Authenticate using the special authentication header.

Response

Info Description
Company name Merchant company name.
Commercial name Merchant commercial name.
Demo flag Y if the vendor status is Pending, else P if the vendor has the "test orders" package active, otherwise N.
Forced currency code 3-letter code.
Shopping cart customization Shows possible cart customizations.
Payment methods Merchant available payment options.
Override line item limit -
Order auth time Minutes into days (how long it takes for the order to become complete).
3DS status true if vendor has Use3DSecure = NO, false otherwise.
Currencies Merchant available currencies.
Countries Merchant available ordering countries.
Languages Merchant available ordering languages.
Promotions

Promotions defined on merchant account.

Secret key Merchant account secret key.
Shipping methods Shipping methods defined on merchant account.

Request

<?php

function callRPC($Request, $hostUrl, $Debug = false) {
    $curl = curl_init($hostUrl);
    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_HTTPPROXYTUNNEL, false);
    curl_setopt($curl, CURLOPT_PROXY, '');
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Accept: application/json',
        'X-Avangate-Authentication: type="private" ver="2" app="2co-shopping-cart" merchant="RDGM" date="2018-01-31T13:57:44+00:00" hash="0m3ULy6dZ2xUI8CFtU0ersCootdf6wz8Z1qxN28FdXI="'
    ));

    curl_setopt($curl, CURLOPT_COOKIE, '');
    $RequestString = json_encode($Request);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);

    if ($Debug) {
        var_dump($RequestString);
    }
    $ResponseString = curl_exec($curl);
    if ($Debug) {
        var_dump($ResponseString);
    }

    if (!empty($ResponseString)) {
        $Response = json_decode($ResponseString);
        if (isset($Response->result)) {
            return $Response->result;
        }
        if (!is_null($Response->error)) {
            var_dump($Request->method, $Response->error);
        }
    } else {
        return null;
    }

    return null;
}

$host = 'http://api.avangate.com/soap/5.0';


try {
    $merchantInformation= $client->getMerchantInformation($sessionID);
}
catch (SoapFault $e) {
    echo "MerchantInformation: " . $e->getMessage();
    exit;
}

var_dump("merchantInformation", $merchantInformation);


 

Create accounts and contacts

Overview

After installing the CPQ app, you can start to create and edit accounts and contacts as instructed below.

Create or edit an account

1. In order to create a new account, you must access the Account tab and then click on the New button.

create a new account

2. A window will open and you can fill all the required information about the account. Click Save to update the changes.

account pop-up and the predefined fields to be filled in

3. To edit information on the account, use either in-line editing (1) or just click on the Edit button on that record (2).

edit account.png

Create or edit a contact

In order to create an Account, you have two options.

Option 1

1. You can create a Contact from an Account related list.

create contact.png

2. A window will open and you can fill the required fields. The created Contact is linked automatically to the Account from where it was created. 

These fields are mandatory when creating a contact:

  • Email
  • Mailing Street
  • Mailing Zip/Postal Code
  • Mailing City
  • Mailing State/Province
  • Mailing Country
  • First Name
  • Last Name
  • Phone
  • Mailing Country Code

contact pop-up and the predefined fields to be filled in

Option 2

1. You can create a contact from the Contact tab.

create contact from contact tab.png

2. In this case, you should fill in the details of the Account manually. In order to edit, use inline editing or the Edit button from the Contact Object.

edit contact.png

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