This set of API functions deals with managing customer order data.
Fields that are marked with [REQUIRED] are needed with the API function call. Other fields are optional.
READ (GET) - CREATE (POST) - UPDATE (PUT)
Fetch data on a single order placed by a customer. An order item usually contains order items as children to the order record.
https://reverbapi.trackstreet.com/api/v1/orders/<order_uuid>
Variable | Description |
---|---|
order_uuid | The internal universal unique ID for the order |
<?php // The consumer key and secret can be obtained from website settings in Reverb admin app $consumer_key = 'REVERB_API_CONSUMER_KEY'; $consumer_secret = 'REVERB_API_CONSUMER_SECRET'; // Build and make API call $order_uuid = 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'; $url = 'https://reverbapi.trackstreet.com/api/v1/orders/' . $order_uuid; // @link http://php.net/manual/en/function.curl-setopt.php $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, $url); curl_setopt($curl_handle, CURLOPT_USERPWD, $consumer_key . ':' . $consumer_secret); curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE); $response = curl_exec($curl_handle); curl_close($curl_handle); echo($response); ?>
{ "response": { "code": "200", "message": "OK: The request was successful. See response body for additional data.", "data": { "order": [ { "order_uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "order_date": "2014-03-14T05:49:54-07:00", "order_number": "12345", "coupon_used": "CPN20", "subtotal": "23.50", "customer_uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "customer_email": "jane@example.com", "customer_first_name": "Jane", "customer_last_name": "Doe", "order_items": [ { "product_id": "56789", "price": "10.50", "quantity": "1", "product_title": "Product Name One", "product_url": "http://www.website.com/product1", "product_image_url": "http://www.website.com/product1/image.jpg", }, { "product_id": "88789", "price": "13.00", "quantity": "1", "product_title": "Product Name Two", "product_url": "http://www.website.com/product2", "product_image_url": "http://www.website.com/product2/image.jpg", } ] } ] } } }
Create a new single record for an order placed by a customer.
https://reverbapi.trackstreet.com/api/v1/orders
Variable | Description |
---|---|
website_uuid | REQUIRED The internal universal unique ID for the website the customer belongs to |
customer_uuid | REQUIRED The internal universal unique ID for the customer who placed the order (create customer record before calling order API function) |
order_number | REQUIRED Your unique tracking string or number for the order |
subtotal | REQUIRED Subtotal for order (before discounts and taxes added to order) |
coupon_used | Coupon code used, or, a comma-separated list of coupon codes used with order |
order_items |
JSON array of items that were purchased as part of this order Order item properties:
|
referral_records [optional] |
JSON array of data each referral connected to this order (if it qualifies as a referred order) Referral properties:
|
<?php // The consumer key and secret can be obtained from website settings in Reverb admin app $consumer_key = 'REVERB_API_CONSUMER_KEY'; $consumer_secret = 'REVERB_API_CONSUMER_SECRET'; // Build and make API call $url = 'https://reverbapi.trackstreet.com/api/v1/orders'; $params_array = array( 'website_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'customer_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'order_number' => '367hg222', 'coupon_used' => 'COUPON20', 'subtotal' => '23.50', 'order_items' => array( array( 'product_id": "56789', 'price' => '10.50', 'quantity' => '1', 'product_title' => 'Product Name One', 'product_url' => 'http://www.website.com/product1', 'product_image_url' => 'http://www.website.com/product1/image.jpg', ), array( 'product_id' => '88789', 'price' => '13.00', 'quantity' => '1', 'product_title' => 'Product Name Two', 'product_url' => 'http://www.website.com/product2', 'product_image_url' => 'http://www.website.com/product2/image.jpg', ) ), 'referral_records' => array( array( 'campaign_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'level' => '1', 'referrer_email' => 'original1@customer.com' ), array( 'campaign_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'level' => '2', 'referrer_email' => 'original2@customer.com' ) ) ); $params = json_encode($params_array); $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, $url); curl_setopt($curl_handle, CURLOPT_USERPWD, $consumer_key . ':' . $consumer_secret); curl_setopt($curl_handle, CURLOPT_POST, 1); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $params); curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE); $response = curl_exec($curl_handle); curl_close($curl_handle); echo($response); ?>
{ "response": { "code": "200", "message": "OK: The request was successful. See response body for additional data.", "data": { "order": { "uuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", } } } }
Use this method to update an existing order's data with Reverb.
https://reverbapi.trackstreet.com/api/v1/orders/<order_uuid>
Variable | Description |
---|---|
website_uuid | The internal universal unique ID for the website the customer belongs to |
customer_uuid | The internal universal unique ID for the customer who placed the order (create customer record before calling order API function) |
order_number | Your tracking string or number that you use to with your system to keep track of order |
coupon_used | Coupon code used, or, a comma-separated list of coupon codes used with order |
subtotal | Subtotal for order (before discounts and taxes added to order) |
items |
JSON array of items that were purchased as part of this order Order item properties:
|
<?php // The consumer key and secret can be obtained from website settings in Reverb admin app $consumer_key = 'REVERB_API_CONSUMER_KEY'; $consumer_secret = 'REVERB_API_CONSUMER_SECRET'; $url = 'https://reverbapi.trackstreet.com/api/v1/orders/$order_uuid'; $params_array = array( 'website_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'customer_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'order_number' => '367hg222', 'coupon_used' => 'COUPON20', 'subtotal' => '23.50', 'items' => array( array( 'product_id": "56789', 'price' => '10.50', 'quantity' => '1', 'product_title' => 'Product Name One', 'product_url' => 'http://www.website.com/product1', 'product_image_url' => 'http://www.website.com/product1/image.jpg', ), array( 'product_id' => '88789', 'price' => '13.00', 'quantity' => '1', 'product_title' => 'Product Name Two', 'product_url' => 'http://www.website.com/product2', 'product_image_url' => 'http://www.website.com/product2/image.jpg', ) ), 'referral_records' => array( array( 'campaign_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'level' => '1', 'referrer_email' => 'original1@customer.com' ), array( 'campaign_uuid' => 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', 'level' => '2', 'referrer_email' => 'original2@customer.com' ) ) ); $params = json_encode($params_array); $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, $url); curl_setopt($curl_handle, CURLOPT_USERPWD, $consumer_key . ':' . $consumer_secret); curl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $params); curl_setopt($curl_handle, CURLOPT_FAILONERROR, FALSE); curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, TRUE); $response = curl_exec($curl_handle); curl_close($curl_handle); echo($response); ?>
{ "response": { "code": "200", "message": "OK: The request was successful.", } }