Documentation You are here: start » v » 2.0 » shipping » payload

This is an old revision of the document!


Shipping Payload

The following is an example payload which is utilised as part of the custom shipping endpoint and custom shipping code functionality for Foxy stores. The payload shows a cart with two products (one live rate and one flat rate) along with a coupon.

{
    "_links": {
    },
    "_embedded": {
        "fx:items": [
            {
                "_links": {
                },
                "_embedded": {
                    "fx:item_category": {
                        "_links": {
                        },
                        "admin_email_template_uri": "",
                        "customer_email_template_uri": "",
                        "code": "flat",
                        "name": "Flat Fee",
                        "item_delivery_type": "flat_rate",
                        "max_downloads_per_customer": 3,
                        "max_downloads_time_period": 24,
                        "default_weight": 0,
                        "default_weight_unit": "LBS",
                        "default_length_unit": "IN",
                        "shipping_flat_rate_type": "per_order",
                        "shipping_flat_rate": 7,
                        "handling_fee_type": "none",
                        "handling_fee": 1,
                        "handling_fee_minimum": 0,
                        "handling_fee_percentage": 80,
                        "customs_value": 0,
                        "discount_type": "",
                        "discount_name": "Repeat",
                        "discount_details": "allunits|250-90",
                        "send_customer_email": "",
                        "send_admin_email": "",
                        "admin_email": "",
                        "date_created": "",
                        "date_modified": ""
                    }
                },
                "item_category_uri": "https://api.foxycart.com/item_categories/79",
                "name": "Flat Rate Product",
                "price": 9.5,
                "quantity": 1,
                "quantity_min": 0,
                "quantity_max": 0,
                "weight": 0,
                "code": "my-flat-product",
                "parent_code": "",
                "discount_name": "",
                "discount_type": "",
                "discount_details": "",
                "subscription_frequency": "",
                "subscription_start_date": "",
                "subscription_next_transaction_date": "",
                "subscription_end_date": "",
                "is_future_line_item": "",
                "shipto": "Me",
                "url": "",
                "image": "",
                "length": 0,
                "width": 0,
                "height": 0,
                "expires": 0,
                "date_created": "",
                "date_modified": "2016-07-03T02:31:37-0700"
            },
            {
                "_links": {
                },
                "_embedded": {
                    "fx:item_options": [
                        {
                            "_links": {
                            },
                            "name": "color",
                            "value": "red",
                            "price_mod": 0,
                            "weight_mod": 0,
                            "date_created": "",
                            "date_modified": ""
                        }
                    ],
                    "fx:item_category": {
                        "_links": {
                        },                                            
                        "admin_email_template_uri": "",
                        "customer_email_template_uri": "",
                        "code": "live",
                        "name": "Live Rates",
                        "item_delivery_type": "shipped",
                        "max_downloads_per_customer": 3,
                        "max_downloads_time_period": 24,
                        "default_weight": 1,
                        "default_weight_unit": "LBS",
                        "default_length_unit": "IN",
                        "shipping_flat_rate_type": "per_order",
                        "shipping_flat_rate": 0,
                        "handling_fee_type": "flat_per_order",
                        "handling_fee": 5,
                        "handling_fee_minimum": 0,
                        "handling_fee_percentage": 10,
                        "customs_value": 0,
                        "discount_type": "quantity_percentage",
                        "discount_name": "Repeat",
                        "discount_details": "repeat|2-10",
                        "send_customer_email": "",
                        "send_admin_email": "",
                        "admin_email": "",
                        "date_created": "",
                        "date_modified": ""
                    }
                },
                "item_category_uri": "https://api.foxycart.com/item_categories/83",
                "name": "Test Product",
                "price": 25.99,
                "quantity": 1,
                "quantity_min": 0,
                "quantity_max": 0,
                "weight": 1,
                "code": "",
                "parent_code": "",
                "discount_name": "",
                "discount_type": "",
                "discount_details": "",
                "subscription_frequency": "",
                "subscription_start_date": "",
                "subscription_next_transaction_date": "",
                "subscription_end_date": "",
                "is_future_line_item": "",
                "shipto": "Me",
                "url": "",
                "image": "",
                "length": 0,
                "width": 0,
                "height": 0,
                "expires": 0,
                "date_created": "",
                "date_modified": "2016-07-03T02:30:52-0700"
            }
        ],
        "fx:shipment": {
            "address_name": "",
            "first_name": "",
            "last_name": "",
            "company": "",
            "address1": "",
            "address2": "",
            "city": "SAINT PAUL",
            "region": "MN",
            "postal_code": 55116,
            "country": "US",
            "origin_region": "MN",
            "origin_postal_code": 55116,
            "origin_country": "US",
            "shipping_service_id": 0,
            "shipping_service_description": "",
            "is_residential": true,
            "item_count": 2,
            "total_weight": 1,
            "total_customs_value": 0,
            "total_handling_fee": 5,
            "total_flat_rate_shipping": 7,
            "total_item_price": 35.49,
            "total_tax": 4.57,
            "total_shipping": 12,
            "total_price": 52.06
        },
        "fx:discounts": [
            {
                "code": "SUMMER",
                "amount": -1.77,
                "name": "Summer Special",
                "display": -1.77,
                "is_taxable": "",
                "is_future_discount": ""
            }
        ],
        "fx:custom_fields": [
            {
                "name": "sign_on_delivery",
                "value": "Yes",
                "is_hidden": 0
            }
        ]
    },
    "customer_uri": "",
    "template_set_uri": "",
    "language": "",
    "locale_code": "en_US",
    "customer_ip": "192.168.0.1",
    "ip_country": "United States",
    "session_name": "fcsid",
    "session_id": "hvcv28l8md0qc8qt5rrjh4qo85",
    "total_item_price": 35.49,
    "total_tax": 4.57,
    "total_shipping": 12,
    "total_future_shipping": 0,
    "total_order": 50.29,
    "date_created": "",
    "date_modified": "2016-07-02T15:03:46-0700"
}

Notes:

  • The items included in the payload will only be those for the shipping address being requested. This means if your store is using multiship and the customer enters a shipping address for a shipto, only the products for that shipto will be included in the payload.
  • Please review this link for complete information on custom fields (fx:custom_fields) with the custom shipping code on endpoint using data-fc-shipping-custom-field.
  • The payload includes several _links arrays. These contain helpful URI's that could be used through the Hypermedia API if you're also making use of that. If not, these can be safely ignored.
  • USPS uses some custom country names in their API integration which we've worked around using the following modifications. If you're doing a custom integration with them, you may need to do something similar. Please note that the data on this wiki may not be up to date, so contact us if you run into any questions or issues with the below.
"ISO Code", "Normal Name", "USPS Preferred Name"
"AS", "American Samoa", "United States"
"BL", "Saint Bartholemy", "Saint Bartholomew (Guadeloupe)"
"CC", "Cocos (Keeling) Islands", "Cocos Island (Australia)"
"CD", "Congo, the Democratic Republic of the", "Congo, Democratic Republic of the"
"CF", "Central African Republic", "Central African Rep."
"CG", "Congo", "Congo, Republic of the"
"CI", "Cote D'Ivoire", "Côte d’Ivoire"
"CK", "Cook Islands", "Cook Islands (New Zealand)"
"CX", "Christmas Island", "Christmas Island (Australia)"
"EH", "Western Sahara", "Morocco"
"FK", "Falkland Islands (Malvinas)", "Falkland Islands"
"FR", "France, Metropolitan", "France"
"GB", "United Kingdom", "Great Britain and Northern Ireland"
"GE", "Georgia", "Georgia, Republic of"
"GS", "South Georgia and the South Sandwich Islands", "South Georgia (Falkland Islands)"
"GU", "Guam", "United States"
"GW", "Guinea-bissau", "Guinea-Bissau"
"ID", "East Timor", "East Timor (Indonesia)"
"IM", "Isle of Man", "Isle of Man (Great Britain)"
"IO", "British Indian Ocean Territory", "Maldives"
"IR", "Iran, Islamic Republic of", "Iran"
"KN", "Saint Kitts and Nevis", "Saint Kitts (St. Christopher and Nevis)"
"KP", "Korea, Democratic People's Republic of", "Korea, Democratic People's Republic of (North Korea)"
"KR", "Korea, Republic of", "Korea, Republic of (South Korea)"
"LA", "Lao People's Democratic Republic", "Laos"
"LY", "Libyan Arab Jamahiriya", "Libya"
"MC", "Monaco", "Monaco (France)"
"MD", "Moldova, Republic of", "Moldova"
"ME", "Yugoslavia", "Montenegro, Republic of"
"MF", "Saint Martin", "Saint Martin (Guadeloupe)"
"MH", "Marshall Islands", "Marshall Islands, Republic of the"
"MK", "Macedonia, The Former Yugoslav Republic of", "Macedonia, Republic of"
"MM", "Myanmar", "Myanmar (Burma)"
"MO", "Macau Special Administrative Region of China", "Macau (Macao)"
"MP", "Northern Mariana Islands", "United States"
"NF", "Norfolk Island", "Norfolk Island (Australia)"
"NU", "Niue", "Niue (New Zealand)"
"PN", "Pitcairn", "Pitcairn Island"
"PR", "Puerto Rico", "United States"
"PW", "Palau", "United States"
"RE", "Réunion", "Reunion"
"RS", "Serbia", "Serbia, Republic of"
"RU", "Russian Federation", "Russia"
"SJ", "Svalbard and Jan Mayen Islands", "Norway"
"SK", "Slovakia", "Slovak Republic"
"SY", "Syrian Arab Republic", "Syrian Arab Republic (Syria)"
"TK", "Tokelau", "Tokelau (Union) Group (Western Samoa)"
"TL", "Timor-Leste", "East Timor (Indonesia)"
"TW", "Taiwan, Province of China", "Taiwan"
"TZ", "Tanzania, United Republic of", "Tanzania"
"UM", "United States Minor Outlying Islands", "United States"
"VA", "Holy See (Vatican City State)", "Vatican City"
"VG", "Virgin Islands, British", "British Virgin Islands"
"VI", "Virgin Islands, U.S.", "United States"
"WS", "Samoa", "United States"
"YT", "Mayotte", "Mayotte (France)"

Site Tools