Skip to main content

Update a lead

Overview

Use the updateLead method to update an existing lead and change all current values with new data.

Request Parameters

Parameters Required Type/Description
Currency Required Order currency.
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 = "BG";
$Lead->ExternalReference = "REST_API_3CHECKOUT";
$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->updateLead($sessionID, $Lead);
} catch (SoapFault $e) {
    echo "updateLead: " . $e->getMessage();
    exit;
}

var_dump("updateLead", $leadData);

Response Example

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

 

Order field

Overview

Use this object to retrieve information about additional order/product fields.

Parameters

AdditionalField

Object

Label

String

 

Field text.

Code

String

 

Field identifier. Alpha-numeric chars, underscores and dashes.

Type

String

 

Field type:

  • LISTBOX
  • CHECKBOX
  • TEXT
  • HIDDEN

ApplyTo

Sting

 

  • ORDER
  • PRODUCT

Values

Array of values

 

Custom values you control.

ValidationRule

String

 

The validation rule restricting the type of information shoppers can enter in the additional field during the purchase process.

Translations

Array of objects

 

Details below.

 

Translation

Object

Label

String

 

Field text translated in the language of the Translations object.

Values

Object

 

Custom values you control translated in the language of the Translations object.

Language

String

 

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

 

Subscription

Overview

Use this section to handle the management of your subscriptions.

You can enable or disable your existing subscription, or choose to assign them to different customer entities.

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

 

Save prices

Overview

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

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.

Prices

Array of BasicPrice objects

 

Details below.

Quantities

QuantityInterval object

 

Details below.

PriceOptions

Array of PriceOptionsAssigned objects

 

Details below. Required for FLAT (without base price) pricing configurations. Is NULL for DYNAMIC (with base price) pricing configurations.

PricingConfig

Required (PricingConfigurationIdentifier object)

 

System-generated unique pricing configuration code.

type

Require (string)

• REGULAR

• RENEWAL

 

BasicPrice

Object

Currency

String

 

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

Amount

Decimal

 

Basic price.

 

QuantityInterval

Object

MinQuantity

Int

 

The minimum quantity of volume discounts. Default is 1.

MaxQuantity

Int

 

The maximum quantity of volume discounts. Default is 99999.

 

PriceOptionsAssigned

Object

Code

String

 

Price option identifier.

Options

String

 

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

 

PricingConfigurationIdentifier

Object

ProductCode

String

 

The unique product code that you control.

Country

String

 

The country assigned to the pricing configuration you’re editing.

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

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


?>

Invoice email

Overview

2Checkout automatically sends out the Invoice email to business customers providing full details on their purchase and finalized transaction.

As of August 31, 2016, you can use a redesigned template complete with fresh content (sample below). The new template has replaced the previous Invoice email, but any customization you have in place, either in terms of styling or content, continues to be available.

Availability

All 2Checkout accounts.

What is the purpose of this email?

2Checkout sends out this email to provide business customers with the invoice in PDF format.

Email content

The email includes the following:

  1. Card statement details.
  2. PDF with the invoice.
  3. Order details including reference, payment method, and total transaction value.

Sample

invoice email.png

Preview and test email

Navigate to the Email template manager section to:

  • Preview and test current templates for emails sent to your shoppers
  • Customize the header and the footer sections by creating custom templates you can assign to your emails

Access the Invoice email under the Order section.

Why don't I see the new template for this email?

The redesigned template for the Invoice email has automatically replaced default templates.

If your preview of Invoice email does not show the new template, you are most probably using a customized version that includes content and/or styling your company requested at a certain point in time.

You can compare the above sample to your current template and send us an email if you decide the new one suits your business needs better. We will work with you on the switch.

Customize checkout interfaces

Overview

Customize the out-of-the-box shopping cart templates offered by 2Checkout and create completely personalized designs of the interface your customers use during their purchase.

Saved template customizations have an immediate effect on the shopping cart design. 

When clearing the cache/cookies of the current session, even if an interface template is assigned, it is possible that the default cart will load.

Availability

All 2Checkout accounts.

How to add a cart/checkout template

  1. Log into your Merchant Control Panel.
  2. Go to SetupInterface templates.
  3. Scroll down to the Template Gallery and click Add to drafts on the template that you want to use.

Customize a cart/checkout template

  1. Identify the cart template you want to customize from those added to the Draft templates area.
  2. Click Edit
  3. After implementing your changes, you can preview your new customized cart template.

Template localization

By default, the English template is used for all languages if you did not define any localized templates. You can change this in two ways:

  1. Click the links available for each language and add/edit the template for that specific language.
  2. Check the checkboxes next to the languages you want to save a copy of the default template for. Subsequently, you can click on each language and edit the specific copy of the default template for that language as a standalone item.

Use a custom template on a different website

If you generate sales from a different website and you want to include that address in the emails the 2Checkout system sends to the shoppers, enable the Define the URL to be included in the notifications to customers as the sale source option and enter the address of the website in the dedicated field.

External JavaScript and CSS files

As an alternative to using 2Checkout’s templates, you can add your own JavaScript and CSS files to fully customize your customers’ experience. Keep in mind, though, that changing these files is an advanced operation best handled by experienced programmers.

To change the external JavaScript and CSS files, go to Media Center and upload your files. 2Checkout will automatically merge the files with the built-in interface files. Unless you upload your custom CSS and JS files to a secure 2Checkout server, 2Checkout cannot establish a secure connection (SSL) for your customers.

You can upload one or more CSS and JavaScript files according to your needs. When you upload multiple CSS or JS files, the last ones added will take precedence over previous ones. Custom CSS and JS files override the default ones. 2Checkout recommends that you use only a single .CSS file and a single .JS file in order to optimize page load time.

Once you upload the CSS and JS files, you can see them in the External JavaScript and CSS files section of the custom template Edit page. You can also implement full or partial advanced personalization by using custom templates.

   This feature is available only for specific accounts. Contact our support for availability.

HEAD Information

In addition to customizing the CSS and JS files, you can also edit the following:

  • Doctype declaration
  • Page title
  • META & CSS
  • HTML code
  • JavaScript code

Click Save after you’re done making inline changes

Scroll down to the bottom of the page and click the Save button. The Save with comments button is designed to allow you to add observations to a custom template.

BODY Information

The BODY Information section allows you to modify the HTML code for the body of the page as well as the JavaScript code.

Click Save after you’re done making changes

Overview

Introduction

Use the Avangate API to create, update and extract product catalog and pricing information for your account, place orders and manage subscriptions.

Workflow

  1. Use the following URLs:

https://api.avangate.com/soap/3.0/

Full service description is available at: https://api.avangate.com/soap/3.0/?wsdl

  1. Authenticate using the login method and create a session (connection).
  2. Throughout the lifetime of the session (max 10 minutes) you can invoke all Avangate API methods. To invoke methods you need to send a request to Avangate.
  3. The Avangate system provides responses for all requests.

Code samples

The code samples included in this document work with PHP version 5.6.  

 

UnionPay (to be deprecated)

   This payment method will be deprecated. It is only currently available on API. A new version is available here.

Overview

UnionPay is a payment method available worldwide, but very popular in APAC countries. It supports recurring payments.

Availability

UnionPay is very popular in China, Macau, Hong Kong, and Singapore.

Supported currencies

CNY, USD, EUR, GBP, AUD, CAD, CHF, JPY, PLN, SEK, RUB, BRL, ZAR.

Workflow

  1. Consumers place orders and choose to pay with UnionPay.
  2. Consumers are redirected to UnionPay and select their preferred authentication method
  3. UnionPay submits the authorization request to 2Checkout.
  4. The issuer provides feedback with the result of the transaction to UnionPay. When a transaction is successful the funds are transferred to UnionPay.
  5. UnionPay provides feedback with the result of the transaction to an intermediary payment processor.
  6. The payment process provides feedback with the result of the transaction to the 2Checkout.
  7. UnionPay provides reporting to the payment processor.
  8. The payment processor settles the funds directly into 2Checkout's local bank account, issues reports, and invoices.

F.A.Q.

  1. What email does 2Checkout send to shoppers to confirm orders?
    • 2Checkout send emails similar to those used for the Wire transfer process, treating UnionPay as an offline payment method (not instantaneous).
  2. Does 2Checkout send follow-up emails for unfinished payments with UnionPay?
    • 2Checkout sends the same type of emails as it does for other offline payment methods: Bank/Wire transfer, Boleto/Pix. The first email is sent 7 days after shoppers place their order.
  3. How long does 2Checkout try to collect funds for an unfinished payment?
    • 2Checkout performs daily, successive tries to collect funds for orders placed using UnionPay as a payment method for 30 days.

Neteller

Overview

Neteller is a digital wallet that allows you to perform online payments in multiple currencies. Neteller provides businesses and individuals with a fast, simple and secure way to pay online. The Neteller account is an online stored-value account that over 23 million account holders use to transfer funds to Neteller merchants.

Availability

Neteller is available on all 2Checkout accounts. Go to Payment methods to enable it on your account.

Neteller is available worldwide, except for Japan.

Benefits

  • Enhanced payment experience. Neteller Money Transfer is a fast, simple, and secure way to instantly send money online.
  • Increased market share. Neteller is an online payments provider with over 23 million account holders.
  • Safer payment environment. Neteller uses industry best practices to offer its holders a secure payment environment.

Currencies

2Checkout supports Neteller payments in the following currencies: 

  • EUR
  • USD
  • GBP

Purchase flow

  1. Shoppers select the Neteller payment method during checkout and continue to the next step.
  2. 2Checkout redirects them to Neteller.
  3. They log in to their Neteller account and confirm the payment.
  4. Once the payment is done, 2Checkout redirects shoppers to the shopping cart Thank you page.

Recurring billing

Neteller does not support recurring billing for subscription renewals.

IPN

IPN notifications for orders placed with Neteller have the value NETELLER associated with the PAYMETHOD_CODE parameter.

Refunds

Neteller supports automatic refunds.

Lead management

You can engage your customers through Lead Management campaigns, for turning unfinished payments into complete orders. More details here.

 

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