Skip to main content

Retrieve price based on geolocation

Last updated: 02-Apr-2021
Rate this article:

Overview

Use the getPrice method to retrieve product prices based on geolocation. 

To display product prices on your website without having the geolocation feature, you can use the getPrice API method, as described below.

Request example

var data = {
    PRODS: ' 12345678', // product ID
    OPTIONS 12345678: '', // product pricing options if any
    QTY: 1, //product quantity
    CURRENCY: 'EUR', //product currency
    COUPON: null, //discount to be applied
    RESPONSE_TYPE: 'SOAP'
};
$.ajax({
    type: 'GET',
    url: 'https://' + window.location.host + '/action/get_price.php',
    data: data,
    success: function (data) {
        // your code here
    },
    error: function (error) {
        console.error(error);
    },
});

A built URL that displays prices based on the customer's geolocation would look like this:

https://secure.2checkout.com/action/get_price.php?PRODS=12345678&OPTIONS12345678&QTY=1&CURRENCY=EUR&COUPON=null&RESPONSE_TYPE=SOAP

The quantity parameter is used only to retrieve the unit price with volume discounts if this was applied to the product. Setting quantity=2 in the request will not return the price for quantity 2, but it will return the unit price corresponding to the quantity interval specified.

For example if the unit price is:

Quantity =1 to 10 = 100USD

Quantity= 10+ = 90USD

A request with quantity 11 will not return 1100USD, it will return 90USD. While a call with quantity= 5, will return 100USD, not 500USD. 

Rate this article:
Logo of Verifone