ZRPL
  • Welcome!
  • Quick Start
  • Reference
    • API Reference
      • Categories List
      • Category Details by ID
      • Create Simple Product
      • Config Product Creation
      • Product List
      • Update Existing Product
      • Product Details by SKU
      • Product Details by ID
      • Products in Category
      • Create Order
      • Order Details
      • Order History
      • Create Customer
      • Customer Token
      • Create Customer Cart
      • Add Item to Cart
      • View Cart
      • Update Cart
      • Delete Cart
      • Country Code
      • Set Shipping and Billing
      • Place Order
      • Customer Details
Powered by GitBook
On this page
  1. Reference
  2. API Reference

Set Shipping and Billing

This API is offering to add Shipping and Billing Address.

POST {{Base_url}}/rest/V1/carts/mine/shipping-information

This endpoint is used to set the shipping and billing addresses, as well as the shipping method, for the current user's cart. After providing the necessary information, the cart is updated with the specified shipping and billing details, and the shipping cost is calculated based on the method.

Body

{
  "addressInformation": {
    "shipping_address": {
      "region": "Karnataka",
      "region_id": 549,
      "region_code": "KA",
      "country_id": "IN",
      "street": ["abc nagar, Bengaluru"],
      "telephone": "1234567890",
      "postcode": "560032",
      "city": "Bengaluru",
      "firstname": "Surya",
      "lastname": "Undralla",
      "email": "qa@zrpl.co.in"
    },
    "billing_address": {
      "region": "Karnataka",
      "region_id": 549,
      "region_code": "KA",
      "country_id": "IN",
      "street": ["abc nagar, Bengaluru"],
      "telephone": "1234567890",
      "postcode": "560032",
      "city": "Bengaluru",
      "firstname": "Surya",
      "lastname": "Kumari",
      "email": "qa@zrpl.co.in"
    },
    "shipping_method_code": "flatrate",
    "shipping_carrier_code": "flatrate"
  }
}
curl --location '{{Base_url}}/rest/V1/carts/mine/shipping-information' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjIxMDAyNywidXR5cGlkIjozLCJpYXQiOjE3Mzc1MzczODUsImV4cCI6MTczNzU0MDk4NX0.l_L_v__xKmNkdXidfiI6AZsQ9pWMJMDUtjFJDKQwDnU' \
--header 'Cookie: PHPSESSID=2639naaq26nbe7st472kk4ms4i' \
--data-raw '{
  "addressInformation": {
    "shipping_address": {
      "region": "Karnataka",
      "region_id": 549,
      "region_code": "KA",
      "country_id": "IN",
      "street": ["abc nagar, Bengaluru"],
      "telephone": "1234567890",
      "postcode": "560032",
      "city": "Bengaluru",
      "firstname": "Surya",
      "lastname": "Undralla",
      "email": "qa@zrpl.co.in"
    },
    "billing_address": {
      "region": "Karnataka",
      "region_id": 549,
      "region_code": "KA",
      "country_id": "IN",
      "street": ["abc nagar, Bengaluru"],
      "telephone": "1234567890",
      "postcode": "560032",
      "city": "Bengaluru",
      "firstname": "Surya",
      "lastname": "Kumari",
      "email": "qa@zrpl.co.in"
    },
    "shipping_method_code": "flatrate",
    "shipping_carrier_code": "flatrate"
  }
}
'

Payload Explanation

The payload contains an object addressInformation which has two primary sections: shipping_address, billing_address.

1. addressInformation

The parent object holding all the address and shipping details.


2. shipping_address

This object provides the shipping address where the purchased products will be delivered.

  • region: The name of the state or region (e.g., "Karnataka").

  • region_id: An ID associated with the region in the system (e.g., 549 for Karnataka).

  • region_code: A short code representing the region (e.g., "KA" for Karnataka).

  • country_id: The country code in ISO 2-letter format (e.g., "IN" for India).

  • street: An array of strings representing the street address (e.g., ["abc nagar, Bengaluru"]).

  • telephone: The phone number of the person at the shipping address (e.g., "1234567890").

  • postcode: The postal code/ZIP code (e.g., "560032").

  • city: The name of the city (e.g., "Bengaluru").

  • firstname: The first name of the recipient (e.g., "Surya").

  • lastname: The last name of the recipient (e.g., "Undralla").

  • email: The email address associated with the shipping address (e.g., "qa@zrpl.co.in").


3. billing_address

This object provides the billing address used for the payment.

  • region: The state or region name (e.g., "Karnataka").

  • region_id: An ID associated with the region in the system (e.g., 549 for Karnataka).

  • region_code: A short code representing the region (e.g., "KA").

  • country_id: The country code in ISO 2-letter format (e.g., "IN").

  • street: An array of strings representing the street address (e.g., ["abc nagar, Bengaluru"]).

  • telephone: The phone number for the billing address (e.g., "1234567890").

  • postcode: The postal code/ZIP code (e.g., "560032").

  • city: The name of the city (e.g., "Bengaluru").

  • firstname: The first name of the payer (e.g., "Surya").

  • lastname: The last name of the payer (e.g., "Kumari").

  • email: The email address associated with the billing address (e.g., "qa@zrpl.co.in").


4. Shipping Method Information

  • shipping_method_code: A code representing the shipping method (e.g., "flatrate"). This determines how shipping is calculated.

  • shipping_carrier_code: A code representing the carrier for the shipping method (e.g., "flatrate").

Responses

{
    "payment_methods": [
        {
            "code": "cashondelivery",
            "title": "Cash On Delivery"
        },
        {
            "code": "cashfree",
            "title": "Cashfree"
        },
        {
            "code": "razorpay",
            "title": "Razorpay"
        }
    ],
    "totals": {
        "grand_total": 499,
        "base_grand_total": 499,
        "subtotal": 399,
        "base_subtotal": 399,
        "discount_amount": 0,
        "base_discount_amount": 0,
        "subtotal_with_discount": 399,
        "base_subtotal_with_discount": 399,
        "shipping_amount": 0,
        "base_shipping_amount": 0,
        "shipping_discount_amount": 0,
        "base_shipping_discount_amount": 0,
        "tax_amount": 0,
        "base_tax_amount": 0,
        "weee_tax_applied_amount": null,
        "shipping_tax_amount": 0,
        "base_shipping_tax_amount": 0,
        "subtotal_incl_tax": 399,
        "shipping_incl_tax": 0,
        "base_shipping_incl_tax": 0,
        "base_currency_code": "INR",
        "quote_currency_code": "INR",
        "items_qty": 1,
        "items": [
            {
                "item_id": 97338,
                "price": 399,
                "base_price": 399,
                "qty": 1,
                "row_total": 399,
                "base_row_total": 399,
                "row_total_with_discount": 0,
                "tax_amount": 0,
                "base_tax_amount": 0,
                "tax_percent": 0,
                "discount_amount": 0,
                "base_discount_amount": 0,
                "discount_percent": 0,
                "price_incl_tax": 399,
                "base_price_incl_tax": 399,
                "row_total_incl_tax": 399,
                "base_row_total_incl_tax": 399,
                "options": "[]",
                "weee_tax_applied_amount": null,
                "weee_tax_applied": null,
                "name": "iFrogz Audio- Ear Pollution Plugz with Mic - Red"
            }
        ],
        "total_segments": [
            {
                "code": "subtotal",
                "title": "Subtotal",
                "value": 399
            },
            {
                "code": "shipping",
                "title": "Shipping & Handling (Included in Price - Free)",
                "value": 0
            },
            {
                "code": "tax",
                "title": "Tax",
                "value": 0,
                "extension_attributes": {
                    "tax_grandtotal_details": []
                }
            },
            {
                "code": "prdsurcharge",
                "title": "Handling Charges",
                "value": 100
            },
            {
                "code": "prdsurcharge_incl_tax",
                "title": "",
                "value": 0
            },
            {
                "code": "grand_total",
                "title": "Grand Total",
                "value": 499,
                "area": "footer"
            },
            {
                "code": "mageworx_rewardpoints_spend",
                "title": "Reward Points (0)",
                "value": -0
            }
        ],
        "extension_attributes": {
            "mw_earn_points_data": "[]",
            "mw_rwrdpoints_amnt": 0,
            "mw_rwrdpoints_cur_amnt": 0,
            "base_rwrdpoints_cur_amnt": 0
        }
    }
}

1. payment_methods

An array of available payment methods for the cart.

  • code: The identifier for the payment method.

    • cashondelivery: Cash On Delivery.

    • cashfree: Payment via Cashfree.

    • razorpay: Payment via Razorpay.

  • title: The display name of the payment method.


2. totals

An object containing all financial details of the cart.

grand_total

  • The total amount to be paid, including all charges, taxes, and discounts (e.g., 499).

base_grand_total

  • The grand total amount in the base currency of the store (e.g., 499).

subtotal

  • The total price of items in the cart before discounts and taxes (e.g., 399).

base_subtotal

  • The subtotal in the base currency of the store (e.g., 399).

discount_amount

  • Total discount applied to the cart (e.g., 0).

base_discount_amount

  • Discount amount in the base currency (e.g., 0).

subtotal_with_discount

  • Subtotal after applying discounts but before taxes (e.g., 399).

base_subtotal_with_discount

  • Subtotal with discount in base currency (e.g., 399).

shipping_amount

  • Cost of shipping (e.g., 0 for free shipping).

base_shipping_amount

  • Shipping cost in the base currency (e.g., 0).

shipping_discount_amount

  • Discount applied to the shipping cost (e.g., 0).

base_shipping_discount_amount

  • Discount applied to the shipping in the base currency (e.g., 0).

tax_amount

  • Total tax applied to the cart (e.g., 0).

base_tax_amount

  • Tax amount in the base currency (e.g., 0).

weee_tax_applied_amount

  • Amount of WEEE tax applied, if applicable (e.g., null).

shipping_tax_amount

  • Tax applied to shipping (e.g., 0).

base_shipping_tax_amount

  • Shipping tax amount in base currency (e.g., 0).

subtotal_incl_tax

  • Subtotal including taxes (e.g., 399).

shipping_incl_tax

  • Shipping cost including taxes (e.g., 0).

base_shipping_incl_tax

  • Shipping cost including tax in base currency (e.g., 0).

base_currency_code

  • The code of the store's base currency (e.g., INR).

quote_currency_code

  • The currency code for the quote (e.g., INR).

items_qty

  • Total quantity of items in the cart (e.g., 1).


3. items

An array containing details about each item in the cart.

Item Attributes:

  • item_id: The unique identifier for the cart item (e.g., 97338).

  • price: Price of the item (e.g., 399).

  • base_price: Price in the base currency (e.g., 399).

  • qty: Quantity of the item in the cart (e.g., 1).

  • row_total: Total price for the item (price × quantity) (e.g., 399).

  • base_row_total: Row total in base currency (e.g., 399).

  • row_total_with_discount: Row total after applying discounts (e.g., 0).

  • tax_amount: Tax applied to the item (e.g., 0).

  • base_tax_amount: Tax amount in base currency (e.g., 0).

  • tax_percent: Percentage of tax applied (e.g., 0).

  • discount_amount: Discount applied to the item (e.g., 0).

  • base_discount_amount: Discount in base currency (e.g., 0).

  • discount_percent: Percentage discount applied (e.g., 0).

  • price_incl_tax: Item price including taxes (e.g., 399).

  • base_price_incl_tax: Item price including tax in base currency (e.g., 399).

  • row_total_incl_tax: Total for the item including taxes (e.g., 399).

  • base_row_total_incl_tax: Row total including tax in base currency (e.g., 399).

  • options: Additional options for the product (e.g., [] for none).

  • weee_tax_applied_amount: WEEE tax applied to the item (e.g., null).

  • weee_tax_applied: Detailed WEEE tax breakdown (e.g., null).

  • name: The name of the product (e.g., "iFrogz Audio- Ear Pollution Plugz with Mic - Red").


4. total_segments

An array of detailed breakdowns for the cart's total price.

Segment Attributes:

  • code: The type of cost or discount (e.g., subtotal, grand_total).

  • title: A user-friendly description (e.g., "Subtotal").

  • value: The corresponding amount (e.g., 399 for subtotal).

  • extension_attributes: Additional data specific to the segment (e.g., tax_grandtotal_details for tax).

Example Segments:

  • subtotal: Cost of all items before taxes and discounts.

  • shipping: Shipping cost (e.g., "Included in Price - Free").

  • tax: Total tax applied (e.g., 0).

  • prdsurcharge: Handling charges (e.g., 100).

  • grand_total: Total payable amount (e.g., 499).


5. extension_attributes

Additional attributes not covered in the main totals object.

Attributes:

  • mw_earn_points_data: Information about reward points to be earned (e.g., [] for none).

  • mw_rwrdpoints_amnt: Reward points redeemed as currency (e.g., 0).

  • mw_rwrdpoints_cur_amnt: Redeemed points converted to the current currency (e.g., 0).

  • base_rwrdpoints_cur_amnt: Redeemed points converted to base currency (e.g., 0).

{
    "message": "The shipping method can't be set for an empty cart. Add an item to cart and try again."
}
{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "self"
    }
}
PreviousCountry CodeNextPlace Order

Last updated 4 months ago