Skip to main content

Retrieve shipping price

Last updated: 24-Aug-2021
Rate this article:

Overview

Use getShippingPrice to retrieve the shipping method and price available, based on a current cart configuration. This API call returns the available shipping methods defined in your Control Panel, together with the fees you configured based on order total amount/weight/country.

Requirements

It's mandatory to have tangible products defined in your Control Panel, to retrieve shipping method and price information.

Parameters

Parameters Type/Description
Items

Object / Required

Contains information on the tangible product added in cart.

  Code

String / Required

Product code defined in the Information tab from the Product level, in the Control Panel.

  Quantity

Integer / Optional

Quantity of the product that is being purchased.

Default value is 1.

BillingDetails

Object / Required

Contains customer billing information.

  CountryCode

String / Required

Two-digits code of customer billing country. Example: 'US'.

DeliveryDetails

Object / Required

Contains customer delivery information.

  CountryCode

String / Required

Two-digits code of customer delivery country. Example: 'US'.

Currency

String / Optional

Three-digits code of purchase currency. Example: 'USD'.

CouponCodes

Array of strings / Optional

Discount codes that can be applied to the purchase.

Sample request

<?php

require ('PATH_TO_AUTH'); // authentication call

$cartItems = [];
$cartItem = new stdClass();
$cartItem->Code = 'my_product_code_1'; // product code defined in the Information tab, at product level
$cartItem->Quantity = 2; // quantity that is being purchased
$cartItems[0] = $cartItem;
$billingDetails = new stdClass();
$billingDetails->CountryCode = 'US'; // billing country
$deliveryDetails = new stdClass();
$deliveryDetails->CountryCode = 'AU'; // delivery country

$currency = 'USD'; // purchase currency

$couponCode = ['TANGIBLEPROMO']; // apply discount to promotion

try {
    $shippingPrice = $client->getShippingPrice($sessionID, $cartItems, $billingDetails, $deliveryDetails, $currency);
}
catch (SoapFault $e) {
    echo "ShippingPrice: " . $e->getMessage();
    exit;
}
var_dump("ShippingPrice", $shippingPrice);

Response

Parameters Type/Description
ShippingPrice

Object

This method returns an object, containing the shipping price available for a certain cart configuration.

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