/pre-orders
Last updated
Last updated
As well as including your store's public API key as an api_key
query parameter in all requests, this endpoint requires a few other parameters:
api_key
email
This is the email of the shopper you're looking up the info for
timestamp
This is the browser timestamp in the epoch format
token
token
Purple Dot expects a SHA-256 hash of the email
and the timestamp
in the following format:
<email>:<timestamp>
This allows us to verify the integrity and authenticity of the request by having it securely assigned using a shared secret. The generated token will only be valid for 10 seconds within the timestamp; to make the same API call for updated data, a new token must be generated.
You can generate the token within a Shopify theme in a .liquid
file as shown below:
If testing this in an API tool like Postman, you can generate the token using a pre-request script. Within Postman, you can import the crypto-js
library, which simplifies some of the token generation
Get all pre-orders for a given shopper email address.
Request:
limit
(number) - The number of pre-orders to retrieve. By default, it's set to 10 but can be set up to 100
starting_after
(UUID) - Paginate pre-orders after the given pre-order ID
Response:
orders
- An array containing all the pre-orders
id
- The Purple Dot ID of the pre-order
reference
- The Purple Dot reference number of the pre-order
created_at
- ISO8610 timestamp of when the pre-order was placed
total_amount
- The pre-order total
currency
- The presentment currency of the pre-order
line_items
- Array of line items
id
- The Purple Dot ID of the line item
estimated_ship_dates
- The estimated ship dates of the line item
product_id
- The Shopify ID of the line item's product
variant_id
- The Shopify ID of the line item's product variant
order_id
- The Shopify order ID in (this will be null
if the preorder/line-item is not exported to Shopify)
cancelled
- Whether the line item is cancelled
shipping_address
first_name
last_name
address1
address2
city
postal_code
province_code
- The ISO3166 code of the second level administrative subdivision
country_code
- The ISO3166 code of the country
phone
has_more
- Indicates whether there are more pre-orders available to page through
starting_after
- The ID of the last pre-order in the list which can then be used in the next request
Examples:
This is available on the page on your merchant portal under 'Public API Key'
This is the security signature that Purple Dot uses to verify the authenticity of the request. This is generated by hashing the email
and the timestamp
against the 'Shared secret' found on the page. More on how to generate this token .
To generate the token using Javascipt and the native , you can add the following <script>
to an HTML file: