Shipping Methods

Shipping Methods API

The Shipping Methods API allows you to manage shipping options for your store. You can retrieve available shipping methods, create new ones, update existing ones, and manage shipping rates based on destination and order parameters.

GET /api/shippings/

Retrieve a list of all shipping methods in your store. This endpoint supports pagination.

Query Parameters

Parameter Type Required Description
page integer No Page number (default: 1)
items_per_page integer No Number of items per page (default: 10)
status string No Filter by status (A: active, D: disabled, H: hidden)

Example Response

{
  "shippings": [
    {
      "shipping_id": "1",
      "shipping": "Standard Shipping",
      "delivery_time": "3-5 business days",
      "min_weight": "0.00",
      "max_weight": "0.00",
      "status": "A",
      "position": 10
    },
    {
      "shipping_id": "2",
      "shipping": "Express Shipping",
      "delivery_time": "1-2 business days",
      "min_weight": "0.00",
      "max_weight": "0.00",
      "status": "A",
      "position": 20
    }
  ],
  "params": {
    "page": 1,
    "items_per_page": 10,
    "total_items": 2
  }
}
GET /api/shippings/{shipping_id}/

Retrieve details for a specific shipping method by its ID.

Example Response

{
  "shipping_id": "1",
  "shipping": "Standard Shipping",
  "min_weight": "0.00",
  "max_weight": "0.00",
  "service_id": "0",
  "service_params": {
    "currency": "USD",
    "pickup_type": "01"
  },
  "delivery_time": "3-5 business days",
  "position": 10,
  "status": "A",
  "rates": [
    {
      "rate_id": "1",
      "rate_value": "5.99",
      "destination": "US",
      "min_order_amount": "0.00",
      "max_order_amount": "0.00"
    },
    {
      "rate_id": "2",
      "rate_value": "0.00",
      "destination": "US",
      "min_order_amount": "50.00",
      "max_order_amount": "0.00"
    }
  ]
}
POST /api/shippings/

Create a new shipping method.

Request Parameters

Parameter Type Required Description
shipping string Yes Name of the shipping method
delivery_time string No Estimated delivery time
min_weight string No Minimum weight (0.00 for no limit)
max_weight string No Maximum weight (0.00 for no limit)
service_id string No ID of the shipping service provider
service_params object No Parameters for shipping service
status string No Status (A: active, D: disabled, H: hidden)
position integer No Display position in the list
rates array No Shipping rates for different destinations

Example Request

{
  "shipping": "International Shipping",
  "delivery_time": "7-14 business days",
  "min_weight": "0.00",
  "max_weight": "20.00",
  "status": "A",
  "position": 30,
  "rates": [
    {
      "rate_value": "19.99",
      "destination": "CA",
      "min_order_amount": "0.00",
      "max_order_amount": "0.00"
    },
    {
      "rate_value": "29.99",
      "destination": "EU",
      "min_order_amount": "0.00",
      "max_order_amount": "0.00"
    }
  ]
}
Note: If no rates are specified, the shipping method will be available for all destinations with a rate of 0.00.
PUT /api/shippings/{shipping_id}/

Update an existing shipping method.

Example Request

{
  "delivery_time": "2-4 business days",
  "status": "A",
  "rates": [
    {
      "rate_id": "1",
      "rate_value": "4.99"
    },
    {
      "destination": "CA",
      "rate_value": "9.99"
    }
  ]
}
Tip: When updating rates, include rate_id to update existing rates, or omit it to create new rates for additional destinations.
DELETE /api/shippings/{shipping_id}/

Delete a shipping method.

Important: You cannot delete shipping methods that are currently in use by orders. Consider disabling the shipping method by setting its status to "D" instead.

Shipping Rate Structure

Shipping rates can be defined based on destination and order amount. The system will select the appropriate rate based on these factors.

Parameter Description
destination Country code or destination type (ALL for all countries)
rate_value Shipping cost
min_order_amount Minimum order total for this rate to apply
max_order_amount Maximum order total for this rate to apply (0.00 for no limit)
Free Shipping Example: To offer free shipping for orders over $50, create a rate with min_order_amount set to "50.00" and rate_value set to "0.00".