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

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v:2.0:shipping:payload [2020/01/13 17:39] marijav:2.0:shipping:payload [2020/09/25 00:08] (current) – adding customer attributes to the example foxybrett
Line 5: Line 5:
 <code javascript> <code javascript>
 { {
-    "_links": {+  "_links": { 
 +    "curies":
 +      { 
 +        "name": "fx", 
 +        "href": "https://api.foxycart.com/rels/{rel}", 
 +        "templated": true 
 +      } 
 +    ], 
 +    "self":
 +      "href": "https://api.foxycart.com/carts/123456789", 
 +      "title": "This Cart"
     },     },
-    "_embedded":+    "fx:attributes":
-        "fx:items": [+      "href": "https://api.foxycart.com/carts/123456789/attributes", 
 +      "title": "Attributes for This Cart" 
 +    }, 
 +    "fx:store":
 +      "href": "https://api.foxycart.com/stores/12345", 
 +      "title": "This Store" 
 +    }, 
 +    "fx:items":
 +      "href": "https://api.foxycart.com/carts/123456789/items", 
 +      "title": "The Items for This Cart" 
 +    }, 
 +    "fx:discounts":
 +      "href": "https://api.foxycart.com/carts/123456789/discounts", 
 +      "title": "Discounts for this Cart" 
 +    }, 
 +    "fx:applied_coupon_codes":
 +      "href": "https://api.foxycart.com/carts/123456789/applied_coupon_codes", 
 +      "title": "Coupon Codes applied to this Cart" 
 +    }, 
 +    "fx:custom_fields":
 +      "href": "https://api.foxycart.com/carts/123456789/cart_custom_fields", 
 +      "title": "The Custom Fields for this Cart" 
 +    }, 
 +    "fx:create_session":
 +      "href": "https://api.foxycart.com/carts/123456789/session", 
 +      "title": "POST here to create a browser session link" 
 +    } 
 +  }, 
 +  "_embedded":
 +    "fx:items": [ 
 +      { 
 +        "_links":
 +          "curies": [
             {             {
-                "_links": +              "name": "fx", 
-                }, +              "href": "https://api.foxycart.com/rels/{rel}"
-                "_embedded": { +              "templated": true 
-                    "fx:item_category": +            } 
-                        "_links": { +          ]
-                        }, +          "self": { 
-                        "admin_email_template_uri": ""+            "href": "https://api.foxycart.com/items/113551331", 
-                        "customer_email_template_uri": "", +            "title": "This Item
-                        "code": "flat", +          }
-                        "name""Flat Fee", +          "fx:store": { 
-                        "item_delivery_type": "flat_rate", +            "href": "https://api.foxycart.com/stores/12345", 
-                        "max_downloads_per_customer": 3+            "title": "This Store
-                        "max_downloads_time_period": 24, +          }
-                        "default_weight": 0, +          "fx:cart": { 
-                        "default_weight_unit": "LBS", +            "href": "https://api.foxycart.com/carts/123456789", 
-                        "default_length_unit""IN", +            "title": "This Cart" 
-                        "shipping_flat_rate_type": "per_order", +          }
-                        "shipping_flat_rate": 7+          "fx:item_category": { 
-                        "handling_fee_type": "none", +            "href": "https://api.foxycart.com/item_categories/23456", 
-                        "handling_fee": 1, +            "title": "This Item Category
-                        "handling_fee_minimum": 0, +          }
-                        "handling_fee_percentage": 80, +          "fx:item_options": { 
-                        "customs_value": 0+            "href": "https://api.foxycart.com/items/113551331/item_options", 
-                        "discount_type": "", +            "title": "Item Options for This Item
-                        "discount_name": "Repeat", +          }
-                        "discount_details": "allunits|250-90", +          "fx:attributes": { 
-                        "send_customer_email""", +            "href": "https://api.foxycart.com/items/113551331/attributes", 
-                        "send_admin_email": "", +            "title": "Attributes for This Item
-                        "admin_email": ""+          }
-                        "date_created": "", +          "fx:discount_details": { 
-                        "date_modified": "" +            "href": "https://api.foxycart.com/items/113551331/discount_details", 
-                    } +            "title": "The Discounts for this Item
-                }, +          }
-                "item_category_uri": "https://api.foxycart.com/item_categories/79", +          "fx:coupon_details": { 
-                "name": "Flat Rate Product", +            "href": "https://api.foxycart.com/items/113551331/coupon_details", 
-                "price": 9.5+            "title": "The Coupons for this Item
-                "quantity": 1, +          } 
-                "quantity_min": 0, +        }
-                "quantity_max": 0, +        "_embedded": { 
-                "weight": 0, +          "fx:item_options": [
-                "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": {+              "_links": { 
 +                "curies":
 +                  { 
 +                    "name": "fx", 
 +                    "href": "https://api.foxycart.com/rels/{rel}", 
 +                    "templated": true 
 +                  } 
 +                ], 
 +                "self":
 +                  "href": "https://api.foxycart.com/item_options/337999590", 
 +                  "title": "This Item Option"
                 },                 },
-                "_embedded":+                "fx:store": { 
-                    "fx:item_options": +                  "href": "https://api.foxycart.com/stores/12345", 
-                        +                  "title": "This Store"
-                            "_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", +                "fx:cart":
-                "name": "Test Product", +                  "href": "https://api.foxycart.com/carts/123456789", 
-                "price": 25.99+                  "title": "This Cart
-                "quantity"1, +                }
-                "quantity_min": 0, +                "fx:item": { 
-                "quantity_max": 0, +                  "href": "https://api.foxycart.com/items/113551331", 
-                "weight": 1, +                  "title": "This Item
-                "code": "", +                } 
-                "parent_code": "", +              }
-                "discount_name": "", +              "name": "Colour", 
-                "discount_type": ""+              "value": "Sparkletoots", 
-                "discount_details": "", +              "price_mod": 0, 
-                "subscription_frequency": "", +              "weight_mod": 0, 
-                "subscription_start_date": "", +              "date_created": null
-                "subscription_next_transaction_date": "", +              "date_modified": null
-                "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": { +          "fx:item_category": { 
-            "address_name": "", +            "_links": 
-            "first_name": "", +              "curies":
-            "last_name": "", +                { 
-            "company": "", +                  "name": "fx", 
-            "address1": "", +                  "href": "https://api.foxycart.com/rels/{rel}", 
-            "address2": "", +                  "templated": true 
-            "city": "SAINT PAUL", +                } 
-            "region": "MN", +              ], 
-            "postal_code": 55116+              "self": { 
-            "country": "US", +                "href": "https://api.foxycart.com/item_categories/23456", 
-            "origin_region": "MN", +                "title": "DEFAULT" 
-            "origin_postal_code": 55116+              }, 
-            "origin_country": "US", +              "fx:store":
-            "shipping_service_id": 0+                "href": "https://api.foxycart.com/stores/12345", 
-            "shipping_service_description": "", +                "title": "This Store" 
-            "is_residential": true+              }, 
-            "item_count": 2+              "fx:email_templates":
-            "total_weight": 1+                "href": "https://api.foxycart.com/stores/12345/email_templates", 
-            "total_customs_value": 0, +                "title": "Email Templates for this store" 
-            "total_handling_fee": 5+              }, 
-            "total_flat_rate_shipping": 7+              "fx:tax_item_categories":
-            "total_item_price": 35.49+                "href": "https://api.foxycart.com/item_categories/23456/tax_item_categories", 
-            "total_tax": 4.57+                "title": "Tax Item Category relationships" 
-            "total_shipping": 12+              } 
-            "total_price": 52.06+            }
 +            "admin_email_template_uri": "", 
 +            "customer_email_template_uri": "", 
 +            "code": "DEFAULT", 
 +            "name": "Default for all products", 
 +            "item_delivery_type": "shipped", 
 +            "max_downloads_per_customer": 3
 +            "max_downloads_time_period": 24, 
 +            "default_weight": 30
 +            "default_weight_unit": "LBS", 
 +            "default_length_unit": "IN"
 +            "shipping_flat_rate_type": "per_order", 
 +            "shipping_flat_rate": 5
 +            "handling_fee_type": "none", 
 +            "handling_fee": 0
 +            "handling_fee_minimum": 0
 +            "handling_fee_percentage": 0
 +            "customs_value": 0, 
 +            "discount_type": ""
 +            "discount_name": ""
 +            "discount_details": ""
 +            "send_customer_email": false
 +            "send_admin_email": false
 +            "admin_email": "", 
 +            "date_created": null, 
 +            "date_modified": "2019-09-12T12:41:34-0700" 
 +          }
         },         },
-        "fx:discounts":+        "item_category_uri": "https://api.foxycart.com/item_categories/23456", 
-            +        "name": "Fancy Widget", 
-                "code": "SUMMER", +        "price": 80.95, 
-                "amount": -1.77+        "quantity": 1, 
-                "name": "Summer Special", +        "quantity_min": 0, 
-                "display": -1.77+        "quantity_max": 0, 
-                "is_taxable": "", +        "weight": 30, 
-                "is_future_discount": "" +        "code": "abc123", 
-            }+        "parent_code": "", 
 +        "discount_name": "", 
 +        "discount_type": "", 
 +        "discount_details": "", 
 +        "subscription_frequency": "", 
 +        "subscription_start_date": null, 
 +        "subscription_next_transaction_date": null, 
 +        "subscription_end_date": null, 
 +        "is_future_line_item": false, 
 +        "shipto": "", 
 +        "url": "", 
 +        "image": "https://placekitten.com/200/300", 
 +        "length": 0, 
 +        "width": 0, 
 +        "height": 0, 
 +        "expires": 0, 
 +        "date_created": null, 
 +        "date_modified": "2020-09-24T16:31:07-0700" 
 +      } 
 +    ], 
 +    "fx:discounts": [], 
 +    "fx:custom_fields": [], 
 +    "fx:shipment": 
 +      "address_name": "", 
 +      "first_name": "Jane", 
 +      "last_name": "Doe", 
 +      "email": "Jane@example.tld"
 +      "customer_id": "3456789", 
 +      "company": "NewCo", 
 +      "address1": "555 Mulberry Dr", 
 +      "address2": "", 
 +      "city": "SAN DIEGO", 
 +      "region": "CA", 
 +      "postal_code": "92107", 
 +      "country": "US", 
 +      "origin_region": "NY", 
 +      "origin_postal_code": "11110", 
 +      "origin_country": "US", 
 +      "shipping_service_id": 0, 
 +      "shipping_service_description": "", 
 +      "is_residential": true, 
 +      "item_count": 1
 +      "package_count": 1, 
 +      "package_weight": 30, 
 +      "package_length": 0, 
 +      "package_width": 0, 
 +      "package_height": 0, 
 +      "total_weight": 30, 
 +      "total_customs_value": 0, 
 +      "total_handling_fee": 0, 
 +      "total_flat_rate_shipping": 0, 
 +      "total_item_price": 80.95
 +      "total_tax": 0, 
 +      "total_shipping": 0
 +      "total_price": 80.95 
 +    }, 
 +    "fx:shipping_results": [], 
 +    "fx:customer":
 +      "_links":
 +        "curies":
 +          { 
 +            "name": "fx", 
 +            "href": "https://api.foxycart.com/rels/{rel}", 
 +            "templated": true 
 +          }
         ],         ],
-        "fx:custom_fields": [ +        "self":
-            { +          "href": "https://api.foxycart.com/customers/3456789", 
-                "name": "sign_on_delivery", +          "title": "This Customer" 
-                "value": "Yes", +        }, 
-                "is_hidden": 0 +        "fx:attributes":
-            }+          "href": "https://api.foxycart.com/customers/3456789/attributes", 
 +          "title": "Attributes for this Customer" 
 +        }, 
 +        "fx:store":
 +          "href": "https://api.foxycart.com/stores/12345", 
 +          "title": "This Store" 
 +        }, 
 +        "fx:default_billing_address":
 +          "href": "https://api.foxycart.com/customers/3456789/default_billing_address", 
 +          "title": "Default Billing Address for this Customer" 
 +        }, 
 +        "fx:default_shipping_address":
 +          "href": "https://api.foxycart.com/customers/3456789/default_shipping_address", 
 +          "title": "Default Shipping Address for this Customer" 
 +        }, 
 +        "fx:default_payment_method":
 +          "href": "https://api.foxycart.com/customers/3456789/default_payment_method", 
 +          "title": "Default Payment Method for this Customer" 
 +        }, 
 +        "fx:transactions":
 +          "href": "https://api.foxycart.com/stores/12345/transactions?customer_id=3456789", 
 +          "title": "Transactions for this Customer" 
 +        }, 
 +        "fx:subscriptions":
 +          "href": "https://api.foxycart.com/stores/12345/subscriptions?customer_id=3456789", 
 +          "title": "Subscriptions for this Customer" 
 +        }, 
 +        "fx:customer_addresses":
 +          "href": "https://api.foxycart.com/customers/3456789/addresses", 
 +          "title": "Addresses for this Customer" 
 +        } 
 +      }, 
 +      "_embedded":
 +        "fx:attributes": [ 
 +          { 
 +            "_links": { 
 +              "curies": [ 
 +                
 +                  "name": "fx", 
 +                  "href": "https://api.foxycart.com/rels/{rel}", 
 +                  "templated": true 
 +                
 +              ], 
 +              "self":
 +                "href": "https://api.foxycart.com/customer_attributes/1690200", 
 +                "title": "This customer attribute" 
 +              }, 
 +              "fx:store":
 +                "href": "https://api.foxycart.com/stores/12345", 
 +                "title": "This Store" 
 +              }, 
 +              "fx:customer":
 +                "href": "https://api.foxycart.com/customers/3456789", 
 +                "title": "This Customer" 
 +              } 
 +            }, 
 +            "name": "Loyalty_Points", 
 +            "value": "5087", 
 +            "visibility": "public", 
 +            "date_created": "2019-09-13T12:19:11-0700", 
 +            "date_modified": "2020-09-08T10:26:54-0700" 
 +          }, 
 +          { 
 +            "_links":
 +              "curies": [ 
 +                
 +                  "name": "fx", 
 +                  "href": "https://api.foxycart.com/rels/{rel}", 
 +                  "templated": true 
 +                } 
 +              ], 
 +              "self":
 +                "href": "https://api.foxycart.com/customer_attributes/1776235", 
 +                "title": "This customer attribute" 
 +              }, 
 +              "fx:store":
 +                "href": "https://api.foxycart.com/stores/12345", 
 +                "title": "This Store" 
 +              }, 
 +              "fx:customer":
 +                "href": "https://api.foxycart.com/customers/3456789", 
 +                "title": "This Customer" 
 +              } 
 +            }, 
 +            "name": "Loyalty_Level", 
 +            "value": "Blue", 
 +            "visibility": "public", 
 +            "date_created": "2019-10-11T05:48:24-0700", 
 +            "date_modified": "2019-12-23T11:10:13-0800" 
 +          }
         ]         ]
-    }, +      }, 
-    "customer_uri": "", +      "id": 3456789, 
-    "template_set_uri": "", +      "last_login_date": "2020-09-24T16:31:24-0700", 
-    "language": "", +      "first_name": "Jane", 
-    "locale_code": "en_US", +      "last_name": "Doe", 
-    "customer_ip": "192.168.0.1", +      "email": "Jane@example.tld", 
-    "ip_country": "United States", +      "tax_id": "", 
-    "session_name": "fcsid", +      "password_salt": "", 
-    "session_id": "hvcv28l8md0qc8qt5rrjh4qo85", +      "password_hash": "$P$Bjh123NnD860QG1jM9DrhjwGbPabKM1", 
-    "total_item_price": 35.49+      "password_hash_type": "phpass", 
-    "total_tax": 4.57+      "password_hash_config": "8", 
-    "total_shipping": 12+      "forgot_password": "", 
-    "total_future_shipping": 0, +      "forgot_password_timestamp": null, 
-    "total_order": 50.29+      "is_anonymous": false, 
-    "date_created": ""+      "date_created": "2019-09-13T12:08:02-0700", 
-    "date_modified": "2016-07-02T15:03:46-0700"+      "date_modified": "2020-09-24T16:31:24-0700" 
 +    
 +  }, 
 +  "customer_uri": "", 
 +  "template_set_uri": "", 
 +  "payment_method_uri": "", 
 +  "language": "", 
 +  "locale_code": "en_US", 
 +  "use_customer_shipping_address": false, 
 +  "billing_first_name": null
 +  "billing_last_name": null, 
 +  "billing_company": null
 +  "billing_address1": null, 
 +  "billing_address2": null
 +  "billing_city": "SAN DIEGO", 
 +  "billing_state": "CA", 
 +  "billing_postal_code": "92107", 
 +  "billing_country": "US", 
 +  "billing_phone": null, 
 +  "customer_email": null, 
 +  "shipping_first_name": null, 
 +  "shipping_last_name": null, 
 +  "shipping_company": null, 
 +  "shipping_address1": null, 
 +  "shipping_address2": null, 
 +  "shipping_city": "SAN DIEGO", 
 +  "shipping_state": "CA", 
 +  "shipping_postal_code": "92107", 
 +  "shipping_country": "US", 
 +  "shipping_phone": null, 
 +  "total_item_price": 80.95
 +  "total_tax": 0
 +  "total_shipping": 0
 +  "total_future_shipping": 0, 
 +  "total_order": 80.95
 +  "date_created": null
 +  "date_modified": "2020-09-24T16:31:07-0700"
 +  "currency_code": "USD", 
 +  "currency_symbol": "$", 
 +  "customer_ip": "1.1.1.1", 
 +  "ip_country": "United States", 
 +  "session_name": "fcsid", 
 +  "session_id": "123458kabr94e8srpk06h109s1", 
 +  "total_discount": 0, 
 +  "total_future_item_price": 0
 } }
 </code> </code>
Line 210: Line 415:
  
   * 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.   * 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.
 +  * If the customer is authenticated on the checkout, then the ''fx:customer'' node will be included, along with any attributes associated with the customer.
   * Please review [[https://wiki.foxycart.com/v/2.0/shipping#passing_custom_fields_to_the_custom_shipping_endpoint|this link]] for complete information on custom fields (''fx:custom_fields'') in relation to the custom shipping code or endpoint using the ''data-fc-shipping-custom-field'' attribute on custom checkout fields.   * Please review [[https://wiki.foxycart.com/v/2.0/shipping#passing_custom_fields_to_the_custom_shipping_endpoint|this link]] for complete information on custom fields (''fx:custom_fields'') in relation to the custom shipping code or endpoint using the ''data-fc-shipping-custom-field'' attribute on custom checkout fields.
   * 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.   * 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.

Site Tools