Getting Started With the Cart API

Authentication/Setup

Set the request headers of all API requests to the following:

content-type: application/json

x-authorization: <api-key>

📘

You must replace api-key with your personal API key.

Initial data

When a customer is dropped onto your store from the app, there will be multiple parameters in the link address. You will then need to URI Decode these parameters and use them for your on-store experience. The parameters are as follows:

URL ParametersDescription
loop_return_ida UUID that is unique per order lookup
loop_currencythe currency the original order was made in
loop_totaltotal credit after tax in cents
loop_basetotal credit without tax
loop_creditamount of bonus credit
loop_domainthe domain the user came from
loop_subdomainLoop's subdomain for you
loop_redirect_uriredirect link back to the app
loop_customer_namename of customer on the original order
loop_experiment_b_eligibleboolean that informs you if this return is included in Loop's new On-Store flow
loop_single_item_eligibleboolean that informs you if this return only has a single eligible item
utm_redirectredirect source used for analytics

Example URL:

https://example.myshopify.com/?loop_total=1299&loop_base=799&loop_credit=500&loop_subdomain=example&loop_redirect_url=example.loopreturns.com%2F%23%2Fcredit&loop_customer_name=Jane%20Doe&loop_experiment_b_eligible=true&loop_single_item_eligible=false&utm_redirect=Loop_Returns

Example of data after decoding:

{
  "loop_return_id": "e1d10005-ec40-47da-b47b-424c4b19f11c",
  "loop_currency": "USD",
  "loop_total": 1299,
  "loop_base": 799,
  "loop_credit": 500,
  "loop_domain": "example.loopreturns.com",
  "loop_subdomain": "example",
  "loop_redirect_uri": "example.loopreturns.com/#/credit",
  "loop_customer_name": "Jane Doe",
  "loop_experiment_b_eligible": true,
  "loop_single_item_eligible": false
}