# Retrieve shipping price

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.

## Request parameters

<table><thead><tr><th width="257.7332763671875">Parameters</th><th>Type / Description</th></tr></thead><tbody><tr><td><code>Items</code></td><td><p><strong>Required (object)</strong></p><p>Contains information on the tangible product added in cart.</p></td></tr><tr><td><code>Items.Code</code></td><td><p><strong>Required (string)</strong></p><p>Product code defined in the <strong>Information</strong> tab from the Product level, in the Control Panel.</p></td></tr><tr><td><code>Items.Quantity</code></td><td><p><strong>Optional (integer)</strong></p><p>Quantity of the product that is being purchased. Default value is 1.</p></td></tr><tr><td><code>BillingDetails</code></td><td><p><strong>Required (object)</strong></p><p>Contains customer billing information.</p></td></tr><tr><td><code>BillingDetails.CountryCode</code></td><td><p><strong>Required (string)</strong></p><p>Two-digits code of customer billing country. Example: 'US'.</p></td></tr><tr><td><code>DeliveryDetails</code></td><td><p><strong>Required (object)</strong></p><p>Contains customer delivery information.</p></td></tr><tr><td><code>DeliveryDetails.CountryCode</code></td><td><p><strong>Required (string)</strong></p><p>Two-digits code of customer delivery country. Example: 'US'.</p></td></tr><tr><td><code>Currency</code></td><td><p><strong>Optional (string)</strong></p><p>Three-digits code of purchase currency. Example: 'USD'.</p></td></tr><tr><td><code>CouponCodes</code></td><td><p><strong>Optional (array of strings)</strong></p><p>Discount codes that can be applied to the purchase.</p></td></tr></tbody></table>

### Sample request

```php
<?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

$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'getShippingPrice';
$jsonRpcRequest->params = array($sessionID, $cartItems, $billingDetails, $deliveryDetails, $currency);
$jsonRpcRequest->id = $i++;

$getShippingPrice = callRPC($jsonRpcRequest, $host);
```

## Response parameters

<table><thead><tr><th width="159.5999755859375">Parameters</th><th>Type / Description</th></tr></thead><tbody><tr><td><a href="/pages/c14ffe1b17a5b84c412d3059b0af29d2bc973e73"><code>ShippingPrice</code></a></td><td><p><strong>Object</strong></p><p>This method returns an object, containing the shipping price available for a certain cart configuration.</p></td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.2checkout.com/json-rpc-api-reference/json-rpc-api-6.0/api-requests/shipping-in-api/retrieve-shipping-price.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
