Skip to main content

Attach reseller information to an order

Overview

Use this method to add reseller details to a partner order.

Requirements

Parameters

Parameters Type/Description
sessionID Required (String)
  Session identifier, which is the output of the Login method. An exception is thrown if the values are incorrect.
refNo Required (String)
  The unique, system-generated identifier of a partner order.
resellerCode Required (String)
  Unique code identifying a specific reseller.

Response

Parameters Type/Description
result Boolean
  True or false

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_NUMBER';
$resellerCode = 'NEW_RESELLER_CODE';

try {
$AddedReseller= $client->setOrderReseller ($sessionID, $refNo, $resellerCode);
} catch (SoapFault $e) {
    Echo "orderReseller: " . $e->getMessage();
    exit;
}
var_dump ("orderReseller ", $AddedReseller);

Errors

Error Description

NOT_FOUND_PARTNER

No partner set before invoking the method.

EMPTY_ORDER_REFERENCE

Order reference not provided.

INVALID_PARTNER_RESELLER_CODE

Invalid partner reseller provided.

INVALID_SUBSCRIPTION_REFERENCE

No reseller defined for this order reference.

INVALID_PARTNER_RESELLER_CODE

No partner reseller found for the specified code.

Orders with installments

Overview

2Checkout 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 and AMEX cards
    • Non-recurring transactions
  2. The minimum installment threshold is 5 BRL. The maximum number of installments is 6.
  3. Mandatory information for payments also includes a shopper phone number and  Fiscal Code (CPF/CNPJ).

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

Yes. Contact 2Checkout 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

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

 

OrderInformation object structure

Member

Type/Description

RefNo

String

 

Order reference number.

OrderNo

String

 

The consecutive order number associated with orders available in the Order search.

ExternalRefNo

String

 

The order reference code (max. 100 chars) provided by the seller. Empty string if missing.

ShopperRefNo

String

 

External shopper identifier.

Status

String

 

The status of the order: AUTHRECEIVED, PENDING, TEST

(COMPLETE, CANCELED, REVERSED, REFUND statuses are only returned for the getOrder method).

ApproveStatus

String

 

The status of the order approval as set either automatically by the Avangate system or manually by a member of our anti-fraud department. This status can vary for new purchases or for orders requiring customers to make manual payments.

Possible values:

  • WAITING: The order has yet to be approved.
  • OK: The order has been approved.
  • INVALIDDATA: The data supplied by the shopper is invalid. The order was not approved.
  • FRAUD: The order is fraudulent.

Language

String

 

Language used in the cart during the purchase process.

OrderDate

String

 

The timestamp (in the API time zone defined in Control Panel) used when the order was placed. Format: Y-m-d H:i:s (2014-05-22 00:12:12).

FinishDate

String

 

The timestamp (in the API time zone defined in Control Panel) when the order reached the Complete status. NULL if the order is not finalized. Format: Y-m-d H:i:s (2014-05-22 00:12:12).

Source

String

 

The link source for the sales. The SRC parameter used to track every sale point generator.

AutoRenewalChecked

Boolean

 

True or false, depending on whether the subscription auto-renewal checkbox was checked during the purchase process.

HasShipping

Boolean

 

True or false, depending on whether the order required shipping.

BillingDetails

Object

 

Details below.

 

Address

String

 

 

Shopper billing address.

 

City

String

 

 

Shopper city from the billing address.

 

Country

String

 

 

Shopper country from the billing address.

 

Email

String

 

 

Shopper billing email address.

 

FirstName

String

 

 

Shopper billing name.

 

LastName

String

 

 

Shopper billing surname.

 

PostalCode

String

 

 

Postal code from the billing address.

 

State

String

 

 

Shopper billing state. E.g.: "Alabama".

 

Company

String

 

 

Company name. Can be NULL for end users. When present, FiscalCode must also be provided.

 

FiscalCode

String

 

 

Can be null for end users. For companies, it needs to be the VAT ID, which is validated by Avangate. An error will be thrown if the VAT ID is invalid/incorrect when calling setPaymentDetails. When present, Company name must also be provided.

DeliveryDetails

Object

 

Details below.

 

Address

String

 

 

Shopper delivery address.

 

City

String

 

 

Shopper delivery city.

 

Country

String

 

 

Shopper delivery country.

 

Email

String

 

 

Shopper email address.

 

FirstName

String

 

 

Shopper delivery first name.

 

LastName

String

 

 

Shopper delivery last name.

 

PostalCode

String

 

 

Shopper delivery postal code.

 

State

String

 

 

Shopper delivery state.

 

Company

String

 

 

Shopper delivery company. Can be NULL for end users.

PaymentInformation

Object

 

Details below.

 

Type

String

 

 

The payment method:

  • CC (credit/debit card)
  • TEST (for test orders)
  • PAYPAL
  • WIRE
  • OTHER (payment methods not listed above)

 

Currency

String

 

 

Payment currency ISO code – ISO 4217.

 

PaymentMethod

Object

 

 

Details below.

 

 

FirstDigits

String

 

 

 

First four credit card digits.

 

 

LastDigits

String

 

 

 

Last four credit card digits.

 

 

CardType

String

 

 

 

Card type:

  • VISA
  • VISAELECTRON
  • MASTERCARD
  • MAESTRO
  • AMEX

Origin

String

 

Order origin channel:

  • Web
  • API
  • Mobile 

Currency

String

 

Order currency.

TotalGeneral

Double

 

Total order value (the costs incurred by the shopper).

TotalWithoutTaxes

Double

 

Total order value without VAT or sales tax.

Taxes

Double

 

VAT or sales tax.

Shipping

Double

 

Shipping costs. NULL if not applicable.

AvangateCommission

Double

 

Avangate order commission.

AffiliateCommission

Double

 

Avangate affiliate commission. NULL if not applicable.

Discount

Double

 

Order discount value. NULL if not applicable.

Products

Array of objects

 

Details below.

 

Id

Int

 

 

Unique, system-generated product ID from the Avangate platform.

 

Code

String

 

 

The code you can attach to products when configuring, editing or importing them in the Avangate platform.

 

Name

String

 

 

Product name.

 

SKU

String

 

 

Product SKU.

 

ExtraInfo

String

 

 

Additional information text entered when generating buy links or via the INFO[productid]= parameter.

 

Quantity

Int

 

 

Purchase number of products.

 

PromotionName

String

 

 

Promotion name.

 

UnitPrice

Double

 

 

Price per product unit.

 

UnitTaxes

Double

 

 

Taxes per product unit.

 

UnitDiscount

Double

 

 

Discount per product unit.

 

UnitAffiliateCommision

Double

 

 

Affiliate commission per product unit.

 

Options

Array of objects

 

 

Array of product pricing options with the structure detailed below.

 

 

OptionText

String

 

 

 

The name of the pricing option selected during the purchase process.

 

 

OptionValue

String

 

 

 

Unique option value code.

 

 

OptionalValue

String

 

 

 

Unique option value code.

 

 

Operator

String

 

 

 

ADD or SUBTRACT, depending on whether the option adds or subtracts a specific amount to or from the product price.

 

 

Usage

String

 

 

 

 

 

 

Price

String

 

 

 

The amount added or subtracted by the pricing options.

 

 

GroupName

String

 

 

 

Product options group name.

 

AdditionalFields

Array of objects

 

 

Array of AdditionalFields information objects with the structure detailed below.

 

 

FieldText

String

 

 

 

Field text visible to shoppers in the cart.

 

 

FieldValue

String

 

 

 

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

 

Subscriptions

Array of objects

 

 

Array of subscriptions objects with the structure detailed below.

 

 

SubscriptionReference

String

 

 

 

Unique, system-generated subscription identifier.

 

 

PurchaseDate

String

 

 

 

Purchase date.

 

 

ExpirationDate

String

 

 

 

Renewal/expiration date, not considering grace period settings.

 

 

Lifetime

Boolean

 

 

 

Subscription duration.

 

 

Trial

Boolean

 

 

 

TRUE or FALSE depending on whether the subscription is a trial.

 

 

Disabled

Boolean

 

 

 

TRUE or FALSE depending on whether the subscription is disabled.

 

 

RecurringEnabled

Boolean

 

 

 

TRUE or FALSE depending on whether the subscription renewal system is enabled.

AdditionalFields

Array of objects

 

Array of AdditionalFields information objects with the structure detailed below.

 

FieldText

String

 

 

Field text visible to shoppers in the cart.

 

FieldValue

String

 

 

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

PartnerCode

String

 

Partner code defined in the Control Panel. NULL for eStore orders.

PartnerMargin

Double

 

Partner margin offered for the order. NULL for eStore orders.

PartnerMarginPercent

Double

 

Partner margin percentage from the net value of the products ordered, minus the value of any discounts. NULL for eStore orders.

ExtraMargin

Double

 

Extra margin offered. NULL for eStore orders.

ExtraMarginPercent

Double

 

Extra partner margin percentage from the net value of the products ordered, minus the partner margin and the value of any discounts. NULL for eStore orders.

ExtraDiscount

Double

 

Extra discount offered. NULL for eStore orders.

ExtraDiscountPercent

Double

 

Partner margin percentage from the net value of the products ordered, minus the value of any coupon discounts. NULL for eStore orders.

Use Test orders

Overview

Place a TEST order using catalog products defined in your Control Panel.

Requirements

Set the Payment details type to TEST in order to create an order in a test environment.

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.

Order

Required (Object)

 

Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details.

Response 

Parameters Type/Description

Order information

Object

  Object containing order information.

Request

<?php

require ('PATH_TO_AUTH');

$Order = new stdClass();
$Order->RefNo = NULL;
$Order->Currency = 'usd';
$Order->Country = 'US';
$Order->Language = 'en';
$Order->CustomerIP = '91.220.121.21';
$Order->ExternalReference = NULL;
$Order->Source = NULL;
$Order->Affiliate = new stdClass();
$Order->Affiliate->AffiliateCode = 'Partner123'
$Order->Affiliate->AffiliateSource = 'MobilePlatform'
$Order->CustomerReference = NULL;

$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1';
$Order->Items[0]->Quantity = 1;
$Order->Items[0]->PriceOptions = NULL;
$Order->Items[0]->SKU = NULL;
$Order->Items[0]->Price = NULL;
$Order->Items[0]->CrossSell = NULL;
$Order->Items[0]->Trial = false;
$Order->Items[0]->AdditionalFields = NULL;
$Order->Items[0]->Promotion = NULL;
$Order->Items[0]->SubscriptionStartDate = NULL; //If empty or null, subscriptions become active when purchase is made.

$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'John';
$Order->BillingDetails->LastName = 'Doe';
$Order->BillingDetails->CountryCode = 'us';
$Order->BillingDetails->State = 'California';
$Order->BillingDetails->City = 'LA';
$Order->BillingDetails->Address1 = 'Address example';
$Order->BillingDetails->Address2 = NULL;
$Order->BillingDetails->Zip = '90210';
$Order->BillingDetails->Email = 'cosmin.deftu@avangate.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;

$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'TEST';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->PaymentDetails->CustomerIP = '10.10.10.10';
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = true;
$Order->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";
$Order->PaymentDetails->PaymentMethod->CardType = 'visa';
$Order->PaymentDetails->PaymentMethod->ExpirationYear = '2019';
$Order->PaymentDetails->PaymentMethod->ExpirationMonth = '12';
$Order->PaymentDetails->PaymentMethod->HolderName = 'John';
$Order->PaymentDetails->PaymentMethod->CCID = '123';

$Order->Promotions = NULL;
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;

try {
    $prevrefOrder = $client->placeOrder($sessionID, $Order);
}
catch (SoapFault $e) {
    echo "prevrefOrder: " . $e->getMessage();
    exit;
}
var_dump("prevrefOrder", $prevrefOrder);


Extract invoices

Overview

Use the getInvoices method to extract shopper invoices from the 2Checkout system based on unique order references. The method returns the binary code for invoices in the PDF file format, Base64 encoded (Base64 is used to represent binary data in the ASCII string format).

getInvoices works for COMPLETE orders for which an invoice was already issued. For refunded orders, getInvoices provides two shopper invoices, one for the original order and the second for the refund, reflecting the repayment made.

In the case of cross-selling orders which contain products from different merchants, getInvoice enables you to re-send only the invoices for your own offerings.

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.

reference

Required (string)

 

Unique, system generated reference for orders.

Response

Parameters Type/Description

InvoicesData

Array of objects

 

 

Details below.

 

Sale

String

 

 

Base64 encoded PDF file containing an invoice for a Complete order.

 

Cancellation

String

 

 

Base64 encoded PDF file containing a cancellation invoice.

 

Refunds

Array of string

 

 

Base64 encoded PDF files containing invoices for Refunds.

Request

<?php

require ('PATH_TO_AUTH');

$reference = 'ORDER_REFERENCE';

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

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

 

Configure renewal notifications

Overview

Renewal e-mail notifications are used extensively as one of the main mechanisms to notify users of upcoming or pending subscription charges, thus ensuring higher recurring revenue rates. You can set your own custom notification schedule for sending out renewal notification emails, within the boundaries of a 90 day limit around the renewal date.

Benefits

  • Custom renewal notifications increase recurring payments conversion – conversion for subscription renewals can benefit from a boost with extended custom schedules +/-90 days renewal date.
  • Closer matching between subscription renewal notifications and grace period - notify shoppers in a more relevant manner of upcoming recurring charges, during their grace periods (closer matching of grace period expiration timelines).
  • Added flexibility – set your own notifications schedule in a more personalized manner, run more extensive A/B tests on notifications campaigns and decide to apply optimal schedules which bring highest results for your target customers.

Workflow

  1. Go to the Global renewal settings page.
  2. Click the Add notification button in the renewal emails section.
  3. Choose when to send renewal emails:
    • on subscription expiration date
    • before subscription expiration date
      • Enter the desired number of days before expiration when you want notifications to be sent. The value cannot be larger than 90 days.
    • after subscription expiration date
      • Enter the desired number of days before after when you want notifications to be sent. The value cannot be larger than 90 days.
  4. Choose the type of renewal you want the notifications to be sent for:
    • Manual renewal
    • Automatic renewal
  5. Click Add notification.
  6. Click Save.

Best practices for renewal notifications

You decide what is the best setup and how often you should engage your customers regarding their renewals. The success of each renewal notice schedule varies depending on: product type, sales process and customer location. While there isn’t sufficient data to offer a definitive optimal schedule, we do recommend:

  • Setting the products with grace period > 7 days, to enable shoppers to renew the subscriptions also after the expiration;
  • Defining different messages for the renewal notifications based on the moment when it is sent (for example - create a sense of urgency in the one sent very close to the expiration date)
  • Setting up an additional notification (45 or 60 days prior to expiration) for companies selling B2B (business-to-business) as B2B renewals can be a complex process, requiring approvals and budgeting decisions, so starting the renewal process earlier could improve your on-time renewal rates and customer satisfaction;
  • Adapting your notification schedule according to your customers’ preferences:
    • Track your renewal data: Which renewal notification has the highest success? Do most of your customers renew right after the first notification? If so, we’d say the timing is working. Do you have many customers renewing during their grace period? If so, you might want to start the renewal notifications earlier;
    • If customers have manual renewal enabled, try and win them over with discounts for early renewals or incentive them to opt for automatic renewal.

Here's two examples of setup that we recommend, depending on the renewal configuration of your product: 6 months and 12 months billing cycles.

No. Setup for subscriptions with 6 months billing cycles Setup for subscription with 12 months billing cycles
a) Two notifications before expiration date: 15 and 7 days Three notifications before expiration date: 30, 15 and 7 days
b) One notification on the expiration date One notification on the expiration date
c) One notification after expiration date: 5 days One notification after expiration date: 5 days

 

Retrieve a pricing configuration by name

Overview

Use the getPricingConfigurationByName method to extract information on a specific pricing configuration you set for a subscription plan/product.

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.

ProductCode

Required (string)

 

The unique product code you control and not the system-generated product ID.

PricingConfigurationName

Required (string)

 

The name of the pricing configuration.

SchemaType

Required (string)

 

  • FLAT (without Base Price)
  • DYNAMIC (with Base Price)

PriceType

Optional (string)

 

Possible values: NET or GROSS

Response

PricingConfiguration

Object

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

$ProductCode = '4643116';
$PricingConfigurationName = 'No base';
$SchemaType               = 'FLAT';
$PriceType                = 'NET';

try {
    $ProductPricingConfiguration = $client-> getPricingConfigurationByName ($sessionID, $ProductCode, $PricingConfigurationName, $SchemaType, $PriceType);
}

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

var_dump("Pricing Configuration", $ProductPricingConfiguration);


?>

Retrieve a pricing configuration by code

Overview

Use the getPricingConfigurationByCode method to extract information on a specific pricing configuration you set for a product.

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.

ProductCode

Required (string)

 

The editable code that you control at product-level, not the unique, system-generated product ID.

PricingConfigurationCode

Required (string)

 

The code of the pricing configuration.

Response

PricingConfiguration

Object

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;
}
 
$ProductCode = 'subscr1';
$PricingConfigurationCode = '0123456';
 
try {
    $ProductPricingConfiguration = $client-> getPricingConfigurationByCode ($sessionID, $ProductCode, $PricingConfigurationCode);
}

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

var_dump("Pricing Configuration", $ProductPricingConfiguration);
 
 
?>

Retrieve session content

Overview

Use the getContents method to get info on all the products added to cart by the shopper in the current session.

Products added in cart can be either defined in your catalog, or created with dynamic information.    

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.

Order

Required (Object)

 

Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details.

Response

Parameters Type/Description
SessionContents Object 

Request

<?php

require('PATH_TO_AUTH');

$Order = new stdClass();
$Order->RefNo = NULL;
$Order->Currency = 'usd';
$Order->Country = 'US';
$Order->Language = 'en';
$Order->CustomerIP = '91.220.121.21';
$Order->ExternalReference = NULL;
$Order->Source = NULL;
$Order->AffiliateId = NULL;
$Order->CustomerReference = NULL;

$Order->Items = array();
$Order->Items[0] = new stdClass();
$Order->Items[0]->Code = 'my_subscription_1'; // you can also send products with dynamic information
$Order->Items[0]->Quantity = 1;
$Order->Items[0]->PriceOptions = array();
$Order->Items[0]->PriceOptions[0] = new stdClass();
$Order->Items[0]->PriceOptions[0]->Options = array();
$Order->Items[0]->PriceOptions[0]->Options[0] = new stdClass();
//$Order->Items[0]->PriceOptions[0]->Options[0]->Value ="standarduniqueone";
$Order->Items[0]->SKU = NULL;
$Order->Items[0]->Price = NULL;
$Order->Items[0]->CrossSell = NULL;
$Order->Items[0]->Trial = false;
$Order->Items[0]->AdditionalFields = NULL;
$Order->Items[0]->Promotion = NULL;
$Order->BillingDetails = new stdClass();
$Order->BillingDetails->FirstName = 'FirstName';
$Order->BillingDetails->LastName = 'LastName';
$Order->BillingDetails->CountryCode = 'us';
$Order->BillingDetails->State = 'California';
$Order->BillingDetails->City = 'LA';
$Order->BillingDetails->Address1 = 'Address example';
$Order->BillingDetails->Address2 = NULL;
$Order->BillingDetails->Zip = '90210';
$Order->BillingDetails->Email = 'customer@email.com';
$Order->BillingDetails->Phone = NULL;
$Order->BillingDetails->Company = NULL;
$Order->DeliveryDetails = NULL;
$Order->PaymentDetails = new stdClass ();
$Order->PaymentDetails->Type = 'CC';
$Order->PaymentDetails->Currency = 'usd';
$Order->PaymentDetails->PaymentMethod = new stdClass ();
$Order->PaymentDetails->CustomerIP = '10.10.10.10';
$Order->PaymentDetails->PaymentMethod->RecurringEnabled = true;
$Order->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";
$Order->PaymentDetails->PaymentMethod->CardType = 'visa';
$Order->PaymentDetails->PaymentMethod->ExpirationYear = '2019';
$Order->PaymentDetails->PaymentMethod->ExpirationMonth = '12';
$Order->PaymentDetails->PaymentMethod->HolderName = 'John';
$Order->PaymentDetails->PaymentMethod->CCID = '123';

$Order->Promotions = NULL;
$Order->AdditionalFields = NULL;
$Order->LocalTime = NULL;
$Order->GiftDetails = NULL;

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

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

 

 

Test adding a product coupon to the InLine Checkout

Overview

Use theTwoCoInlineCart.cart.addCoupon('COUPON')method to apply a single coupon.

Use case - Add Product Coupon

  1. Add an HTML link or button to your page like the one below.
  2. Create a JavaScript click handler to execute the Inline Client desired methods.
  3. Use theTwoCoInlineCart.products.add({code, quantity, options})method to prepare your catalog product.
  4. To apply a coupon to your products in the shopping cart, use theTwoCoInlineCart.cart.addCoupon('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.addCoupon('CUPON');
  TwoCoInlineCart.cart.checkout();
});

Demo

After setting the test mode to add a coupon to the InLine checkout using the above method, your cart should look like this:

 

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