Purchase Detail
Request Details
Item | Value |
Description | The purchase detail endpoint allows clients to request item level details for a specific purchase. Clients can get all of a member’s purchase history through the User Purchase History endpoint |
Method | GET |
Endpoint | https://[environment]pos[client_id].crowdtwist.com/purchase/[purchase_id]?purchase_id_type=receipt_id |
HTTP Header | X-CT-Authorization = CTApiKey [API Key] Note: there is a space between CTApiKey and the API Key value |
Request
Field Name | Sample Value | Required | Format | Description |
URL PARAMETERS | ||||
purchase_id | 67-98-72-899 | Yes | String | Identifies receipt or order id associated with the purchase. |
purchase_id_type | order_id receipt_id |
Yes | String | Identifies the type of purchase id being used for lookup. This value is returned by the User Purchase History API. |
QUERY PARAMETERS – none |
Response
Response Body
Field Name | Sample Value | Required | Format | Description |
third_party_receipt_id | 123ABC | Yes | String | The receipt id provided for this purchase. |
date_purchased | 2018-01-01T11:00:18Z | Yes | String | The date this purchase occurred in ISO 8601 format, this will be in UTC. |
channel | In Store | Yes | String | The channel that this purchase came through. |
coupons | See the COUPONS ARRAY section. | No | Array | The coupons used with this purchase. |
purchase_total | 400 | Yes | Integer | The total of all receipts in this purchase. |
currency | USD | Yes | String | The currency used for this purchase, provided as a currency code. |
base_points | 400 | Yes | Integer | The total number of points awarded for this purchase, excluding bonus points. |
bonus_points | 100 | Yes | Integer | The total number of bonus points awarded for this purchase. |
points_awarded | 500 | Yes | Integer | The total number of points awarded for this purchase. |
points_earned | 500 | Yes | Integer | The number of points earned for this purchase. A member may not be awarded all of the points they earned if a point cap is in place. |
custom_data | { “dataKey”: “dataValue”} | No | Object | Custom data provided for this purchase. |
items | See the ITEMS ARRAY section. | Yes | Array (Item Objects) | |
campaigns | See CAMPAIGNS ARRAY section. | No | Array | Present if and only if the item is associated with a bonus campaign. |
COUPONS ARRAY | ||||
coupon |
[
"coupon123456",
"coupon123789"
]
|
Yes | Array (Strings) | This is the list of coupons that are used in this transaction. |
ITEMS ARRAY | ||||
type | pending | Yes | String | The transaction type for this item. It can be : • purchased • pending • cancelled • fulfilled • returned |
sku | ABC123 | Yes | String | The sku of this item. |
quantity | 1 | Yes | Integer | The total quantity of this item that was purchased/returned/fulfilled/cancelled or is pending. |
price | 400 | Yes | Integer | The price of this item. The price is for a single quantity. |
points_awarded | 500 | Yes | Integer | The total number of points awarded for this item. |
points_earned | 500 | Yes | Integer | The number of points earned for this item. A member may not be awarded all of the points they earned if a point cap is in place. |
bonus_points | 100 | Yes | Integer | The total number of bonus points awarded for this item. |
base_points | 400 | Yes | Integer | The total number of points awarded for this item, excluding bonus points. |
is_excluded | true | Yes | Boolean | True if this item is part of an exclusion list and therefore ineligible for points. |
custom_data | { “dataKey”: “dataValue”} | No | Object | Custom data provided for this item. |
returns | See the RETURNS ARRAY section. | No | Array | Will store return information for one or more item. A particular item could be returned more than once at different points of time and different quantity. |
fulfillments | See the FULFILLMENTS ARRAY section. | No | Array | Fulfillments will return information on items which are either to be fulfilled, cancelled or pending depending on type. |
CAMPAIGNS ARRAY | ||||
title | BONUS CAMPAIGN | Yes | String | Title of the bonus campaign this item is a part of. |
multiplier | 2 | Yes | Decimal | Multiplier for any item in this bonus campaign. |
point_gift | 50 | Yes | Integer |
Point value for any item in this bonus campaign. Note: At a given time response can have either Point gift value or multiplier value. If you campaign is setup as points gift, then point_gift will have a value and multiplier will be null and vice versa. |
RETURNS ARRAY | ||||
return_id | return123 | No | String | Identifier of the return. |
date_occurred | 2018-01-01T11:00:18Z | No | String | Date when the item was returned, this will be returned in UTC. |
quantity_returned | 2 | No | Integer | Number of items returned. |
FULFILLMENTS ARRAY | ||||
fulfillment_id | ful3456 | No | String | Identifier for the fulfillment. |
date_occurred | 2018-01-01T11:00:18Z | No | String | Date when the item was fulfilled, this will be returned in UTC. |
quantity_fulfilled | 2 | No | Integer | Number of items fulfilled. |
Error Responses
Field Name | Sample Value | Required | Format | Description |
error | internal_error | Yes | String | The identifier of the category of the error. This gives the client the ability to categorize errors and make assumptions based on the identifier of the error. |
message | User could not be found | Yes | String | This is a detailed message around the error specifying, as specifically as possible, what the fields are that are missing or where exactly the error is. |
Error Response Codes
Error | Error Code | Description | Reason |
Input Error | 4xx | Returned whenever the request is missing required fields, including situations in which the body is malformed (e.g. HTTP method not supported, receipt not found, etc.). | – receipt_not_found – invalid |
Server Error | 5xx | HTTP error status code is returned due to an error that occurred in the backend. | – internal_error: unexpected error occurred in the CrowdTwist backend – not_configured: error occurs when an configuration has not been configured yet |
Example Response Codes
Response Code | Reason | Message |
404 | not_found | Receipt not found. |
400 | invalid_parameter | Purchase ID type is invalid. |
Samples
Sample Request
Sample Response Body
Sample Response Body – Item Went through Fulfillment
Sample Response Body – Returned Item
Sample Error Response