Skip to main content

Retrieve a lead

Overview

Use the getLead method to retrieve leads created in the 2Checkout systems by fetching the lead code.

Request Parameters

Parameters Required Type/Description

LeadCode

Optional

String/Array of strings. Retrieves all leads based on their unique identification code (system-generated).

 

 

Email

Optional

String. A valid email address used by the customer

Type

Optional String. Must be one of the existing types of leads:
  • New
  • Used
  • UsedSuccess
  • Stopped
  • NotStopped

StartDate

Optional String. The start date of the interval; format must be yyyy-mm-dd.

EndDate

Optional String. The end date of the interval; format must be yyyy-mm-dd.

ProductCode 

Optional

String/Array of strings. Searches for all leads containing the product code.

Language

Optional String. The language of the shopper cart; ISO 639-1 two-letter code.

Country

Optional String. The customers billing country; ISO 3166 two-letter code.

GeneratedFrom 

Optional String. API, shopping cart, ConvertPlus. Display the leads based on the source where they were created – via API or via the 2Checkout ordering engines.

Request Example

<?php

require ('PATH_TO_AUTH');

$jsonRpcRequest = array (
    'method' => 'getLead',
    'params' => array($sessionID, '60E6C4B574'),
    'id' => $i++,
    'jsonrpc' => '2.0'
);

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

Response Example

class stdClass#18 (14) {
  public $LeadCode =>
  string(10) "60E6C4B574"
  public $GeneratedFrom =>
  string(3) "API"
  public $CartId =>
  string(11) "CartIdValue"
  public $Currency =>
  string(3) "EUR"
  public $Language =>
  string(2) "BG"
  public $ExternalReference =>
  string(18) "REST_API_3CHECKOUT"
  public $MachineId =>
  string(6) "123asd"
  public $LocalTime =>
  string(19) "2019-11-05 16:48:28"
  public $Items =>
  class stdClass#19 (1) {
    public $0 =>
    class stdClass#20 (15) {
      public $Code =>
      string(10) "04C26C50F8"
      public $Quantity =>
      string(1) "2"
      public $SKU =>
      NULL
      public $Name =>
      string(5) "softy"
      public $Description =>
      NULL
      public $IsDynamic =>
      bool(false)
      public $Tangible =>
      bool(false)
      public $PurchaseType =>
      string(7) "PRODUCT"
      public $PriceOptions =>
      NULL
      public $RecurringOptions =>
      class stdClass#21 (5) {
        public $CycleLength =>
        NULL
        public $CycleUnit =>
        NULL
        public $CycleAmount =>
        NULL
        public $ContractLength =>
        NULL
        public $ContractUnit =>
        NULL
      }
      public $RenewalInformation =>
      class stdClass#22 (1) {
        public $SubscriptionReference =>
        NULL
      }
      
      }
      public $MarketingCampaigns =>
      class stdClass#23 (3) {
        public $Type =>
        string(2) "23"
        public $ParentCode =>
        string(1) "m"
        public $CampaignCode =>
        string(2) "23"
      }
      public $Price =>
      class stdClass#24 (2) {
        public $Amount =>
        string(2) "20"
        public $Type =>
        string(6) "CUSTOM"
      }
      public $AdditionalFields =>
      NULL
      public $SubscriptionStartDate =>
      string(19) "2019-11-05 16:48:28"
      }
  
  public $BillingDetails =>
  class stdClass#25 (12) {
    public $FirstName =>
    string(8) "Customer"
    public $LastName =>
    string(9) "2Checkout"
    public $Phone =>
    NULL
    public $Company =>
    NULL
    public $FiscalCode =>
    string(8) "32423423"
    public $Email =>
    string(22) "customer@2checkout.com"
    public $Address1 =>
    string(12) "Test Address"
    public $Address2 =>
    NULL
    public $City =>
    string(2) "LA"
    public $Zip =>
    string(5) "12345"
    public $CountryCode =>
    string(2) "RO"
    public $State =>
    string(2) "CA"
  }
  public $DeliveryDetails =>
  class stdClass#26 (12) {
    public $FirstName =>
    string(8) "Customer"
    public $LastName =>
    string(9) "2Checkout"
    public $Phone =>
    NULL
    public $Company =>
    NULL
    public $FiscalCode =>
    string(8) "32423423"
    public $Email =>
    string(22) "customer@2checkout.com"
    public $Address1 =>
    string(12) "Test Address"
    public $Address2 =>
    NULL
    public $City =>
    string(2) "LA"
    public $Zip =>
    string(5) "12345"
    public $CountryCode =>
    string(2) "RO"
    public $State =>
    string(2) "CA"
  }
  public $DeliveryInformation =>
  class stdClass#27 (1) {
    public $ShippingMethod =>
    class stdClass#28 (1) {
      public $Code =>
      string(5) "sdfsd"
    }
  }
  public $PaymentDetails =>
  class stdClass#29 (4) {
    public $Type =>
    string(2) "CC"
    public $Currency =>
    string(3) "EUR"
    public $PaymentMethod =>
    class stdClass#30 (2) {
      public $RecurringEnabled =>
      bool(false)
      public $CardPayment =>
      class stdClass#31 (1) {
        public $InstallmentsNumber =>
        string(2) "23"
      }
    }
    public $CustomerIP =>
    string(7) "1.2.3.4"
  }
  public $Promotions =>
  array(1) {
    [0] =>
    string(0) ""
  }
}

 

Update product

Overview

Use the updateProduct method to update the configuration of a subscription plan/product you already configured 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.

Product

Required (object)

 

Use this object to configure your subscription plans/products.

 

You can update/edit all parameters, except the following:

  • AvangateID
  • ProductType

Exceptions

When updating a subscription plan/product, you also update its PricingConfigurations. However, you cannot modify:

  • The pricing configuration CODE.
  • The PricingSchema from DYNAMIC to FLAT or vice versa.  

Request

<?php

require ('PATH_TO_AUTH');

$ProductCode = 'NewProdCodeAPI12345';

try {
$myProduct = $client->getProductByCode($sessionID, $ProductCode);
}

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

$myProduct->ProductName = 'Edited_From_API_Again';

var_dump ($myProduct);

try {
    $NewSubscriptionPlan = $client->updateProduct($sessionID, $myProduct);
}

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

var_dump("UpdatedProductInfo", $NewSubscriptionPlan);

?>

Response

bool(true)

 

Pricing configuration

Overview

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

Pricing configuration object

Parameters Type/Description
Name String
  Pricing configuration name.
Code String
  System-generated identifier. Read-only.
Default Boolean
  True for the default pricing configuration
BillingCountries Array of strings
 

ISO codes of the countries assigned to the pricing configuration.

Empty unless a pricing configuration has specific countries assigned.

PricingSchema String
 

DYNAMIC – With a base price

FLAT – Without a base price

PriceType String
 

Possible values:

• NET

• GROSS

DefaultCurrency String
  The ISO code of the default currency for the pricing configuration.
Prices Object
  Details below.
  Regular Array of objects
    Details below.
    Amount Int
      The price of the product. Use -1 to delete it.
    Currency String
      ISO code of the currency for the product price.
    MinQuantity Int
      The minimum quantity of volume discounts. Default is 1.
    MaxQuantity Int
      The maximum quantity of volume discounts. Default is 99999.
    OptionCodes Array of objects
      Details below.
      Code String
        System generated pricing options group code (you can also configure it) that the 2Checkout system uses to calculate product prices for pricing configurations without a base price.
      Options StringArray
        The pricing options group option code you configured that the 2Checkout system uses to calculate product prices for pricing configurations without a base price.
  Renewal Array of objects
    Details below.
    Amount Int
      The price of the product. Use -1 to delete it.
    Currency String
      ISO code of the currency for the product price.
    MinQuantity Int
      The minimum quantity of volume discounts. Default is 1.
    MaxQuantity Int
      The maximum quantity of volume discounts. Default is 99999.
    OptionCodes Array of objects
      Details below.
PriceOptions Array of objects
  Details below.
  Code String
    System generated pricing options group code (you can also configure it) that the 2Checkout system uses to calculate product prices for pricing configurations without a base price.
  Required Boolean
   

true – you set the price options group as required during the purchase process.

false - you did not set the price options group as required during the purchase process.

 

 

Next renewal price

Overview

Use the methods below to set or retrieve information related to the next renewal price to be charged on a customer's subscription.

 

Generate SKU Schema

Overview

Stock keeping unit or SKU is a number assigned to a particular product by a digital or physical retail store for easy identification and inventory tracking purposes. The SKU number is a string of alphanumeric characters that uniquely identify details such as price, product options, and manufacturer of a particular product or service. SKUs are used in order notifications, electronic delivery, export files, etc.

SKU Management

For companies that manage large product catalogs with defined SKUs and that make regular changes to their prices and products (new versions, new options), the manual process performed in the Merchant Control Panel needs to be supported by an automatic solution as well. By using an automated flow, merchants decrease the time needed for this process, and also reduce the risk of human errors associated with the manual process.

In the 2Checkout platform, SKUs can be associated with a unique combination made up of:

  • Product identification element
  • Pricing configuration
  • Plus minimum one of the following:
    • Currency – defined as applicable to all currencies or only to specific ones
    • Volume Discounts – defined as specific quantity or intervals (applicable only according to the volume discounts that are defined at pricing configuration level)
    • Purchase Types – possible values: new purchase, renewal, upgrade, and trial
    • Pricing Options – will be available considering the pricing option groups assigned to the selected pricing configuration

 

 

Reseller

Overview

Structure

Reseller Object
ResellerCode String
  Unique, system generated reseller identifier. Can be NULL.
Company String
  Reseller company name. Can be NULL.
FirstName String
  Reseller first name. Can be NULL.
LastName String
  Reseller last name. Can be NULL.
Email String
  Reseller email. Can be NULL.
Phone String
  Reseller phone. Can be NULL.
Fax String
  Reseller fax. Can be NULL.
Country String
  Reseller country ISO language code (ISO 639-1 two-letter code). Can be NULL.
State String
  Reseller state. For example, "Alabama","Alaska","Arizona". Can be NULL.
City String
  Reseller city. Can be NULL.
Address String
  Reseller address. Can be NULL.
PostalCode String
  Reseller ZIP code. Can be NULL.

 

Purchase order status change

Use the variables in the list below to customize the Purchase order status change shopper email according to your needs. Check the 'Mandatory' column to see the variables that are required in your customized version of the e-mail.

Variable name Description Test Value Mandatory

ALLOW_MYACCOUNT_PROMO

Include or exclude myAccount information in the email body

1 No
AVANGATE_LOGO Avangate logo URL https://secure.avangate.com/images/e...endor_logo.png Yes

BANKACCOUNT

Avangate bank account

[NLXXABNAXXXXXXXXXX (IBAN)] No

BANKNAME

Avangate bank name

ABN AMRO Bank Amsterdam No

BANKSWIFT

Avangate bank swift code

ABNANL2XXX No

BASE_URL

Merchant's full host

https://secure.avangate.com No

BUSINESS_COMPANY

Avangate company name

Avangate Yes

BUSINESS_HOTLINE

Avangate support phone

0 No

BUSINESS_HOTLINEUS

Avangate US hotline number

0 No

BUSINESS_OPEMAIL

Avangate operational email address

0 No

BUSINESS_OPFAX

Avangate operational fax number

0 No

BUSINESS_SUPEMAIL

Avangate support email address

0 No

COMMERCIALNAME

Merchant's commercial name

0 Yes

CURRENCY_ORIGINAL

Original order currency (applicable to refunds)

0 No

DELIVERABILITY

Order delivery status

0 No

ENCRYPTED_MERCHANT_CODE

Encrypted merchant code

0 No

EXTRA_INFO

0

0 No

FIRSTNAME

Shopper's first name used on the delivery information

John No
GATEWAY_ERROR_CODE Gateway error code GW_PROCESSING_ERROR

See the full
list of Possible Values
No
GATEWAY_ERROR_MESSAGE Reason why the transaction failed. (e.g. Invalid card, insufficient funds) Error processing the card transaction. The card account has not been debited. Card data is invalid or incomplete. No

HAS_RENEWAL_PRODUCTS

Flag that indicates whether at least one product has renewal settings

0 No

HOTLINE_NUMBERS

0

0 No

HOTLINE_NUMBERS.NG_PHONE[index1].HotlineName

Countries where Avangate support information is available

0 No

HOTLINE_NUMBERS.NG_PHONE[index1].HotlineValue

Avangate phone number(s) for shopper support

0 No

IS_RENEWAL

Flag that indicates whether at least one product has renewal settings

0 No

LANGUAGE

Order language (abbreviated) selected by shopper

en No

LASTNAME

Shopper's last name used on the delivery information

Doe No

NAMES_OF_PRODUCTS

Names of all products in the order, comma separated

0 No

ORDERDATE

Order placement date

10/9/2019 No

ORDER_AMOUNT_ORIGINAL

Original order value (applicable to refunds)

10/9/2019 No

ORDER_DATE_STANDARD_FORMAT

Standard format used for the order placement date

0 No

ORDER_FLOW

Purchase flow used to place the order

0 No

ORDER_STATUS

Order status

0 No

PAYABLE_TO

Payee name (applicable to wire transfer)

0 No

PAYMENT_TYPE_INFO

English payment method name. Includes last four card digits (if applicable).

0 No

PO_STATUS

Status of the Purchase Order

0 Yes

PRODUCTS

0

0 No

PRODUCTS[index1].LICENSE_TYPE

Type of purchased subscription

0 No

PRODUCTS[index1].PNAME

Product name

0 No

PRODUCTS[index1].SHORT_DESCRIPTION

Short product description

0 No

PRODUCTS_DATA[index1].IdProduct

Product ID number

0 No

PRODUCTS_DATA[index1].PRODUCT_SHORT_DESCRIPTION

Short product description

0 No

PRODUCTS_NO

Number of products in cart

0 No

REFNO

Order reference number

9xxxxxx Yes

RETRYLINK

Payment retry link

0 No

RETRY_LINK

Payment retry link

0 No

SHOPPER_REFERENCE_NUMBER

Shopper  reference number

PO12345 No

UPLOADLINK

File upload link

0 No

UPLOAD_LINK

File upload link

0 No

USER_EMAIL

Email address used by shopper to login/signup to myAccount

example@customer-email.com No

USER_TOKEN

Shopper token for Avangate myAccount access

0 No

WEBSITE

Website where the shopper placed the order

http://www.software-company-website.com Yes

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

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