Skip to main content

Retrieve price based on geolocation

Retrieve price based on geolocation

Last updated: 30-Mar-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: 'JSON'
};
$.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=JSON

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:

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