BigCommerce Integration
Step 1: Creating a webhook
To create a webhook, send a POST request to /stores/<your_store_hash>/v2/hooks
Webhooks POST request
Request |
Content |
URL |
https://api.bigcommerce.com/stores/(**your-store-hash**)/v2/hooks |
Method |
POST |
Format: |
JSON |
Request example
{
"scope": "store/order/created",
"destination": https://staging-api.onetribeglobal.com/direct/webhook/big-commerce/order/bOpxVgsXVmsaBdpvadvHMCx,
"is_active": true
}
Response Example
{
"created_at": 1580329317,
"destination": https://staging-api.onetribeglobal.com/api/direct/webhook/shopify/order/bOpxVgsXVmsaBdpvadvHMCx,
"headers": null,
"id": 20172984,
"is_active": true,
"scope": "store/order/created",
"store_hash": (your-store-hash),
"updated_at": 1580329317
}
Note: Following the creation of a webhook, it can take up to one minute for BigCommerce to start making POST requests to the destination server.The destination URL must be served on port 443; custom ports are not currently supported. To use a GET request to retrieve the order, send a GET request to /orders/<you-orderId>
Step 2: What will you receive back?
Callback payload
When a webhook is triggered, BigCommerce will POST a light payload containing event details to the destination server. For example, the data object for
store/order/statusUpdated contains only the order id
"order/statusUpdated" POST request body
{
"store_id": 11111,
"producer": "stores/abcde",
"scope": "store/order/statusUpdated",
"data": { "type": "order", "id": 173331 },
"hash": "3f9ea420af83450d7ef9f78b08c8af25b2213637"
}
json
Step 3: Send the order to One Tribe
Getting the order_id
To GET the order, send a GET request to /orders/(order-id)
Request:
Request |
Content |
URL |
/stores/(your-store-hash)/v3/orders/ |
Method |
GET |
Format: |
JSON |
Host |
api.bigcommerce.com |
Response:
{
"id": 218,
"customer_id": 11,
"date_created": "Tue, 05 Mar 2019 21:40:11 +0000",
"date_modified": "Mon, 11 Mar 2019 15:17:25 +0000",
"date_shipped": "",
"status_id": 7,
"status": "Awaiting Payment",
"subtotal_ex_tax": "62.6793",
"subtotal_inc_tax": "67.8400",
"subtotal_tax": "4.4000",
"base_shipping_cost": "12.0000",
"shipping_cost_ex_tax": "11.0900",
"shipping_cost_inc_tax": "12.0000",
"shipping_cost_tax": "0.9100",
"shipping_cost_tax_class_id": 0,
"base_handling_cost": "0.0000",
"handling_cost_ex_tax": "0.0000",
"handling_cost_inc_tax": "0.0000",
"handling_cost_tax": "0.0000",
"handling_cost_tax_class_id": 0,
"base_wrapping_cost": "0.0000",
"wrapping_cost_ex_tax": "0.0000",
"wrapping_cost_inc_tax": "0.0000",
"wrapping_cost_tax": "0.0000",
"wrapping_cost_tax_class_id": 0,
"total_ex_tax": "64.5300",
"total_inc_tax": "69.8400",
"total_tax": "5.3100",
"items_total": 4,
"items_shipped": 0,
"payment_method": "Cash",
"payment_provider_id": "",
"payment_status": "authorized",
"refunded_amount": "0.0000",
"order_is_digital": false,
"store_credit_amount": "0.0000",
"gift_certificate_amount": "0.0000",
"ip_address": "",
"ip_address_v6": "",
"geoip_country": "",
"geoip_country_iso2": "",
"currency_id": 1,
"currency_code": "USD",
"currency_exchange_rate": "1.0000000000",
"default_currency_id": 1,
"default_currency_code": "USD",
"staff_notes": "",
"customer_message": "",
"discount_amount": "5.0000",
"coupon_discount": "5.0000",
"shipping_address_count": 1,
"is_deleted": false,
"ebay_order_id": "0",
"cart_id": "7e48f7ef-2e88-4817-aea4-b0ed01490114",
"billing_address": {
"first_name": "Jane",
"last_name": "Doe",
"company": "",
"street_1": "555 East Street",
"street_2": "",
"city": "Austin",
"state": "Texas",
"zip": 78108,
"country": "United States",
"country_iso2": "US",
"phone": 1234567890,
"email": "janedoe@example.com",
"form_fields": [{ "name": "Delivery Instructions", "value": "Leave in backyard" }]
},
"is_email_opt_in": false,
"credit_card_type": null,
"order_source": "external",
"channel_id": 1,
"external_source": null,
"products": {
"url": "https://api.bigcommerce.com/stores/<your-store-hash>/v2/orders/218/products",
"resource": "/orders/218/products"
},
"shipping_addresses": {
"url": "https://api.bigcommerce.com/stores/<your-store-hash>/v2/orders/218/shippingaddresses",
"resource": "/orders/218/shippingaddresses"
},
"coupons": {
"url": "https://api.bigcommerce.com/stores/<your-store-hash>/v2/orders/218/coupons",
"resource": "/orders/218/coupons"
},
"external_id": null,
"external_merchant_id": null,
"tax_provider_id": "BasicTaxProvider",
"store_default_currency_code": "",
"store_default_to_transactional_exchange_rate": "1.0000000000",
"custom_status": "Awaiting Payment",
"customer_locale": "en"
}
json
POST to One Tribe
Create a POST request to be triggered when you receive a successful response from fetching the order. Send the object you receive in the response:
Headers |
Content |
Payload URL |
https://staging-api.onetribeglobal.com/direct/webhook/big-commerce/order/bOpxVgsXVmsaBdpvadvHMCx |
Method |
GET |
Content Type: |
"application/json" |
Host |
api.bigcommerce.com |
Example request:
{
"id": 218,
"customer_id": 11,
"date_created": "Tue, 05 Mar 2019 21:40:11 +0000",
"date_modified": "Mon, 11 Mar 2019 15:17:25 +0000",
"date_shipped": "",
"status_id": 7,
"status": "Awaiting Payment",
"subtotal_ex_tax": "62.6793",
"subtotal_inc_tax": "67.8400",
"subtotal_tax": "4.4000",
"base_shipping_cost": "12.0000",
"shipping_cost_ex_tax": "11.0900",
"shipping_cost_inc_tax": "12.0000",
"shipping_cost_tax": "0.9100",
"shipping_cost_tax_class_id": 0,
"base_handling_cost": "0.0000",
"handling_cost_ex_tax": "0.0000",
"handling_cost_inc_tax": "0.0000",
"handling_cost_tax": "0.0000",
"handling_cost_tax_class_id": 0,
"base_wrapping_cost": "0.0000",
"wrapping_cost_ex_tax": "0.0000",
"wrapping_cost_inc_tax": "0.0000",
"wrapping_cost_tax": "0.0000",
"wrapping_cost_tax_class_id": 0,
"total_ex_tax": "64.5300",
"total_inc_tax": "69.8400",
"total_tax": "5.3100",
"items_total": 4,
"items_shipped": 0,
"payment_method": "Cash",
"payment_provider_id": "",
"payment_status": "authorized",
"refunded_amount": "0.0000",
"order_is_digital": false,
"store_credit_amount": "0.0000",
"gift_certificate_amount": "0.0000",
"ip_address": "",
"ip_address_v6": "",
"geoip_country": "",
"geoip_country_iso2": "",
"currency_id": 1,
"currency_code": "USD",
"currency_exchange_rate": "1.0000000000",
"default_currency_id": 1,
"default_currency_code": "USD",
"staff_notes": "",
"customer_message": "",
"discount_amount": "5.0000",
"coupon_discount": "5.0000",
"shipping_address_count": 1,
"is_deleted": false,
"ebay_order_id": "0",
"cart_id": "7e48f7ef-2e88-4817-aea4-b0ed01490114",
"billing_address": {
"first_name": "Jane",
"last_name": "Doe",
"company": "",
"street_1": "555 East Street",
"street_2": "",
"city": "Austin",
"state": "Texas",
"zip": 78108,
"country": "United States",
"country_iso2": "US",
"phone": 1234567890,
"email": "janedoe@example.com",
"form_fields": [{ "name": "Delivery Instructions", "value": "Leave in backyard" }]
},
"is_email_opt_in": false,
"credit_card_type": null,
"order_source": "external",
"channel_id": 1,
"external_source": null,
"products": {
"url": "https://api.bigcommerce.com/stores/<your_store_hash>/v2/orders/218/products",
"resource": "/orders/218/products"
},
"shipping_addresses": {
"url": "https://api.bigcommerce.com/stores/<your_store_hash>/v2/orders/218/shippingaddresses",
"resource": "/orders/218/shippingaddresses"
},
"coupons": {
"url": "https://api.bigcommerce.com/stores/<your_store_hash>/v2/orders/218/coupons",
"resource": "/orders/218/coupons"
},
"external_id": null,
"external_merchant_id": null,
"tax_provider_id": "BasicTaxProvider",
"store_default_currency_code": "",
"store_default_to_transactional_exchange_rate": "1.0000000000",
"custom_status": "Awaiting Payment",
"customer_locale": "en"
}
json
When you have added your Webhook please confirm it works by clicking 'Check Integration' below:
Update Integration