Skip to main content

Retrieve order reseller information

Overview

Use this method to extract the reseller information defined for a specific order.

Requirements

Parameters

Parameter Type/Description
sessionID Required (string)
  Session identifier, which is the output of the Login method. An exception will be thrown if the values are incorrect.
refNo Required (string)
  The unique, system-generated identifier of a partner order.

Response

Parameter Type/Description
Reseller Object

Request

<?php

require('PATH_TO_AUTH'); // Authentication example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/02Authentication
require('PATH_TO_setPartner'); // setPartner example: https://knowledgecenter.avangate.com/Integration/Channel_Manager_API/SOAP/06Reference/Partner/00Set_partner

$refNo = 'YOUR_ORDER_REFERENCE';

try {
    $reseller= $client->getOrderReseller ($sessionID, $refNo);
} catch (SoapFault $e) {
    Echo "Reseller: " . $e->getMessage();
    exit;
}
var_dump ("Reseller ", $reseller);

Errors 

Error  Description

NOT_FOUND_PARTNER

Set a partner before invoking the method.

EMPTY_ORDER_REFERENCE

Order reference not provided.

INVALID_REFERENCE

Invalid order reference.

INVALID_SUBSCRIPTION_REFERENCE

No reseller defined for this order reference.

Update subscription payment information

Overview

Use the updateSubscriptionPaymentInformation method to update the credit card information related to the payment to be made for a subscription. To be able to do this, you need to generate a payment token using the credit card information via the 2Pay.js library, and then use this token in the request of the method as indicated below.

Request Parameters

Parameter Name Type Required/Optional Description

sessionID

String

Required

The 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.

subscriptionReference

String

Required

The reference of the subscription for which you want to retrieve the payment information.

paymentInformation

Object

Required

The payment information object, details below:

PaymentDetails

Object

Required

The payment details object, details below:

Type

String

Required

The payment details type. Restricted to EES_TOKEN_PAYMENT for now.

PaymentMethod

Object

Required

The payment method object, details below:

EesToken

String

Required

The 2Pay token obtained by integrating the 2Pay.js library.

Vendor3DSReturnURL String Required URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized.
Vendor3DSCancelURL String Required URL address to which customers are redirected after the 3DS details get validated by the bank and the order is successfully authorized.

Request Example

<?php

declare(strict_types=1);

class Configuration
{
    public const MERCHANT_CODE = '';
    public const MERCHANT_KEY = '';
    public const URL = 'http://api.2checkout.com/soap/6.0';
    public const ACTION = 'updateSubscriptionPaymentInformation';
    public const ADDITIONAL_OPTIONS = null;
    public const SUBSCRIPTION_REF = 'YC9XXMGOYO';
    //array or JSON
    public const PAYLOAD = <<<JSON
{
  "PaymentDetails": {
    "Type": "EES_TOKEN_PAYMENT",
    "PaymentMethod": {
      "EesToken": "f6347256-bbbb-45a8-be61-e21fe1725f47",
      "Vendor3DSReturnURL": "www.3dsReturnURL.com",
      "Vendor3DSCancelURL": "www.3dsCancelURL.com"
    }
  }
}
JSON;
}

class Client
{
    public function call(
        string $url = Configuration::URL,
        $payload = Configuration::PAYLOAD,
        string $action = Configuration::ACTION
    ): ?object
    {
        if (is_array($payload)) {
            $payload = json_encode($payload);
        }
        if (!empty($payload)) {
            // SoapClient works with objects(StdClass)
            $payload = json_decode($payload);
        }

        $soapClient = $this->getClient($url);
        $sessionId = $this->getSession($soapClient);
        $args = array_filter([$sessionId, Configuration::SUBSCRIPTION_REF, $payload]);

        return $soapClient->$action(...$args);
    }

    public function getClient(string $url): SoapClient
    {
        return new SoapClient(
            $url . '?wsdl',
            [
                'location' => $url,
                'cache_wsdl' => WSDL_CACHE_NONE,
            ]
        );
    }

    public function getSession(SoapClient $client)
    {
        $date = gmdate('Y-m-d H:i:s');
        $merchantCode = Configuration::MERCHANT_CODE;
        $key = Configuration::MERCHANT_KEY;
        $string = strlen($merchantCode) . $merchantCode . strlen($date) . $date;
        $hash = hash_hmac('md5', $string, $key);
       // $client->__setCookie('XDEBUG_SESSION', 'PHPSTORM');
        return $client->login($merchantCode, $date, $hash);
    }
}

try {
    $client = new Client();
    var_dump($client->call());
} catch (Exception $ex) {
    var_dump($ex);
}

Response

The method responds with Boolean True when the payment information update was successfully performed.
Otherwise, in case of validation or access rights failures, it returns the usual error response with specific messages indicating the cause of the failure.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ xmlns:ns1="urn:order" xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/ SOAP-ENV:encodingStyle=http://schemas.xmlsoap.org/soap/encoding/>
    <SOAP-ENV:Body>
        <ns1:updateSubscriptionPaymentInformationResponse>
            <updateSubscriptionPaymentInformationReturn xsi:type="ns1:PaymentDetailsCard">
                <CardType xsi:type="xsd:string">visa</CardType>
                <FirstDigits xsi:type="xsd:string">4012</FirstDigits>
                <LastDigits xsi:type="xsd:string">9936</LastDigits>
                <Authorize3DSUrl xsi:type="xsd:string">http://...</Authorize3DSUrl>
            </updateSubscriptionPaymentInformationReturn>
        </ns1:updateSubscriptionPaymentInformationResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

Retrieve specific list of subscriptions

Overview

Extract information on a specific list of subscriptions. Use the getSubscriptions method to retrieve details about a specific list of your account’s subscriptions.

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

Parameters

Parameters Type/Description

sessionID

Required (string)

 

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

subscriptionReference

Required (Array of strings)

 

Unique, system-generated subscription identifier.

aggregate

Required (boolean)

 

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

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

Response

Parameters Type/Description

Subscription

Array of objects

Request

<?php

require ('PATH_TO_AUTH');

$SubscriptionReferences = array('REFERENCE1', 'REFERENCE2', 'REFERENCE3');

try {
    $ListofSubscriptions = $client->getSubscriptions($sessionID, $SubscriptionReferences);
}
catch (SoapFault $e) {
    echo "ListofSubscriptions: " . $e->getMessage();
    exit;
}
var_dump("ListofSubscriptions", $ListofSubscriptions);

Data Layer Integration (Workato)

Overview

The all-in-one 2Checkout eCommerce platform offers three types of integration for the CPQ app:

  • API
  • Webhooks
  • Workato

While the integration through API and webhooks can cost the merchant time and money to implement, as these options are one-off and custom to each business case, Workato offers a configurable (not coded) set of rules to map data from one system to another​.

Availability

The Workato integration is available to all merchants, all accounts (2Sell, 2Subscribe, 2Monetize), for both B2B and B2C.

Pricing

Data Layer Integration is sold as a stand-alone capability for 2Checkout to provide data access to merchants' own data and share that data with the merchant IT landscape.​ Depending on volumes generated by the integration, special discounts and promotions will be available.​

Workato - Data Integration Layer Provider

Workato is a 3rd-party integration platform that allows 2Checkout to develop a connector to them and use it to connect to 400+ applications​. 2Checkout pushes order, subscription, and product information through the Workato connector, which will then be sent to any of the 400+ applications.

To find out more details about Workato integration and apps, check out this page.

workato integration_1.PNG

Key Benefits

  • Easy customized integration
  • Remove blockers when it comes to integration requirements and external reporting needs
  • Avoid complexities of API and webhooks integration
  • Cost-effective as merchants don't need to perform any development on their side

Key Features

  • Sync Product Catalog​
  • Quote/Proposal Sync​
  • eCommerce orders generating opportunities in Salesforce
  • Orders generating status updates in Salesforce
  • Subscription changes generating updates in Salesforce

Get started with Workato

For information on how to start benefiting from the Workato integration, contact our Sales team.

The Workato integration process takes merchants through the following steps:

  1. Initial kick-off with the Sales team
  2. Discovery session to establish implementation needs
  3. Contract and Statement of Work signature
  4. Delivery and UAT
  5. Professional Services deliver the recipe requirements and structure ​
  6. The integration team implements recipes ​
  7. Merchant can start testing the integration together with Professional Services

*The service is offered by 2Checkout, not by Workato so no 3rd party contract is needed.​

*Service is invoiced as Professional Service fee (one time) + license fee/year (quarterly/annually invoice)

FAQ

1. Why would I use this service and not build my own integration?​

Integrations cost time and money invested in development work. Once the integration is done, any updates require new development work to change what you already have. With the Data Integration Layer, the work becomes a simple configuration (click-click) work.​

Ex: Integrating 2Checkout with Salesforce on your own means having 2Checkout and Salesforce consultancy and development. Using the Data Layer Integration service will require just Salesforce consultancy on top of our professional services fee (at a lower cost than development)​

2. Why would I not go directly to Workato?​

You can, but in order to leverage 2Checkout data, you will have to be intimate with our data structures in order to map them to other solutions.​ Working with 2Checkout means that we only need to worry about the target solution data architecture.​

Additionally, you will not need to approve new budgets or validate new service providers.​

3. If I get this service from you, do I need anything else?​

2Checkout Data Layer Integration will cover data mapping on the 2Checkout side and the implementation process. We still require you to provide us the data mapping on the other solutions that need to be integrated.​

Ex: Integrating SAP Hana with 2Checkout will require SAP Hana experts on the merchant side but will not require development on the merchant side.​

Test adding product coupons to the InLine Checkout

Overview

Use theTwoCoInlineCart.card.addCoupons(['COUPON'])method to apply multiple coupons.

Use case - Add Coupons

  1. Add an HTML link or button in your page like the one below.
  2. Create a JavaScript click handler to execute the Inline Client desired methods.
  3. Use the TwoCoInlineCart.products.add({code, quantity, options})method to prepare your catalog product.
  4. To apply several coupons to your cart products, use theTwoCoInlineCart.card.addCoupons(['COUPON'])method.
  5. To show the cart on your page call theTwoCoInlineCart.cart.checkout()method.

Sample request

HTML

<a href="#" class="btn btn-success" id="buy-button">Buy now!</a>

JavaScript

window.document.getElementById('buy-button').addEventListener('click', function() {
  TwoCoInlineCart.products.add({
    code: "74B8E17CC0"
  });
  TwoCoInlineCart.cart.addCoupons(['CUPON']);
  TwoCoInlineCart.cart.checkout();
});

Demo

After setting the test mode to add coupons to the InLine Checkout using the above method, your cart should look like this:

 

Single Sign-On in cart

Overview

Use the getSingleSignOnInCart method.  Avangate attaches a unique token to links, designed to identify the returning shoppers and support the automatic extraction of payment data and billing information from the Avangate system. For example, you can generate single sign on in cart links for existing customers logged into your website based on their external or Avangate customer IDs.

How does this work?

When accessing the shopping cart using tokenized payment links:

  • Avangate prefills automatically customer billing and delivery details associated with their Avangate customer accounts (linked based on their unique customer IDs).
  • Avangate presents shoppers with an optimized payment area featuring the credit / debit cards used to make previous purchases / transactions in the Avangate system. Customers have the option of selecting one of the payment methods depending on available card-on-file data.

Parameters

Parameters

Type/Description

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.

IdCustomer

Required (string)

 

Unique customer identifiers. Can be either the ExternalCustomerReference you control or the system-generated AvangateCustomerReference.

CustomerType

Required (string)

 

Possible values:

  • ExternalCustomerReference
  • AvangateCustomerReference

Url

Required (string)

 

The shopping cart URL. Avangate redirects shoppers to this URL.

 

Possible values:

 

Any buy link you generate from the cPanel or using the API. Note: For the time being, payment tokenization does not support Express Payments Checkout or the Avangate mobile shopping cart.

ValidityTime

Optional (int)

 

The time, in seconds, before the single sign-on URL expires. By default, the URL expires after 10 seconds. (optional)

ValidationIp

Optional (string)

 

The IP address of the shopper, necessary for security purposes. Can be an empty string or a valid IP, or null.

Response

Single sign-on URL

String

 

The generated string is the tokenized time-limited single sign-on URL pointing to Avangate shopping cart.

 

Note: Each SSO link cleans any previous cart sessions. Shoppers using multiple SSO links would purchase only a single product at a time.

 

If shoppers add multiple products to cart via SSO buy links and then use a non-SSO link, they’ll purchase all items using the same order.

When you use single sign on in cart for customers without card on files in the Avangate system, the generated tokenized link prefills the billing information but the purchase process requires that shoppers provide payment information, such as a credit or debit card.

Example: https://store.YourCustomDomain.com/order/checkout.php?PRODS=1112233&logintoken=8b74ac97f8277654563c44da6915b054ba0d21be

 

Important! You can use the value of the logintoken to retrieve customer information by SSO token.

 

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 = "YOUR_MERCHANT_CODE";// your account's merchant code available in the 'System settings' area of the cPanel: https://secure.avangate.com/cpanel/account_settings.php
$key = "YOUR_SECRET_KEY";// your account's secret key available in the 'System settings' area of the cPanel: https://secure.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;
}
$IdCustomer = '352365983';
$CustomerType = 'AvangateCustomerReference';
$Url = 'https://store.avancart.com/order/checkout.php?PRODS=4639321&QTY=1&CART=1&CARD=2';
$ValidityTime = 50;
$ValidationIp = null;
try {
    $ssoLINK = $client->getSingleSignOnInCart($sessionID, $IdCustomer, $CustomerType, $Url, $ValidityTime, $ValidationIp);
}
catch (SoapFault $e) {
    echo "ssoLINK: " . $e->getMessage();
    exit;
}
var_dump("ssoLINK", $ssoLINK);

Disable recurring billing

Overview

Use the disableRecurringBilling method to disable recurring billing for a subscription. When you disable recurring billing, the subscription status doesn’t change. Users continue to use subscriptions with recurring billing disabled until they expire, and 2Checkout provides them with the option to renew their subscription through manual payments.

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.

subscriptionReference

Required (string)

 

Unique, system-generated subscription identifier.

ChurnReasons Array
 

Possible values for this field are:
CHURN_REASON_NOT_SATISFIED_PRODUCT

CHURN_REASON_ENABLED_BY_MISTAKE

CHURN_REASON_PREFER_MANUAL

CHURN_REASON_ALREADY_RENEWED

CHURN_REASON_DONT_NEED

CHURN_REASON_WANT_PAUSE

CHURN_REASON_COVID

CHURN_REASON_HIGH_PRICE

CHURN_REASON_NOT_SATISFIED_SUPPORT

CHURN_REASON_EXTRAORDINARY

CHURN_REASON_OTHER

ChurnReasonOther String
  This field should have a value only if the ChurnReasons has the CHURN_REASON_EXTRAORDINARY or CHURN_REASON_OTHER values

Response

Parameters Type/Description

Boolean

true or false depending on whether the changes were successful or not.

Request

<?php

require ('PATH_TO_AUTH');

$subscriptionReference = 'YOUR_SUBSCRIPTION_REFERENCE';

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

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

Orders with installments

Overview

Avangate supports local Brazilian Visa, MasterCard and AMEX credit / debit cards limited to national purchases in the local currency BRL (Brazilian Real)

Requirements

  1. Installments are available only for:
    • Brazilian customers
    • Local Visa, MasterCard or AMEX cards
    • Non-recurring transactions
  2. Minimum installment threshold is 5 BRL. Maximum number of installments is 6.
  3. Mandatory information for payments also includes shopper phone number and  Fiscal Code (CPF/CNPJ).

Do local BR cards with / without installments require an addendum to my contract?

Yes. Please contact Avangate for activation.

How does it work?

  1. Create the Order object.
  2. Validate the number of installments available based on total order value. 
  3. Place the order specifying the number of installments. 

Funds collection for installment payments

Avangate pays you in full, regardless of the number of installments (this is covered directly by the banks). 

 

 

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

Parameters Type/Description

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 and Required parameters of the price options group.

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

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

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

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

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

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

$updatedPriceOptions = $existentPriceOptions[0];

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

$updatedPriceOptions = $existentPriceOptions[0];
echo "$updatedPriceOptions->Name";

$jsonRpcRequest = array (
'jsonrpc' => '2.0',
'id' => $i++,
'method' => 'updatePriceOptionGroup',
'params' => array($sessionID, $updatedPriceOptions)
);
var_dump (callRPC((Object)$jsonRpcRequest, $host, true));

?>

Update a customer

Overview

Use the updateCustomerInformation method to update the details of a customer entity from the Avangate system.

Parameters

Parameters Type/Description

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.

Customer

Object (required)

Use this object to update customer information.

UpdateEndUserSubscriptions

Optional (boolean)

You can push the changes made on the customer info to the end-user details for all subscriptions belonging to this customer. Set true to have the changes reflected on the end-user details for all subscriptions. If null or false, the changes are made only at the customer level. Default value is false.

Response

Parameters Type/Description

Boolean

true or false depending on whether or not the operation succeeded.

Request

<?php

require ('PATH_TO_AUTH');

$customerReference = CUSTOMER_REFERENCE;
$externalCustomerReference = 'EXTERNAL_CUSTOMER_REFERENCE'; //Optional, but if you include it it needs to belong to the same customer as the internal Avangate customer reference

$jsonRpcRequest = array (
'method' => 'getCustomerInformation',
'params' => array($sessionID, $customerReference, $externalCustomerReference),
'id' => $i++,
'jsonrpc' => '2.0');

$existingCustomer = callRPC((Object)$jsonRpcRequest, $host, true);
$existingCustomer->Email = 'newemailaddress@email.com';
$UpdateEndUserSubscriptions = false; // Optional, but if true the changes made on customer info are pushed to all subscriptions from this customer.

$jsonRpcRequest = array (
'method' => 'updateCustomerInformation',
'params' => array($sessionID, $existingCustomer, $UpdateEndUserSubscriptions),
'id' => $i++,
'jsonrpc' => '2.0');

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

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