Skip to main content
POST
/
v2
/
order_events
Create order events
curl --request POST \
  --url https://dev.sbx.imprint.co/v2/order_events \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "order_id": "77f60af4-185e-4867-b113-34e3cf7c6acd",
  "type": "CAPTURED",
  "amount": 274999,
  "network_transaction_id": "615e3ba0-6b99-495b-ade4-1f584c40f376",
  "order_event_id": "77f60af4-185e-4867-b113-34e3cf7c6acd",
  "partner_event_id": "7622c07d-eb2b-4345-a9a9-345d61d32bc2",
  "rewards_amount": 2500,
  "currency": "USD",
  "order_lines": [
    {
      "name": "Couch Supreme",
      "product_url": "www.restassured.com/couch-supreme",
      "quantity": 1,
      "rate": 274999,
      "rewards_rate": 2500
    }
  ]
}
'
import requests

url = "https://dev.sbx.imprint.co/v2/order_events"

payload = {
"order_id": "77f60af4-185e-4867-b113-34e3cf7c6acd",
"type": "CAPTURED",
"amount": 274999,
"network_transaction_id": "615e3ba0-6b99-495b-ade4-1f584c40f376",
"order_event_id": "77f60af4-185e-4867-b113-34e3cf7c6acd",
"partner_event_id": "7622c07d-eb2b-4345-a9a9-345d61d32bc2",
"rewards_amount": 2500,
"currency": "USD",
"order_lines": [
{
"name": "Couch Supreme",
"product_url": "www.restassured.com/couch-supreme",
"quantity": 1,
"rate": 274999,
"rewards_rate": 2500
}
]
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
order_id: '77f60af4-185e-4867-b113-34e3cf7c6acd',
type: 'CAPTURED',
amount: 274999,
network_transaction_id: '615e3ba0-6b99-495b-ade4-1f584c40f376',
order_event_id: '77f60af4-185e-4867-b113-34e3cf7c6acd',
partner_event_id: '7622c07d-eb2b-4345-a9a9-345d61d32bc2',
rewards_amount: 2500,
currency: 'USD',
order_lines: [
{
name: 'Couch Supreme',
product_url: 'www.restassured.com/couch-supreme',
quantity: 1,
rate: 274999,
rewards_rate: 2500
}
]
})
};

fetch('https://dev.sbx.imprint.co/v2/order_events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://dev.sbx.imprint.co/v2/order_events",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'order_id' => '77f60af4-185e-4867-b113-34e3cf7c6acd',
'type' => 'CAPTURED',
'amount' => 274999,
'network_transaction_id' => '615e3ba0-6b99-495b-ade4-1f584c40f376',
'order_event_id' => '77f60af4-185e-4867-b113-34e3cf7c6acd',
'partner_event_id' => '7622c07d-eb2b-4345-a9a9-345d61d32bc2',
'rewards_amount' => 2500,
'currency' => 'USD',
'order_lines' => [
[
'name' => 'Couch Supreme',
'product_url' => 'www.restassured.com/couch-supreme',
'quantity' => 1,
'rate' => 274999,
'rewards_rate' => 2500
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://dev.sbx.imprint.co/v2/order_events"

payload := strings.NewReader("{\n \"order_id\": \"77f60af4-185e-4867-b113-34e3cf7c6acd\",\n \"type\": \"CAPTURED\",\n \"amount\": 274999,\n \"network_transaction_id\": \"615e3ba0-6b99-495b-ade4-1f584c40f376\",\n \"order_event_id\": \"77f60af4-185e-4867-b113-34e3cf7c6acd\",\n \"partner_event_id\": \"7622c07d-eb2b-4345-a9a9-345d61d32bc2\",\n \"rewards_amount\": 2500,\n \"currency\": \"USD\",\n \"order_lines\": [\n {\n \"name\": \"Couch Supreme\",\n \"product_url\": \"www.restassured.com/couch-supreme\",\n \"quantity\": 1,\n \"rate\": 274999,\n \"rewards_rate\": 2500\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://dev.sbx.imprint.co/v2/order_events")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"order_id\": \"77f60af4-185e-4867-b113-34e3cf7c6acd\",\n \"type\": \"CAPTURED\",\n \"amount\": 274999,\n \"network_transaction_id\": \"615e3ba0-6b99-495b-ade4-1f584c40f376\",\n \"order_event_id\": \"77f60af4-185e-4867-b113-34e3cf7c6acd\",\n \"partner_event_id\": \"7622c07d-eb2b-4345-a9a9-345d61d32bc2\",\n \"rewards_amount\": 2500,\n \"currency\": \"USD\",\n \"order_lines\": [\n {\n \"name\": \"Couch Supreme\",\n \"product_url\": \"www.restassured.com/couch-supreme\",\n \"quantity\": 1,\n \"rate\": 274999,\n \"rewards_rate\": 2500\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://dev.sbx.imprint.co/v2/order_events")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"order_id\": \"77f60af4-185e-4867-b113-34e3cf7c6acd\",\n \"type\": \"CAPTURED\",\n \"amount\": 274999,\n \"network_transaction_id\": \"615e3ba0-6b99-495b-ade4-1f584c40f376\",\n \"order_event_id\": \"77f60af4-185e-4867-b113-34e3cf7c6acd\",\n \"partner_event_id\": \"7622c07d-eb2b-4345-a9a9-345d61d32bc2\",\n \"rewards_amount\": 2500,\n \"currency\": \"USD\",\n \"order_lines\": [\n {\n \"name\": \"Couch Supreme\",\n \"product_url\": \"www.restassured.com/couch-supreme\",\n \"quantity\": 1,\n \"rate\": 274999,\n \"rewards_rate\": 2500\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "order_id": "77f60af4-185e-4867-b113-34e3cf7c6acd",
  "type": "CAPTURED",
  "amount": 274999,
  "network_transaction_id": "615e3ba0-6b99-495b-ade4-1f584c40f376",
  "order_event_id": "77f60af4-185e-4867-b113-34e3cf7c6acd",
  "partner_event_id": "7622c07d-eb2b-4345-a9a9-345d61d32bc2",
  "rewards_amount": 2500,
  "currency": "USD",
  "order_lines": [
    {
      "name": "Couch Supreme",
      "product_url": "www.restassured.com/couch-supreme",
      "quantity": 1,
      "rate": 274999,
      "rewards_rate": 2500
    }
  ]
}

Authorizations

Authorization
string
header
required

Basic HTTP authentication. Allowed headers-- Authorization: Basic <base64(api_key_id:api_key_secret)>

Body

application/json
order_id
string
required

The ID of the order to which the event is related

Example:

"77f60af4-185e-4867-b113-34e3cf7c6acd"

type
enum<string>
required

Type of order event

Available options:
CAPTURED,
REFUNDED
Example:

"CAPTURED"

amount
integer
required

Total event amount ($2,699.99 + $50.00)

Example:

274999

network_transaction_id
string
required

Card network transaction identifier

Example:

"615e3ba0-6b99-495b-ade4-1f584c40f376"

order_event_id
string

The ID of the order event

Example:

"77f60af4-185e-4867-b113-34e3cf7c6acd"

partner_event_id
string

Partner's event identifier

Example:

"7622c07d-eb2b-4345-a9a9-345d61d32bc2"

rewards_amount
integer

Total rewards amount for the event ($25 + $0)

Example:

2500

currency
string

The 3-character currency code of the amount in ISO 4217 format (e.g., "USD")

Example:

"USD"

order_lines
object[]

When provided, the API will require that the calculated sum of all the rates and rewards rates within (taking quantities into account) are equal to the amount and rewards_amount, respectively. It is important to note that the sums of all event amounts and event rewards amounts belonging to an order do not need to be equal to total_order_amount and total_rewards_amount in the order, as the data contained in events will serve as the final source of truth for the lifecycle of the order, as it actually transpired.

Example:
[
{
"name": "Couch Supreme",
"product_url": "www.restassured.com/couch-supreme",
"quantity": 1,
"rate": 274999,
"rewards_rate": 2500
}
]

Response

200 - application/json

Order event created successfully

order_id
string
required

The ID of the order to which the event is related

Example:

"77f60af4-185e-4867-b113-34e3cf7c6acd"

type
enum<string>
required

Type of order event

Available options:
CAPTURED,
REFUNDED
Example:

"CAPTURED"

amount
integer
required

Total event amount ($2,699.99 + $50.00)

Example:

274999

network_transaction_id
string
required

Card network transaction identifier

Example:

"615e3ba0-6b99-495b-ade4-1f584c40f376"

order_event_id
string

The ID of the order event

Example:

"77f60af4-185e-4867-b113-34e3cf7c6acd"

partner_event_id
string

Partner's event identifier

Example:

"7622c07d-eb2b-4345-a9a9-345d61d32bc2"

rewards_amount
integer

Total rewards amount for the event ($25 + $0)

Example:

2500

currency
string

The 3-character currency code of the amount in ISO 4217 format (e.g., "USD")

Example:

"USD"

order_lines
object[]

When provided, the API will require that the calculated sum of all the rates and rewards rates within (taking quantities into account) are equal to the amount and rewards_amount, respectively. It is important to note that the sums of all event amounts and event rewards amounts belonging to an order do not need to be equal to total_order_amount and total_rewards_amount in the order, as the data contained in events will serve as the final source of truth for the lifecycle of the order, as it actually transpired.

Example:
[
{
"name": "Couch Supreme",
"product_url": "www.restassured.com/couch-supreme",
"quantity": 1,
"rate": 274999,
"rewards_rate": 2500
}
]