Skip to main content

Product Delivery Information (Sample)

Overview

Depending on your product type, the delivery policy can differ. Below you can find a few policy samples and you can choose to use the one that applies to your product type.

Delivery Policy for Tangible/Physical Products (Sample)

All orders are subject to product availability.

Shipping 

If an item in your order is unavailable, we will ship you the part of your order that is available. When that item becomes available, we will ship you the rest of your order. Shipping costs for your order are non-refundable and are based on the weight of the items you order and your location. The date of delivery for your order may vary due to carrier shipping practices, delivery location, method of delivery, and the number of items ordered, and in addition, your order may be delivered in separate shipments.

Additional taxes and charges 

Additional shipping charges may apply depending on your location and the size of your order. You are responsible for all taxes applicable to the delivery of your order, including sales tax, value-added tax, customs duties, and excise duties. If there is any damage to the items that you ordered on delivery, you must contact us within 5 days from receipt of your order.

Delivery Policy for Downloadable Digital Products (Sample)

Upon receipt of your order, you will either be prompted to begin your download immediately or you will receive an e-mail from us with instructions to complete your download. If you are prompted to begin your download immediately, your completion of the download will constitute delivery to you of the item(s) you purchased.

If you receive an e-mail from us with instructions to complete your download, the receipt by you of the e-mail will constitute delivery by us to you of the item(s) you purchased.

In case you are unable to download the item(s) you purchase or you do not receive an e-mail from us with instructions to complete your download, you must contact us within 5 days from the date of your order. If you do not contact us within 5 days from the date of your order, the item(s) you purchased will be considered received, downloaded, and delivered to you.

Delivery Policy for Services (Sample)

Upon receipt of your order, the services will be performed to you in accordance with the terms applicable to the services that you purchased. The nature of the services you purchased and the date of your purchase may impact the timing of the performance of the services. The services will be deemed to be successfully delivered to you upon the performance of the services

Enable/Disable product

Overview

Use the setProductStatus method to enable/disable products 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.

productCode

Required (string)

 

Use this object to configure your subscription plan/products.

 

You can set all Product parameters except 2CheckoutID. The 2Checkout system sets the unique product ID. The 2CheckoutID is not editable.

Status

Required (Boolean)

 

True or False, depending on whether you want to enable or disable a subscription plan/product.

Request Example

<?php

require ('PATH_TO_AUTH');

$ProductCode = "YourProductCode";

try {
    $ProductStatus = $client->setProductStatus($sessionID, $ProductCode, true); // TRUE to enable a product - FALSE to disable a product
}

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

var_dump("ProductStatus", $ProductStatus);

?>

Response Example

bool(true)

 

Add sources

Overview

Use the addPromotionSources method to define new sources for an existing promotion.

Parameters

Parameter Type/Description

sessionID

Required (string)

 

Output of the Login method.

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to add products to.

promotionSources

Required (string array)

 

Array of strings defining the promotion sources.

Response

Parameter Type/Description

promotionSources

String array

 

Array of strings defining the promotion sources.

Request

<?php

require ('PATH_TO_AUTH');

// Promotion code corresponding to the promotion you want to add sources to
$promotionCode = '';

// Sources array with the source values 
$sources = ['source1', 'source2'];

try {
    $updatedPromotion = $client->addPromotionSources($promotionCode,$sources);
}

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

var_dump("UpdatedPromotion", $updatedPromotion);

Pricing option

Overview

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

Retrieve a price option group                  Retrieve assigned price option groups                         Retrieve price option groups

Pricing option group

Parameters Type/Description

Name

String

 

Price option group name.

 

Use this parameter when adding a new price options group.

 

To edit the name of a price option group use the Name parameter under the Translations object.

Description

String

 

 

Pricing option group description.

Translations

Array of objects

 

 

Details below.

 

Name

String

 

 

Localized product pricing options group name under PriceOptionGroup.

Localized pricing option child name under Options.

 

Description

String

 

 

Localized product pricing options group description underPriceOptionGroup.

Localized pricing option child description under Options.

 

Language

String

 

 

ISO language code. (ISO 639-1 two-letter code).

Code

String

 

 

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

Type

String

 

 

The type of the pricing options group. Possible values:

· RADIO

· CHECKBOX

· INTERVAL

· COMBO

Options

Array of PriceOption objects

 

 

Details below.

                                                   PriceOption

Object

 

Code

String

 

 

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

 

ScaleMin

Int

 

 

The minimum value of a scale interval set for each pricing option child inside a pricing options group parent of the type INTERVAL.

 

ScaleMax

Int

 

 

The maximum value of a scale interval set for each pricing option child inside a pricing options group parent of the type INTERVAL.

 

SubscriptionImpact

SubscriptionLifetimeImpact object

 

 

Details below.

 

                    Months

String

 

 

The value in months the 2Checkout system adds or subtracts from the initial billing cycle of a subscription.

 

                     Impact

String

 

 

Possible values:

· ADD

· SUBTRACT

· LIFETIME

 

PriceImpact

Object

 

 

Details below.

 

                  ImpactOn

String

 

 

Possible values:

  • BASE corresponding to impact on base price
  • GLOBAL for impact on calculated sum.
 

                  Impact

String

 

 

Impact on price per unit:

  • ADD
  • SUBTRACT
 

                   Percent

String

 

 

The value of the percentage out of the price per product unit, when you usePERCENT for Method.

 

                    Method

String

 

 

Possible values:

· PERCENT

· FIXED

 

                    Amounts

Array of objects.

 

 

Details below.

 

                             Currency

String

 

 

Currency ISO code - ISO 4217.

 

                              Amount

String

 

 

The amount defined for each specific currency active for your account, when you use FIXED for Method.

 

Default

Boolean

 

 

TRUE for preselected options.

Missing for options that are not preselected.

 

Name

String

 

 

Pricing option child name.

 

Description

String

 

 

Pricing option child description.

 

Translations

Array of objects

 

 

Details below.

Usage  

String.

Defines the type of pricing for scale product options. Can be either regular (tiered pricing) or payperusage (metered billing).

 

 

Order session content

Overview

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

Retrieve session content                              Retrieve contents with prefill                                         Retrieve VAT or sales tax

Session contents object

Parameters                                                                                                       Type/Description

Errors

 

Array of strings

 

 

Payment gateway processing errors.

Items

Array of objects

    Details below. 

 

ProductDetails

Object

      Details below. 

 

 

Name

String

 

 

 

Product name.

    ShortDescription String
      Product short description.
    Tangible Boolean
     

Possible values:

  • TRUE - for physical products
  • FALSE - for digital products
    IsDynamic Boolean
     

Possible values:

  • TRUE - for dynamic products
  • FALSE - for 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.

 

 

Subscriptions

Object

        Details below. 

 

 

 

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

 

 

 

 

  • TRUE - customers opted for subscriptions to renew automatically when they expire.
  • FALSE- customers did not choose to renew the subscription automatically.

                    

PriceOptions

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

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

Int
 

 

 

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

 

 

UnitDiscount

Int

 

 

 

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

Int

 

 

 

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.

    VATPercent Int
      Percentage of VAT charged on the order.
    HandlingFeeNetPrice Int
      Handling fee applied to your net price configuration. 
    HandlingFeeGrossPrice Int
      Handling fee applied to your gross price configuration.

 

 

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 2Checkout 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, 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

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. 2Checkout does not take into account shipping costs when calculating affiliate commissions.

  LineItemReference String
    System-generated item reference.
  PurchaseType String
   

Possible values:

  • PRODUCT
  • SHIPPING
  • TAX
  • COUPON
  ExternalReference String
    External order reference that you control.

 

Code

String

 

 

Unique product identifier your control. Max length 256 characters.

 

Quantity

Int

 

 

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

Int

 

 

 

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

Int

 

 

 

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

Int

 

 

 

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.

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

Int

 

 

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

Int

 

 

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.

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.

BillingDetails

Object

Details below

  Person      

Object

Details below

    FirstName   String
  Customer first billing name.
    LastName   String
  Customer last billing name.
    CountryCode   String
  Two-letters code for customer billing country.
    State   String
  Customer billing state.
    City   String
  Customer billing city.
    Address1   String
  Customer billing address.
    Address2   String
  Customer additional address information.
    Zip   String
        Customer billing zip code.
    Email   String
        Customer billing email.
    Phone   String
        Customer billing phone.
    Company   String
        Customer billing company.
    FiscalCode   String
  Customer billing fiscal code.
DeliveryDetails

Object

Details below

  Person      

Object

Details below

    Phone   String
  Customer delivery phone number.
    FirstName   String
  Customer delivery first name.
    LastName   String
  Customer delivery last name.
    Company   String
  Customer delivery company.
    Email   String
  Customer delivery email.
    Address1   String
  Customer delivery address.
    Address2   String
  Customer additional delivery address.
    City   String
  Customer delivery city.
    Zip   String
  Customer delivery zip code.
    CountryCode   String
  Customer delivery country code.
    State   String
  Customer delivery state.
DeliveryInformation

Object

Details below

  ShippingMethod    

Object

Details below

    Code     String
          System-generated code assigned to the shipping method.
    TrackingURL   String
          Tracking URL assigned to the shipping method. 
    TrackingNumber   String
        Tracking Number provided to customers, used for obtaining more information about their package.
    Comment   String
  Additional information regarding the physical delivery of the product.

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.

 

 

Authentication

Overview

Use the login method for the authentication process in the 2Checkout system.

Parameters

Parameters Type/Description

MerchantCode

required (string)

 

Your merchant identifier (received from 2Checkout).

 

Date

required (string)

 

GMT ISO Date format (e.g. 2010-01-01 12:13:14)

 

Hash

required (Object)

 

Calculated HMAC_SHA256 signature based on MerchantCode and Date, using your secret key (see example below).

Response

Parameters

Type/Description

sessionID

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.

Request

To create the HMAC_SHA256 source string use your merchant code (available here) and the date of the request, prefixing them with the length in bytes of each respective value, along with your account’s secret key (for UTF-8 characters the length in bytes might be longer that the string length). For example:

Parameters

Type/Description

MerchantCode

Avangate

 

8AVANGATE

 

Date

2010-05-13 12:12:12

 

192010-05-13 12:12:12

 

HMAC source string

8AVANGATE192010-05-13 12:12:12

 

Secret key

SECRET_KEY

Calculated HMAC_SHA256 signature based on MerchantCode and Date, using your secret key:

bf763db7d333e9c3038698cf59ada3e6

<?php

$host   = "https://api.2checkout.com";

$merchantCode = "YOURCODE123";
//your account's merchant code available in the 'System settings' area of the cPanel:
//https://secure.2checkout.com/cpanel/account_settings.php

$key          = "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'); //GMT date format)
$algo = "sha256";
$string = strlen($merchantCode) . $merchantCode . strlen($now) . $now;
$hash = hash_hmac($algo, $string, $key);

try {
    $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
            )
        ))
    ));
    $sessionID = $client->login($merchantCode, $now, $hash, $algo);
    echo("Auth token: {$sessionID}" . PHP_EOL);
}
catch (SoapFault $e) {
    echo "Authentication: " . $e->getMessage() . PHP_EOL;
    exit;
}

Search methods pagination

Overview

Starting with 2Checkout API 5.0, search methods are including the option of pagination. Pagination has been developed for decreasing the request loading time, while allowing you to better handle the returning responses.

How it works?

Pagination works on all the search methods existing on 2Checkout API 5.0. The default pagination behavior is to display page 1 with 10 results. The maximum number of items displayed on a single page is 200.

Parameters

To use pagination, include the Pagination object inside the search method call, using the parameters below:

Parameters Type/Description
Pagination Object
  Details below.
  Page Int
    Set the number of pages that should be returned.
  Limit Int
    Set a limit for the number of results that should be returned.

Response

The response of search methods that are including pagination will contain a new object, with the following parameters:

Parameters Type/Description
Pagination Object
  Details below
  Page Int
    Set the number of pages that should be returned.
  Limit Int
    Set a limit for the number of results that should be returned.
  Count Int
    Number of total results returned

Sample request

The below PHP sample includes a search method for subscriptions.

<?php

require('PATH_TO_AUTH');

$SubscriptionSearch = new stdClass();
$SubscriptionSearch->CustomerEmail  = 'email@avangate.com';
$SubscriptionSearch->DeliveredCode = null;
$SubscriptionSearch->AvangateCustomerReference = null;
$SubscriptionSearch->ExternalCustomerReference = null;
$SubscriptionSearch->Aggregate = false;
$SubscriptionSearch->SubscriptionEnabled = null; //true false null
$SubscriptionSearch->RecurringEnabled = null; // true - autorenewal, false - manual renewal, null = both(default)
$SubscriptionSearch->ProductCodes = null; //array('Product_Code1', 'Product_Code2');
$SubscriptionSearch->CountryCodes = null;//array ('au')
$SubscriptionSearch->PurchasedAfter = null;
$SubscriptionSearch->PurchasedBefore = null;
$SubscriptionSearch->ExpireAfter = null;
$SubscriptionSearch->ExpireBefore = null;
$SubscriptionSearch->LifetimeSubscription = null;
$SubscriptionSearch->Type = 'regular'; //'trial', 'regular', 'regularfromtrial'
$SubscriptionSearch->TestSubscription = null; // true, false, null = both(default)
$SubscriptionSearch->Pagination = new stdClass();
$SubscriptionSearch->Pagination->Page = 1; // set the number of pages for the response
$SubscriptionSearch->Pagination->Limit = 200; // set the limit for the values from the response

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

Proposal microservice

Overview

Use the Proposal object via JSON-RPC API 6.0 to store cart information at a point in time that allows you afterward to operate fast changes to the cart configuration so that you can offer custom deals to your shoppers. By using the Proposal object you can create, update, and search proposals via the 2Checkout API and control the following proposal attributes:

  • Proposal content
  • Price options
  • Proposal links
  • Billing details

Parameters

Use the parameters below to add new custom deals for your shoppers via JSON-RPC API 6.0.

PROPOSAL OBJECT

Parameters Type  Required/Optional Description

proposalId

String

Required

The unique merchant proposal id generated by the 2Checkout system.

name

String

Required (create)

The name of the proposal.

version

Integer

Required

The version of the proposal. Every modification increments the version by 1.

createDate

String

Required

The UTC creation date for the proposal in ISO 8601 format. Example: 2020-01-05T17:21:42+00:00.

updateDate

String

 Required

The update date of the proposal; date-time ISO 8601 format; populated by the UserId.

createdBy

String

 Required

The unique external system user identifier of the user that created the proposal. Example: john.doe@customer.com.

updatedBy

String

 Required

The unique external system user identifier of the user that last updated the proposal. Example: john.doe@customer.com.

locked

Boolean

 Required

Signals if the proposal is locked or not for updates in order to restrict modifications.

Possible values:

  • True
  • False

source

String, enum

 Required

The source from where the proposal was created. Can be: [ MERCHANT_CPANEL, MERCHANT_API, QUOTE_INTERFACE, SALESFORCE_CPQ ].

content

Object (ProposalContent)

Required (create)

The content of the proposal.

billTo

Object (BillTo)

Required (create)

The billing details associated with the proposal.

tac

Object (tac)

Required

Terms and conditions applied to the proposal.

type

String, enum

Required (create)

The type of proposal that defines the way it will be processed onwards; Can be [amendment, acquisition].

sentBy

Object (sentBy)

 Optional

Represents the account manager of the merchant.

links

Object (links)

 Required

The proposal links details.

status

String, enum

 Required

The status of the proposal; can be [ opened, sent, in_review, reviewed, closed_won, closed_lost, declined, expired, accepted ].

statusComment

String

 Required

Free text comments that can accompany a status.

expirationDate

String

 Optional

The date at which the proposal expires; date-time ISO 8601 format.

sellTo

Object (sellTo)

Required (create)

Represents the entity using the service. Used for tax calculation.

terms Int Optional Can be NULL.

ProposalContent Object

Parameters Type Required Description

language

String

Required (create)

The ISO 639-1 language code used to display the content of the proposal.

currency

String

Required

The ISO 4217 currency code used to display the product and order values.

lineItems

Array of objects (lineItem)

Required

The list of products & associated custom values for the proposal.

LineItem Object

Parameters Type Required/Optional Description

productName

String

Required

Name of the product.

productCode

String Required

2Checkout product code.

quantity

Float

Required

The quantity of the product.

price

Float Required

The list price of the product.

discountPrice

Float Required

The discounted price of the product.

priceType

String, enum

Required

The price type, can be gross or net.

subscriptionReference

String

Optional

The subscription reference for upgrade of renewal.

contractPeriod

Integer

Required

The number of billing cycles. A zero value means a lifetime contract period and billingCycle is not needed in this case.

immediateAction

String

 Optional

Defines if the contract starts now or at the end of the current billing cycle or contract period [ now, end_of_billing_cycle, end_of_contract ].

billingCycle

Object (billingCycle)

 Optional

The billing cycle configuration.

priceOptions

Array of priceOption objects

 Optional

Array of selected price options.

additionalFields

Array of additionalField object

 Optional

Array of Product additional fields.

prorationDate String Optional ISO8601 format with UTC timezone.
BillingCycle Object
Parameters Type Required/Optional Description

unit

String, enum

Required

The unit for the billing cycle can be [day, month].

value

Integer

Required

The number of days or months. The minimum for a day unit is 7.
 

PriceOptions - Array of priceOption objects
Parameters Type Required/Optional Description

groupCode

String

 Required

The price options group code.

groupOptions

Array of strings

 Required

Selected group option code.

AdditionalFields - Array of additionalField Object
Parameters Type Required/Optional Description

code

String

  Required

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

value

String

  Required

Selected field value.

BillTo Object

Parameters Type Required/Optional Description

company

String Required

End-user company name.

email

String Required

Contact email address.

phone

String Required

Contact phone number.

country

String Required

The country for the address. Represents the country code as specified by ISO 3166-1 alpha-2. Example: 1849 Cardinal Lane.

state

String Required

The country state for the address.

city

String Required

The city for the address.

zip

String Required

The address zip code.

address

String Required

The street address.

tac Object

Parameters Type Required/Optional Description

content

String

Required

The terms and conditions of the proposal.

acceptedDate

String

Optional

The UTC date when the proposal terms and conditions were accepted in ISO 8601 format. Example: 2020-01-05T17:21:42+00:00.

SentBy Object

Parameters Type Required/Optional Description

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.

Links Object

Parameters Type Required/Optional Description

linkId 

String Required

The unique link id.

url

String Required

The link URL for viewing.

status

String, enum

Required

The status of the proposal. Default: opened.

pdf String Required The link URL for downloading the PDF.

SellTo Object

Parameters Type Required/Optional Description

company

String

Required

End-user company name.

email

String Required

Contact email address.

vatCode

String Optional

For companies, it needs to be the VAT ID. 

phone

String Required

Contact phone number.

country

String Required

The country for the address. Represents the country code as specified by ISO 3166-1 alpha-2.

state

String Required

The country state for the address.

city

String Required

The city for the address.

zip

String Required

The address zip code.

address

String Required

The street address.

taxExemptionId String Optional The tax exemption ID code.

ERRORS

Parameters Type Description

code

Integer

Internal error code.

detail

String

The details of the error associated with the code.

status

Integer

HTTP error code.

 

Add coupon

Overview

Use the addPromotionCoupon method to add single or multiple coupons to a promotion. Using the addPromotionCoupon for a promotion that is set to apply automatically will change the promotion type to the manual flow, where customers are required to enter the coupon code to receive the discount.

Parameters

Parameter Type/Description

sessionID

Required (string)

 

Output of the Login method.

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to add coupons to.

promotionCoupon

Required (object)

 

type

Required (string)

 

 

Coupon type. Available values:

  • SINGLE, use in conjunction with Code
  • MULTIPLE, use in conjunction with Codes

 

Code/Codes

Required (string / array of strings)

 

 

Coupon code (for SINGLE) or array of coupon codes (for MULTIPLE).

Response

Parameter Type/Description
promotionCoupon Object

Request

<?php

require ('PATH_TO_AUTH');

// Promotion code corresponding to the promotion you want to add coupons to
$promotionCode = '';

// Define single coupon object
$promotionCoupon = new stdClass;
$promotionCoupon->Type = 'SINGLE';
$promotionCoupon->Code = 'YOUR_CODE_HERE';

// Define multiple coupon object
$promotionCoupon = new stdClass;
$promotionCoupon->Type = 'MULTIPLE';
$promotionCoupon->Codes = ['YOUR_CODE_1', 'YOUR_CODE_2'];

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'addPromotionCoupon',
'params' => array($sessionID, $promotionCode, $promotionCoupon)
);
var_dump (callRPC($jsonRpcRequest, $host));

Set SKU codes

Overview

Use the setSku method to create a valid combination of elements (code) for a specific product. 

In case there is an active SKU schema available for that Product Code and Pricing Configuration Code, when setting new SKUs the entire existing schema will be overwritten with the new values. The same validations that are applied to the CSV file import in the Merchant Control Panel are applicable to the API as well.

Product SKUs created via API will also be available in the Merchant Control Panel for manual update (Dashboard → Setup → Products → Edit product → Information → SKU Manager (SKU list Tab).

Request Example

<?php

require ('PATH_TO_AUTH');

$product = new \stdClass();
$product->ProductCode = "6B3CB17DDA_COPY1";

$skuPricingOption1 = new \stdClass();
$skuPricingOption1->Code = "E684EC99B0";

$skuDetail1 = new \stdClass();
$skuDetail1->ProductSKU = "Product_Test_SKU_001022";
$skuDetail1->Currency = "USD";
$skuDetail1->FromQty = 1;
$skuDetail1->ToQty = 3
$skuDetail1->PurchaseType = "NEW_PRODUCT";

$skuGroup = new \stdClass();
$skuGroup->GroupCode = "GRUP_1";

$skuGroupOption = new \stdClass();
$skuGroupOption->Name = "option name 1";
$skuGroupOption->Value = "option_code_1";

$skuGroup->Options = [$skuGroupOption];

$skuDetail1->Groups = [$skuGroup];
$skuDetail1->Options = "eJwBLADT/6G10uOW07exk6mNk7KvrpaSc4l1lbXToqi5sriTcbOXseWu3ZGrlXauuZOojh8cww==";

$skuDetail2 = new \stdClass();
$skuDetail2->ProductSKU = "Product_Test_SKU_001023";
$skuDetail2->Currency = "USD";
$skuDetail2->FromQty = 1;
$skuDetail2->ToQty = 3
$skuDetail2->PurchaseType = "NEW_PRODUCT";

$skuGroup = new \stdClass();
$skuGroup->GroupCode = "GRUP_1";

$skuGroupOption = new \stdClass();
$skuGroupOption->Name = "option name 2";
$skuGroupOption->Value = "option_code_2";

$skuGroup->Options = [$skuGroupOption];

$skuDetail2->Groups = [$skuGroup];
$skuDetail2->Options = "eJwBLADT/6G10uOW07exk6mNk7KvrpaSc4l1lbXToqi5sriTcbOXseWu3ZGrmXauuZOojjccxw==";

$skuPricingOption1->Details = [$skuDetail1, $skuDetail2];

$product->SkuPricingOptions = [$skuPricingOption1];


try {
    $skuOutput = $client->setSku($sessionID, [$product]);
} catch (SoapFault $e) {
    echo "setSku: " . $e->getMessage();
    exit;
}

var_dump("setSku", $skuOutput);



Response Example

class stdClass#201 (2) {
  public $Results =>
  class stdClass#202 (1) {
    public $0 =>
    class stdClass#203 (2) {
      public $ProductCode =>
      string(16) "6B3CB17DDA_COPY1"
      public $PricingConfigurationCode =>
      string(10) "E684EC99B0"
    }
  }
  public $Errors =>
  class stdClass#204 (0) {
  }
}

 

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