Skip to main content

Error handling for issueRefund

Overview

Learn how to tackle the common errors that may arise when issuing refunds via 2Checkout API.

Common error codes 

Error code Description

ORDER_REF missing or format incorrect 

The order reference number was not provided, or has an invalid format. Check the order reference provided.

ORDER_AMOUNT missing or format incorrect 

Refundable amount was not provided, or it has an invalid format. Check the order amount provided.

Order already canceled 

Order is already canceled.

Invalid ORDER_REF 

The order reference number is not correct. Check the order reference provided.

Invalid ORDER_AMOUNT 

The refundable amount is invalid. Check the order amount provided.

PRODUCTS_CODES missing or format incorrect 

Products codes were not provided, or have an invalid format. Check the product codes provided.

PRODUCTS_QTY missing or format incorrect 

Product quantity was not provided, or has an invalid format. Check the product quantity provided.

Invalid PRODUCTS_QTY 

The product quantity is not correct. Check the product quantity provided.

You have already placed a Total refund for this order. 

Order has been already refunded in total. Check again the current refund status of the order.

You already have a pending refund request. 

The order already has a pending refund request. Before issuing a new refund, the current request needs to be settled.

The maximum refundable amount for this order has been exceeded. 

The refundable amount cannot exceed the order amount. Check the refundable amount.

You cannot place a refund request due to the order's current status. 

The order needs to be in FINISHED status, before being refunded. Check the current order status.

You cannot place a refund request due to the order's payment details. 

The current customer payment details do not allow refund requests. Contact 2Checkout for additional details.

The allowed period to request a new refund for this order has expired. 

You are not able to issue a refund for this order at this moment. Contact 2Checkout for additional details.

Multiple refunds are not supported by this order's payment type. 

The payment method on this order does not allow multiple refunds.

Refunding not supported for this Cross Vendor Sale order. 

The order type does not allow refunds. Contact 2Checkout for additional details.

Order total is negative. 

The order total is negative. Send only positive order amounts.

You cannot place a refund request due to the order's approval status. 

The order cannot be refunded due to its approval status. Contact 2Checkout for additional details.

Multiple refunds are not supported by this order's terminal. 

The order cannot be refunded to due to its payment method terminal. Contact 2Checkout for additional details.

Partial reverse is not supported. 

Partial refunds are not supported on this payment method. Contact 2Checkout for additional details.

Invalid product type. Refunds are available only for the following product types: REGULAR / BUNDLE / MEDIA / DOWNLOAD_INSURANCE, but not for DISCOUNT / SHIPPING. 

The product item cannot be refunded. Contact 2Checkout for additional details.

You cannot request a refund because a chargeback dispute was open for the order. 

You cannot issue a refund for orders that have a chargeback dispute open. 

Invalid REFUND_REASON

The refund reasons provided is not valid. In case you have custom refund reasons created, send one of their names as values. 

Partial refund

Overview

Use the issueRefund method to issue a partial refund for an order processed by 2Checkout.

Requirements 

The payment for the refundable order needs to be collected.

You cannot issue a refund for an amount higher than the total order amount.

We recommend you create a new order with placeOrder to have one that can be refunded.

The order’s status must be ’COMPLETE’ and it should have a TotalPrice > 0.

The OrderDate cannot be older than a year from the current date.

To obtain the LineItemReference, use the getOrder method: https://knowledgecenter.2checkout.com/API-Integration/JSON-RPC_API_6.0/Reference/14Retrieve-an-order

Request

<?php

/**
 * @throws JsonException
 */
function callRPC($Request, $host) {
    $curl = curl_init($host);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($curl, CURLOPT_VERBOSE, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json'));
    $RequestString = json_encode($Request, JSON_THROW_ON_ERROR);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);

    $ResponseString = curl_exec($curl);

    if (!empty($ResponseString)) {
        echo($ResponseString);
        $Response = json_decode($ResponseString, false, 512, JSON_THROW_ON_ERROR);
        if (isset($Response->result)) {
            return $Response->result;
        }
        if (!is_null($Response->error)) {
            echo("Method: {$Request->method}" . PHP_EOL);
            echo("Error: {$Request->error}" . PHP_EOL);
        }
    } else {
        return null;
    }
    return null;
}

$host = 'https://api.avangate.com/rpc/6.0/';

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

$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$algo = "sha256";
$hash = hash_hmac($algo, $string, $key);

$i = 1;

$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash, $algo);
$jsonRpcRequest->id = $i++;

try {
    $sessionID = callRPC($jsonRpcRequest, $host);
    echo("Auth token: {$sessionID}" . PHP_EOL);
} catch (JsonException $e) {
    echo("Error: {$e->getMessage()}" . PHP_EOL);
}

$orderReference = "73152871";

$items = [];
$item = new stdClass();
$item->Quantity = 1;
$item->LineItemReference = "a439c84a4b1e8ad1d7bf38407f5ea7473433ce7b";
$item->Amount = 29.99;

$items[] = $item;

$comment = "This is a comment";
$reason = "Fraud";

$jsonRpcRequest          = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method  = 'issueRefund';
$jsonRpcRequest->params  = array($sessionID, $orderReference, null, $items, $comment, $reason);
$jsonRpcRequest->id      = $i++;

$partialRefund = callRPC($jsonRpcRequest, $host);

var_dump ($partialRefund); 

Response

Response Type/Description
Boolean

TRUE is the refund was processed successfully

FALSE otherwise

Unassign additional fields

Overview

Use the unassignAdditionalField method to update additional fields 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.

FieldCode

Required (string)

 

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

ProductCode

Required (string)

 

The unique product code that you control not the system-generated product identifier.

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$ProductCode = 'YOUR_PRODUCT_CODE';
$FieldCode = 'YOUR_FIELD_CODE';

try {
    $UnassignedAdditionalField = $client->unassignAdditionalField($sessionID, $FieldCode, $ProductCode);
}

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

var_dump("UnassignedAdditionalField", $UnassignedAdditionalField);

Use test orders

Overview

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

Set the Payment details type to TEST in order to create an order with a test credit card or a 2Pay.js token generated with a test credit card in a test environment.

For the full list of test credit card details, check this article.

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

Order information

Object

Test order request with credit cards

<?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]->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@2checkout.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->PaymentDetails->PaymentMethod->Vendor3DSReturnURL = "http://yoursuccessurl.com"; // used for 3DS ordering
$Order->PaymentDetails->PaymentMethod->Vendor3DSCancelURL = "http://yourcancelurl.com"; // used for 3DS ordering

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

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

var_dump("newOrder", $newOrder);

 Test order request with 2Pay.js tokens

<?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]->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@2checkout.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->PaymentMethod->EesToken = “90007562-681b-4df5-9797-53faf8abbc92”;
$Order->PaymentDetails->PaymentMethod->Vendor3DSReturnURL = "https://example.com";
$Order->PaymentDetails->PaymentMethod->Vendor3DSCancelURL = "https://example.com";

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

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

var_dump("newOrder", $newOrder);

External orders tracking in the 2Checkout affiliate network

Overview

Take advantage of External Order Tracking to keep track of sales generated by members of the 2Checkout Affiliate Network for services/products that you sell using multiple payment processors and different affiliate networks or a third-party ecommerce platform, in addition to those sold through the 2Checkout system, if any.

External Order Tracking ensures that 2Checkout rewards Affiliates for referred orders sold outside the 2Checkout platform. The 2Checkout Affiliate Network currently features over 40,000 affiliates working on a pay-per-sale commission-based model. According to the data in our system, companies selling mainstream software can experience an average jump in sales of 10%-15% simply by leveraging the 2Checkout Affiliate Network.

This technology is based on two types of pixel tracking implementations. While both implementations have the same behavior, their inner workings are quite different.

Image pixel

An invisible image pixel to track shopper actions once they buy a product/subscription after being redirected via a link from an 2Checkout Affiliate. 2Checkout uses the recorded data to provide you with reports and to pay the affiliates who generate sales of your products/services.

iFrame pixel

The most common way of tracking conversions. Tests have shown that iFrame pixels are much more accurate than image pixels. Additionally, iFrame pixels offer more room for further developments, if necessary.

External Order Tracking Requirements

Image pixel requirements

Should you choose to use the image pixel technology, you must meet the following requirements:

  • Enable the 2Checkout Affiliate Network for your account.
  • Use a custom domain with 2Checkout(e.g. store.merchant.com).
  • Use a custom domain with third-party ecommerce providers(e.g. store.merchant.com).
  • Configure products sold through a third-party platform within the 2Checkout platform.
  • Assign the products to commissions lists associated with 2Checkout affiliates. Make sure to specify a commission you're willing to pay for affiliate referrals.
  • Contact your 2Checkout account manager for details on legal / financial requirements.

iFrame pixel requirements

Should you choose to use the iFrame pixel technology, you must meet the following requirements:

  • Enable the 2Checkout Affiliate Network for your account.
  • Configure products sold through a third-party platform within the 2Checkout platform.
  • Assign the products to commissions lists associated with 2Checkout affiliates. Make sure to specify a commission you're willing to pay for affiliate referrals.
  • Contact your 2Checkout account manager for details on legal / financial requirements.

Important: iFrame pixel tracking does not require you to create a custom domain with 2Checkout.

Integrating Image Pixel Tracking

Provided that you meet all the requirements mentioned above you can now move to the integration stage.

  1. Go to Affiliate Network -> Build your network and select the External Orders Tracking tab.
  2. Copy the JavaScript code available on this page into the source code of the Thank You pages that you use outside 2Checkout
  3. Replace the UPPER-CASE values with the corresponding order variables in the external ordering platform. Depending on whether or not you're using a custom domain, you will need to configure the tracking.type parameter accordingly
    • tracking.type='image' or tracking.type='iframe' if you are using a custom domain
    • tracking.type='iframe' if you are not using a custom domain

Integrate the modified JavaScript code into the source code of the Thank you page displayed to shoppers at the end of a successful sale. This area is designed to offer a range of details, including an external order reference, info on the products sold, their value, etc.

External Order Tracking relies on cookies to track the activity of the shopper during the purchase process. Essentially, when users click links from 2Checkout affiliates, 2Checkout records the clicks and places tracking cookies on their machines. 2Checkout affiliate links can point to a specific product or multiple offerings from you, or redirect to your website.

External Order Tracking comes into play when users complete an order with the third-party payment provider you're using, reaching the confirmation screen at the end of the ordering process. This page features the tracking script (an invisible 1x1 pixel image or iFrame) set up to record the details of the sale.

You can see completed sales tracked with Pixel Tracking in the External orders area of your Control Panel, under Affiliate Network.

Confirm external orders to credit 2Checkout Affiliates

For affiliates to be credited and paid for the referred purchases, even if the commission is warranted, you need to first approve external orders manually. Make sure to check the validity of external orders with purchases made through the third-party platform you're using.

The information recorded contains the external reference of products, the date when the order was placed, the affiliate whose link was used, the names of theexternal products and the number of units purchased, as well as the price paid by the shopper and the associated currency.

Before confirming external orders, match the products tracked via Pixel Tracking with those you defined in the 2Checkout platform. Once an external product is matched with one defined in the 2Checkout platform, subsequent matches involving the same two items will be done automatically by the system. Note: You cannot match multiple products from the same external order with a single product in the 2Checkout system.

The commission that 2Checkout Affiliates receive is calculated based on the price recorded when the External Order is placed successfully, and is not impacted by the pricing schemes you configure in the 2Checkout platform.

External orders in the 2Checkout platform can show the following status messages:

  • Pending
  • Processing
  • Rejected
  • Confirmed

You can edit and confirm both Pending and Rejected orders. When you confirm an external order, a new order is also generated in the 2Checkout platform, which will be available in the Order search area, under Orders & customers.

You can approve external orders either one by one, or selecting multiple items at once. Note that once you confirm an external order, its details are locked and can no longer be modified. For unconfirmed external orders, any changes will be reflected real-time across all items in this area, if the modifications impact additional orders than the one being edited.

Rejected orders will be ignored by 2Checkout and affiliates will not receive any commission.

When do 2Checkout affiliates receive a commission?

2Checkout's Affiliate Network is based exclusively on a pay-per-sale model. This means that affiliates receive a commission, a percentage out of the price for all shopper purchases that they refer. You alone control the value of the commission paid to affiliates in the 2Checkout Network when a visitor referred by them purchases a product or a service on your website.

Do affiliates automatically receive commission for ever sale they generate?

No. You first need to confirm the sales reported by our External Tracking technology as valid.

Under which conditions can I reject sales?

You can reject all invalid or erroneously reported sales if identified as such. For example, you can reject an order to avoid duplicate crediting of an affiliate that works with both 2Checkout Affiliate Network and another affiliate network.

What does the Other message stand for?

Orders can contain additional costs on top of the price of the products purchased. When 2Checkout identifies such costs, including taxes (VAT, sales tax), shipping taxes, etc., they're featured in a manner designed to make it clear that they cannot be matched with a product in the 2Checkout system.

How does 2Checkout calculate the affiliate commission?

2Checkout calculates the affiliate commission only according to the price of the products shoppers acquire from you, disregarding any additional costs they pay.

Why is the commission of some external orders zero (0) even if they're valid sales?

The affiliate commission for the selected 2Checkout match is 0 because the affiliate initially promoted a different product than the one purchased by the shopper. As such, the 2Checkout system has determined that the commission is not warranted.

You should reject orders for which the commission's value is zero (0). However, even if you try to approve them, the 2Checkout system is designed to disregard them, since there's no commission to pay affiliates.

Commission zero

 

Can the commission for an External Order be modified?

Only for Pending External Orders, by modifying the commission settings for affiliates, which will be applied automatically.

What values can be sent for the parameters market as optional in the JavaScript code?

Either the first and last name, company, email, postal code, etc. in the case of setContact, for example, when they exist, or null otherwise. Replace each optional parameter with NULL. Alternativelly, the entire line: tracking.setContact('FIRST_NAME', 'LAST_NAME', 'COMPANY', 'EMAIL', 'POSTAL_CODE', 'CITY', 'STATE', 'FISCAL_CODE', 'ISO_COUNTRY_CODE', 'ADDRESS'); can be removed.

What happens when the "none" option is selected when matching products?

2Checkout will not pay Affiliates a commission for External Products which you don't match with items configured in 2Checkout (their equivalents) and select noneinstead.

What data does the external order tracking mechanism captures?

We only capture data that we receive from the after sales page in the 3rd party ecommerce platform.

The mandatory values that we need in order for External Order Tracking to function are:

  1. Order ID (from 3rd party eCommerce solution, for sync purposes - e.g. if one of their orders gets refunded, the merchant will be able to reject the order in 2Checkout also);
  2. Currency - the currency that was used in the order;
  3. Total Price - price paid by the customers;
  4. Product details:
    • Product name - name of product from 3rd party eCommerce solution
    • Unit price - unit price in 3rd party eCommerce solution
    • Quantity - quantity
    • Product ID - product ID in 3rd party eCommerce solution

There are some optional variables also that the merchant can send: First name, last name, company, email, postal code, city, state, fiscal code, country code (ISO), address.

Update coupon

Overview

Use the updatePromotionCoupon method to add single or multiple coupons to a promotion.

Updating a promotion with multiple coupons causes any existing single coupon to be removed.

Parameters

Parameter Type/Description

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to update.

promotionCoupon

Required (object)

 

type

Required (string)

 

 

Coupon type. Available values:

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

 

Code/Codes

Required (string/array of strings)

 

 

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

Response

Parameter Type/Description
promotionCoupon Object

Request

<?php

require ('PATH_TO_AUTH');

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

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

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

try {
    $updatedPromotion = $client->addPromotionCoupon ($sessionID, $promotionCode, $promotionCoupon);
}

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

var_dump("UpdatedPromotion", $updatedPromotion);

 

Remove coupon

Overview

Use the deletePromotionCoupon method to remove single or multiple coupons from a promotion.

Parameters

Parameter Type/Description

promotionCode

Required (string)

 

The code corresponding to the promotion that you want to remove coupons from.

promotionCoupon

Required (object)

 

type

Required (string)

 

 

Coupon type. Available values:

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

 

Code/Codes

Required (string/array of strings)

 

 

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

Response

Parameter Type/Description
promotionCoupon Object

Request

<?php

require ('PATH_TO_AUTH');

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

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

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

try {
    $updatedPromotion = $client->addPromotionCoupon ($sessionID, $promotionCode, $promotionCoupon);
}

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

var_dump("UpdatedPromotion", $updatedPromotion);

 

Assign order/product additional fields

Overview

Use the assignAdditionalField method to update additional fields for your account.

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.

FieldCode

Required (string)

 

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

Required

Boolean

 

True or False depending on whether you want make the field mandatory or not.

ProductCode

Required (string)

 

The unique product code that you control not the system-generated product identifier.

Request

<?php

require ('PATH_TO_AUTH');

$ProductCode = 'YOUR_PRODUCT_CODE';
$FieldCode = 'YOUR_FIELD_CODE';
$Required = true;

$jsonRpcRequest = array(
    'jsonrpc' => '2.0',
    'id' => $i++,
    'method' => 'assignAdditionalField',
    'params' => array(
        $sessionID,
        $FieldCode,        $Required,
        $ProductCode
    )
);
var_dump(callRPC((Object) $jsonRpcRequest, $host));

?>

Response

bool(true)

Change time zones in the 2Checkout system

Overview

The 2Checkout platform supports time zones and Daylight Saving Time corrections when reporting the date and time. Time zone support enables you to gain better insight into the performance of your business operations correlating it with your preferred time zone, or the one that best matches your geographical location.

2Checkout date-time stamps:

  • GMT+02:00 by default;
  • The time zone you set using Account settings.

The 2Checkout platform enables you to control the Time zone for:

  • The Control Panel
  • The 2Checkout API

Note: The Time zones set for the Control Panel and for the API can coincide, but at the same time they can be different, since they work independent of one another. For example, you can set GMT-8 if you're on Pacific Time for the Control Panel, and GMT-6 for Central America for the API.

Impact

Changing the Time zones in the 2Checkout platform impacts the way in which the system reports:

  • the date and time of orders placed by your customers and partners;
  • when placing partner orders;
  • subscriptions generated by the system;
  • changes happening through the lifetime of subscriptions;
  • delivery confirmations;
  • refunds.

Note: 2Checkout corrects for Daylight Saving Time. The date and time information can vary through the inclusion of Daylight Savings depending on your country and the period of the year.

In addition, date and time info sent through IPN (Instant Payment Notification) and LCN (License Change Notification) will also adapt to reflect the time zone you opt to use for the 2Checkout API.

Exceptions

  1. Accounting area - All Accounting data recorded and provided by the 2Checkout platform uses the system's default GMT+02:00 time zone and cannot be changed. The accounting reports, emails you receive from 2Checkout, the Accounting area in the Control Panel, invoices, Product overview, Orders overview and Products report will display the GMT+02:00 time zone of 2Checkout's system.
  2. Bonus programs for 2Checkout affiliates use the default GMT+02:00 time zone.
  3. The 2Checkout sales reports use default GMT+02:00 time zone.
  4. Parts of the 2Checkout API not related to IPN and LCN.

Time zone setup

To set up or change time zones in the 2Checkout platform for your account, navigate to Account settings, and in the System settings area, click on the Edit system settings button at the bottom of the page.

By default, the Control Panel uses the (GMT+02:00) Athens, Bucharest, Istanbul time zone to display the date, to which Daylight Saving might apply, depending on country and period of the year. Using the dropdown menus, you can change the Control Panel display time zones in order & customers related areas (Order Search, Customers, Delivery Confirmations, Place Partner Order and Partner Refunds) and the time zoned used in the 2Checkout APIs for IPN (Instant Payment Notification) and LCN (License Change Notification).

Displaying time zone details

When you select a time zone it is displayed throughout the Control Panel, but Daylight Saving Time corrections will only be made for the actual date and time.

This means that if you select GMT + 01:00, when the associated offset increases to GMT + 02:00 because of Daylight Savings, the date and time reported by the system will change accordingly, even though GMT + 01:00 will appear per your settings.

Orders search for both eStore orders and Partner orders enable you to swap the report time zone between the 2Checkout default and the custom time zone you selected.

The same is valid for the Subscriptions ManagementCustomers and the Partner Refunds report.

The time zone is also displayed on the Dashboard (home page of the Control Panel) under the Latest orders area. In addition, when editing the details of a subscription, time zone information will also be displayed.

2Checkout API time zones

2Checkout sends out datetime stamps in the following situations:

  • By default for every LCN (License Change Notification). This behavior cannot be switched off.
  • For IPN (Instant Payment Notification) but only if under IPN settings you check the TIMEZONE_OFFSET option in the notification details area.

LCN - TIMEZONE_OFFSET: The time zone you selected or the default GMT+02:00 time zone of the 2Checkout system.

IPN - TIMEZONE_OFFSET: The time zone you selected or the default GMT+02:00 time zone of the 2Checkout system.

IDN_DATE - If you changed the time zone for the 2Checkout API by editing system settings under Account settings, then the IDN_DATE will be calculated according to your custom configuration. 2Checkout will use your custom set time zone for the IDN_DATE when calculating the HASH, and it's important that you also use the same datetime stamp, also per the custom time zone.

IRN_DATE - If you changed the time zone for the 2Checkout API by editing system settings under Account settings, then the IRN_DATE will be calculated according to your custom configuration. 2Checkout will use your custom set time zone for the IRN_DATE when calculating the HASH, and it's important that you also use the same datetime stamp, also per the custom time zone.

Electronic delivery - TIMEZONE: The time zone you selected or the default GMT+02:00 time zone of the 2Checkout system.

FAQ

Will changing the time zone prolong or shorten the lifetime of subscriptions sold?

No. Changing the time zone has no impact on the lifecycle of subscriptions you already sold and are used by your customers. Only the datetime stamps reported by the 2Checkout system vary when swapping one time zone for another. Similarly, changing time zones will not impact renewals or expiration deadlines, for example.

Some orders just placed appear with datetime stamps in the future or in the past. How is this possible?

Such discrepancies occur only in scenarios in which you opted to set a time zone different than the one specific to your geographical location.

If you're based in the UK but use (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna instead of (GMT+00:00) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London, then orders your customers place between 11:00 PM and 12:00 AM (UK time) are reported as being placed the next day.

Similarly, if you're based in the UK but instead of using (GMT+00:00) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London, you change the time zone settings in the 2Checkout Control Panel to (GMT-06:00) Central Time (US & Canada), orders your customers place after 12:00 AM are reported as being placed the previous day.

Available time zones

  • (GMT-11:00) Midway Island, Samoa
  • (GMT-10:00) Hawaii
  • (GMT-09:00) Alaska
  • (GMT-08:00) Tijuana, Baja California
  • (GMT-08:00) Pacific Time (US & Canada)
  • (GMT-07:00) Mountain Time (US & Canada)
  • (GMT-07:00) Chihuahua, La Paz, Mazatlan - Old
  • (GMT-07:00) Chihuahua, La Paz, Mazatlan - New
  • (GMT-07:00) Arizona
  • (GMT-06:00) Saskatchewan
  • (GMT-06:00) Guadalajara, Mexico City, Monterrey - Old
  • (GMT-06:00) Guadalajara, Mexico City, Monterrey - New
  • (GMT-06:00) Central Time (US & Canada)
  • (GMT-06:00) Central America
  • (GMT-05:00) Indiana (East)
  • (GMT-05:00) Eastern Time (US & Canada)
  • (GMT-05:00) Bogota, Lima, Quito, Rio Branco
  • (GMT-04:30) Caracas
  • (GMT-04:00) Santiago
  • (GMT-04:00) Manaus
  • (GMT-04:00) La Paz
  • (GMT-04:00) Atlantic Time (Canada)
  • (GMT-03:30) Newfoundland
  • (GMT-03:00) Montevideo
  • (GMT-03:00) Greenland
  • (GMT-03:00) Georgetown
  • (GMT-03:00) Buenos Aires
  • (GMT-03:00) Brasilia
  • (GMT-02:00) Mid-Atlantic
  • (GMT-01:00) Cape Verde Is.
  • (GMT-01:00) Azores
  • UTC (this option will only appear in the drop down menu for the 2Checkout API time zone selection)
  • (GMT+00:00) Casablanca
  • (GMT+00:00) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London
  • (GMT+00:00) Monrovia, Reykjavik
  • (GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
  • (GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague
  • (GMT+01:00) Brussels, Copenhagen, Madrid, Paris
  • (GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb
  • (GMT+01:00) West Central Africa
  • (GMT+02:00) Amman
  • (GMT+02:00) Athens, Bucharest, Istanbul
  • (GMT+02:00) Beirut
  • (GMT+02:00) Cairo
  • (GMT+02:00) Harare, Pretoria
  • (GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
  • (GMT+02:00) Jerusalem
  • (GMT+02:00) Minsk
  • (GMT+02:00) Windhoek
  • (GMT+03:00) Baghdad
  • (GMT+03:00) Kuwait, Riyadh
  • (GMT+03:00) Moscow, St. Petersburg, Volgograd
  • (GMT+03:00) Nairobi
  • (GMT+03:00) Tbilisi
  • (GMT+03:30) Tehran
  • (GMT+04:00) Abu Dhabi, Muscat
  • (GMT+04:00) Baku
  • (GMT+04:00) Caucasus Standard Time
  • (GMT+04:00) Port Louis
  • (GMT+04:00) Yerevan
  • (GMT+04:30) Kabul
  • (GMT+05:00) Ekaterinburg
  • (GMT+05:00) Islamabad, Karachi
  • (GMT+05:00) Tashkent
  • (GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi
  • (GMT+05:30) Sri Jayawardenepura
  • (GMT+05:45) Kathmandu
  • (GMT+06:00) Almaty, Novosibirsk
  • (GMT+06:00) Astana, Dhaka
  • (GMT+06:30) Yangon (Rangoon)
  • (GMT+07:00) Bangkok, Hanoi, Jakarta
  • (GMT+07:00) Krasnoyarsk
  • (GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi
  • (GMT+08:00) Irkutsk, Ulaan Bataar
  • (GMT+08:00) Kuala Lumpur, Singapore
  • (GMT+08:00) Perth
  • (GMT+08:00) Taipei
  • (GMT+09:00) Osaka, Sapporo, Tokyo
  • (GMT+09:00) Seoul
  • (GMT+09:00) Yakutsk
  • (GMT+09:30) Adelaide
  • (GMT+09:30) Darwin
  • (GMT+10:00) Brisbane
  • (GMT+10:00) Canberra, Melbourne, Sydney
  • (GMT+10:00) Guam, Port Moresby
  • (GMT+10:00) Hobart
  • (GMT+10:00) Vladivostok
  • (GMT+11:00) Magadan, Solomon Is., New Caledonia
  • (GMT+12:00) Auckland, Wellington
  • (GMT+12:00) Fiji, Kamchatka, Marshall Is.
  • (GMT+13:00) Nuku'alofa

Update order/product additional fields

Overview

Use the updateAdditionalField method to update additional fields for your account.

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.

AdditionalField

Object

 

Additional field object.

Response

bool(true)

Request

<?php

require ('PATH_TO_AUTH');

$AdditionalField                             = new stdClass();
$AdditionalField->Label                      = 'Do you agree with the new newsletter policy 2015?';
$AdditionalField->Type                       = 'LISTBOX';
$AdditionalField->Code                       = 'NewsletterPolicy1234576';
$AdditionalField->ApplyTo                    = 'ORDER';
$AdditionalField->Values                     = array();
$AdditionalField->Values[0]                  = 'YES';
$AdditionalField->Values[1]                  = 'NO';
$AdditionalField->ValidationRule             = null;
$AdditionalField->Translations               = array();
$AdditionalField->Translations[0]            = new stdClass();
$AdditionalField->Translations[0]->Label     = "Êtes-vous d'accord avec la politique de la newsletter?";
$AdditionalField->Translations[0]->Values    = array();
$AdditionalField->Translations[0]->Values[0] = 'Oui';
$AdditionalField->Translations[0]->Values[1] = 'Non';
$AdditionalField->Translations[0]->Language  = 'fr';
$AdditionalField->Translations[1]            = new stdClass();
$AdditionalField->Translations[1]->Label     = 'Haben Sie mit dem Newsletter Politik zu?';
$AdditionalField->Translations[1]->Values    = array();
$AdditionalField->Translations[1]->Values[0] = 'Ja';
$AdditionalField->Translations[1]->Values[1] = 'Nein';
$AdditionalField->Translations[1]->Language  = 'de';

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

?>

 

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