curl --request POST \
--url https://api.production.orderprotection.com/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"sourceOrderId": "#517AB",
"sourceOrderNumber": "#634C",
"sourceCreatedAt": "2000-05-15T21:00:00.000Z",
"currency": "USD",
"total": 15.4,
"subtotal": 11.3,
"customerEmail": "john@doe.com",
"customerName": "John",
"originalSourceOrderId": "12345",
"sourceUpdatedAt": "2000-05-15T21:00:00.000Z",
"sourceCancelledAt": "2000-05-15T21:00:00.000Z",
"policyCancelledAt": "2024-03-20T12:00:00.000Z",
"platformId": "api",
"premiumPaid": 1.5,
"premiumCost": 1,
"premiumDiscount": 1,
"discountTotal": 1.2,
"customerIp": "123.123.123.123",
"exchangeRate": 1.024,
"shippingCost": 3.5,
"tax": 0.55,
"customerPhone": "+1-555-796-3644",
"shippingCostTax": 234,
"orderItems": [
{
"productName": "Handcrafted Wooden Table",
"productUrl": "https://bogus-clarity.name/",
"productImage": "https://bogus-clarity.name/product/image.jpg",
"sku": "978-0-10-081434-9",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387179",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
},
{
"productName": "Another prod",
"productUrl": "https://test.site/",
"sku": "5555",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387180",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
}
],
"address": [
{
"firstName": "Milford",
"lastName": "Mayert",
"address1": "991 Nicolas Landing",
"city": "Rippinfurt",
"state": "AZ",
"zip": "08731",
"country": "US",
"type": "SHIPPING",
"address2": "Apt. 796",
"stateAbr": "AZ",
"lat": 40.7128,
"lng": -74.006
}
]
}
EOFimport requests
url = "https://api.production.orderprotection.com/v1/orders"
payload = {
"sourceOrderId": "#517AB",
"sourceOrderNumber": "#634C",
"sourceCreatedAt": "2000-05-15T21:00:00.000Z",
"currency": "USD",
"total": 15.4,
"subtotal": 11.3,
"customerEmail": "john@doe.com",
"customerName": "John",
"originalSourceOrderId": "12345",
"sourceUpdatedAt": "2000-05-15T21:00:00.000Z",
"sourceCancelledAt": "2000-05-15T21:00:00.000Z",
"policyCancelledAt": "2024-03-20T12:00:00.000Z",
"platformId": "api",
"premiumPaid": 1.5,
"premiumCost": 1,
"premiumDiscount": 1,
"discountTotal": 1.2,
"customerIp": "123.123.123.123",
"exchangeRate": 1.024,
"shippingCost": 3.5,
"tax": 0.55,
"customerPhone": "+1-555-796-3644",
"shippingCostTax": 234,
"orderItems": [
{
"productName": "Handcrafted Wooden Table",
"productUrl": "https://bogus-clarity.name/",
"productImage": "https://bogus-clarity.name/product/image.jpg",
"sku": "978-0-10-081434-9",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387179",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
},
{
"productName": "Another prod",
"productUrl": "https://test.site/",
"sku": "5555",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387180",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
}
],
"address": [
{
"firstName": "Milford",
"lastName": "Mayert",
"address1": "991 Nicolas Landing",
"city": "Rippinfurt",
"state": "AZ",
"zip": "08731",
"country": "US",
"type": "SHIPPING",
"address2": "Apt. 796",
"stateAbr": "AZ",
"lat": 40.7128,
"lng": -74.006
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sourceOrderId: '#517AB',
sourceOrderNumber: '#634C',
sourceCreatedAt: '2000-05-15T21:00:00.000Z',
currency: 'USD',
total: 15.4,
subtotal: 11.3,
customerEmail: 'john@doe.com',
customerName: 'John',
originalSourceOrderId: '12345',
sourceUpdatedAt: '2000-05-15T21:00:00.000Z',
sourceCancelledAt: '2000-05-15T21:00:00.000Z',
policyCancelledAt: '2024-03-20T12:00:00.000Z',
platformId: 'api',
premiumPaid: 1.5,
premiumCost: 1,
premiumDiscount: 1,
discountTotal: 1.2,
customerIp: '123.123.123.123',
exchangeRate: 1.024,
shippingCost: 3.5,
tax: 0.55,
customerPhone: '+1-555-796-3644',
shippingCostTax: 234,
orderItems: [
{
productName: 'Handcrafted Wooden Table',
productUrl: 'https://bogus-clarity.name/',
productImage: 'https://bogus-clarity.name/product/image.jpg',
sku: '978-0-10-081434-9',
quantity: 4,
price: 45.43,
sourceItemId: '387179',
sourceProductId: '477353',
sourceVariantId: '17742',
description: 'Variant: White Oak. Size: 10\'x10\''
},
{
productName: 'Another prod',
productUrl: 'https://test.site/',
sku: '5555',
quantity: 4,
price: 45.43,
sourceItemId: '387180',
sourceProductId: '477353',
sourceVariantId: '17742',
description: 'Variant: White Oak. Size: 10\'x10\''
}
],
address: [
{
firstName: 'Milford',
lastName: 'Mayert',
address1: '991 Nicolas Landing',
city: 'Rippinfurt',
state: 'AZ',
zip: '08731',
country: 'US',
type: 'SHIPPING',
address2: 'Apt. 796',
stateAbr: 'AZ',
lat: 40.7128,
lng: -74.006
}
]
})
};
fetch('https://api.production.orderprotection.com/v1/orders', 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://api.production.orderprotection.com/v1/orders",
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([
'sourceOrderId' => '#517AB',
'sourceOrderNumber' => '#634C',
'sourceCreatedAt' => '2000-05-15T21:00:00.000Z',
'currency' => 'USD',
'total' => 15.4,
'subtotal' => 11.3,
'customerEmail' => 'john@doe.com',
'customerName' => 'John',
'originalSourceOrderId' => '12345',
'sourceUpdatedAt' => '2000-05-15T21:00:00.000Z',
'sourceCancelledAt' => '2000-05-15T21:00:00.000Z',
'policyCancelledAt' => '2024-03-20T12:00:00.000Z',
'platformId' => 'api',
'premiumPaid' => 1.5,
'premiumCost' => 1,
'premiumDiscount' => 1,
'discountTotal' => 1.2,
'customerIp' => '123.123.123.123',
'exchangeRate' => 1.024,
'shippingCost' => 3.5,
'tax' => 0.55,
'customerPhone' => '+1-555-796-3644',
'shippingCostTax' => 234,
'orderItems' => [
[
'productName' => 'Handcrafted Wooden Table',
'productUrl' => 'https://bogus-clarity.name/',
'productImage' => 'https://bogus-clarity.name/product/image.jpg',
'sku' => '978-0-10-081434-9',
'quantity' => 4,
'price' => 45.43,
'sourceItemId' => '387179',
'sourceProductId' => '477353',
'sourceVariantId' => '17742',
'description' => 'Variant: White Oak. Size: 10\'x10\''
],
[
'productName' => 'Another prod',
'productUrl' => 'https://test.site/',
'sku' => '5555',
'quantity' => 4,
'price' => 45.43,
'sourceItemId' => '387180',
'sourceProductId' => '477353',
'sourceVariantId' => '17742',
'description' => 'Variant: White Oak. Size: 10\'x10\''
]
],
'address' => [
[
'firstName' => 'Milford',
'lastName' => 'Mayert',
'address1' => '991 Nicolas Landing',
'city' => 'Rippinfurt',
'state' => 'AZ',
'zip' => '08731',
'country' => 'US',
'type' => 'SHIPPING',
'address2' => 'Apt. 796',
'stateAbr' => 'AZ',
'lat' => 40.7128,
'lng' => -74.006
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.production.orderprotection.com/v1/orders"
payload := strings.NewReader("{\n \"sourceOrderId\": \"#517AB\",\n \"sourceOrderNumber\": \"#634C\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"currency\": \"USD\",\n \"total\": 15.4,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"premiumCost\": 1,\n \"premiumDiscount\": 1,\n \"discountTotal\": 1.2,\n \"customerIp\": \"123.123.123.123\",\n \"exchangeRate\": 1.024,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234,\n \"orderItems\": [\n {\n \"productName\": \"Handcrafted Wooden Table\",\n \"productUrl\": \"https://bogus-clarity.name/\",\n \"productImage\": \"https://bogus-clarity.name/product/image.jpg\",\n \"sku\": \"978-0-10-081434-9\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387179\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n },\n {\n \"productName\": \"Another prod\",\n \"productUrl\": \"https://test.site/\",\n \"sku\": \"5555\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387180\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n }\n ],\n \"address\": [\n {\n \"firstName\": \"Milford\",\n \"lastName\": \"Mayert\",\n \"address1\": \"991 Nicolas Landing\",\n \"city\": \"Rippinfurt\",\n \"state\": \"AZ\",\n \"zip\": \"08731\",\n \"country\": \"US\",\n \"type\": \"SHIPPING\",\n \"address2\": \"Apt. 796\",\n \"stateAbr\": \"AZ\",\n \"lat\": 40.7128,\n \"lng\": -74.006\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.production.orderprotection.com/v1/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sourceOrderId\": \"#517AB\",\n \"sourceOrderNumber\": \"#634C\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"currency\": \"USD\",\n \"total\": 15.4,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"premiumCost\": 1,\n \"premiumDiscount\": 1,\n \"discountTotal\": 1.2,\n \"customerIp\": \"123.123.123.123\",\n \"exchangeRate\": 1.024,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234,\n \"orderItems\": [\n {\n \"productName\": \"Handcrafted Wooden Table\",\n \"productUrl\": \"https://bogus-clarity.name/\",\n \"productImage\": \"https://bogus-clarity.name/product/image.jpg\",\n \"sku\": \"978-0-10-081434-9\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387179\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n },\n {\n \"productName\": \"Another prod\",\n \"productUrl\": \"https://test.site/\",\n \"sku\": \"5555\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387180\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n }\n ],\n \"address\": [\n {\n \"firstName\": \"Milford\",\n \"lastName\": \"Mayert\",\n \"address1\": \"991 Nicolas Landing\",\n \"city\": \"Rippinfurt\",\n \"state\": \"AZ\",\n \"zip\": \"08731\",\n \"country\": \"US\",\n \"type\": \"SHIPPING\",\n \"address2\": \"Apt. 796\",\n \"stateAbr\": \"AZ\",\n \"lat\": 40.7128,\n \"lng\": -74.006\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.production.orderprotection.com/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sourceOrderId\": \"#517AB\",\n \"sourceOrderNumber\": \"#634C\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"currency\": \"USD\",\n \"total\": 15.4,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"premiumCost\": 1,\n \"premiumDiscount\": 1,\n \"discountTotal\": 1.2,\n \"customerIp\": \"123.123.123.123\",\n \"exchangeRate\": 1.024,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234,\n \"orderItems\": [\n {\n \"productName\": \"Handcrafted Wooden Table\",\n \"productUrl\": \"https://bogus-clarity.name/\",\n \"productImage\": \"https://bogus-clarity.name/product/image.jpg\",\n \"sku\": \"978-0-10-081434-9\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387179\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n },\n {\n \"productName\": \"Another prod\",\n \"productUrl\": \"https://test.site/\",\n \"sku\": \"5555\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387180\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n }\n ],\n \"address\": [\n {\n \"firstName\": \"Milford\",\n \"lastName\": \"Mayert\",\n \"address1\": \"991 Nicolas Landing\",\n \"city\": \"Rippinfurt\",\n \"state\": \"AZ\",\n \"zip\": \"08731\",\n \"country\": \"US\",\n \"type\": \"SHIPPING\",\n \"address2\": \"Apt. 796\",\n \"stateAbr\": \"AZ\",\n \"lat\": 40.7128,\n \"lng\": -74.006\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "ok"
}{
"message": "Unauthorized",
"statusCode": 401
}{
"message": "order not found",
"error": "Not Found",
"statusCode": 404
}Create order
curl --request POST \
--url https://api.production.orderprotection.com/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data @- <<EOF
{
"sourceOrderId": "#517AB",
"sourceOrderNumber": "#634C",
"sourceCreatedAt": "2000-05-15T21:00:00.000Z",
"currency": "USD",
"total": 15.4,
"subtotal": 11.3,
"customerEmail": "john@doe.com",
"customerName": "John",
"originalSourceOrderId": "12345",
"sourceUpdatedAt": "2000-05-15T21:00:00.000Z",
"sourceCancelledAt": "2000-05-15T21:00:00.000Z",
"policyCancelledAt": "2024-03-20T12:00:00.000Z",
"platformId": "api",
"premiumPaid": 1.5,
"premiumCost": 1,
"premiumDiscount": 1,
"discountTotal": 1.2,
"customerIp": "123.123.123.123",
"exchangeRate": 1.024,
"shippingCost": 3.5,
"tax": 0.55,
"customerPhone": "+1-555-796-3644",
"shippingCostTax": 234,
"orderItems": [
{
"productName": "Handcrafted Wooden Table",
"productUrl": "https://bogus-clarity.name/",
"productImage": "https://bogus-clarity.name/product/image.jpg",
"sku": "978-0-10-081434-9",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387179",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
},
{
"productName": "Another prod",
"productUrl": "https://test.site/",
"sku": "5555",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387180",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
}
],
"address": [
{
"firstName": "Milford",
"lastName": "Mayert",
"address1": "991 Nicolas Landing",
"city": "Rippinfurt",
"state": "AZ",
"zip": "08731",
"country": "US",
"type": "SHIPPING",
"address2": "Apt. 796",
"stateAbr": "AZ",
"lat": 40.7128,
"lng": -74.006
}
]
}
EOFimport requests
url = "https://api.production.orderprotection.com/v1/orders"
payload = {
"sourceOrderId": "#517AB",
"sourceOrderNumber": "#634C",
"sourceCreatedAt": "2000-05-15T21:00:00.000Z",
"currency": "USD",
"total": 15.4,
"subtotal": 11.3,
"customerEmail": "john@doe.com",
"customerName": "John",
"originalSourceOrderId": "12345",
"sourceUpdatedAt": "2000-05-15T21:00:00.000Z",
"sourceCancelledAt": "2000-05-15T21:00:00.000Z",
"policyCancelledAt": "2024-03-20T12:00:00.000Z",
"platformId": "api",
"premiumPaid": 1.5,
"premiumCost": 1,
"premiumDiscount": 1,
"discountTotal": 1.2,
"customerIp": "123.123.123.123",
"exchangeRate": 1.024,
"shippingCost": 3.5,
"tax": 0.55,
"customerPhone": "+1-555-796-3644",
"shippingCostTax": 234,
"orderItems": [
{
"productName": "Handcrafted Wooden Table",
"productUrl": "https://bogus-clarity.name/",
"productImage": "https://bogus-clarity.name/product/image.jpg",
"sku": "978-0-10-081434-9",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387179",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
},
{
"productName": "Another prod",
"productUrl": "https://test.site/",
"sku": "5555",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387180",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
}
],
"address": [
{
"firstName": "Milford",
"lastName": "Mayert",
"address1": "991 Nicolas Landing",
"city": "Rippinfurt",
"state": "AZ",
"zip": "08731",
"country": "US",
"type": "SHIPPING",
"address2": "Apt. 796",
"stateAbr": "AZ",
"lat": 40.7128,
"lng": -74.006
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sourceOrderId: '#517AB',
sourceOrderNumber: '#634C',
sourceCreatedAt: '2000-05-15T21:00:00.000Z',
currency: 'USD',
total: 15.4,
subtotal: 11.3,
customerEmail: 'john@doe.com',
customerName: 'John',
originalSourceOrderId: '12345',
sourceUpdatedAt: '2000-05-15T21:00:00.000Z',
sourceCancelledAt: '2000-05-15T21:00:00.000Z',
policyCancelledAt: '2024-03-20T12:00:00.000Z',
platformId: 'api',
premiumPaid: 1.5,
premiumCost: 1,
premiumDiscount: 1,
discountTotal: 1.2,
customerIp: '123.123.123.123',
exchangeRate: 1.024,
shippingCost: 3.5,
tax: 0.55,
customerPhone: '+1-555-796-3644',
shippingCostTax: 234,
orderItems: [
{
productName: 'Handcrafted Wooden Table',
productUrl: 'https://bogus-clarity.name/',
productImage: 'https://bogus-clarity.name/product/image.jpg',
sku: '978-0-10-081434-9',
quantity: 4,
price: 45.43,
sourceItemId: '387179',
sourceProductId: '477353',
sourceVariantId: '17742',
description: 'Variant: White Oak. Size: 10\'x10\''
},
{
productName: 'Another prod',
productUrl: 'https://test.site/',
sku: '5555',
quantity: 4,
price: 45.43,
sourceItemId: '387180',
sourceProductId: '477353',
sourceVariantId: '17742',
description: 'Variant: White Oak. Size: 10\'x10\''
}
],
address: [
{
firstName: 'Milford',
lastName: 'Mayert',
address1: '991 Nicolas Landing',
city: 'Rippinfurt',
state: 'AZ',
zip: '08731',
country: 'US',
type: 'SHIPPING',
address2: 'Apt. 796',
stateAbr: 'AZ',
lat: 40.7128,
lng: -74.006
}
]
})
};
fetch('https://api.production.orderprotection.com/v1/orders', 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://api.production.orderprotection.com/v1/orders",
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([
'sourceOrderId' => '#517AB',
'sourceOrderNumber' => '#634C',
'sourceCreatedAt' => '2000-05-15T21:00:00.000Z',
'currency' => 'USD',
'total' => 15.4,
'subtotal' => 11.3,
'customerEmail' => 'john@doe.com',
'customerName' => 'John',
'originalSourceOrderId' => '12345',
'sourceUpdatedAt' => '2000-05-15T21:00:00.000Z',
'sourceCancelledAt' => '2000-05-15T21:00:00.000Z',
'policyCancelledAt' => '2024-03-20T12:00:00.000Z',
'platformId' => 'api',
'premiumPaid' => 1.5,
'premiumCost' => 1,
'premiumDiscount' => 1,
'discountTotal' => 1.2,
'customerIp' => '123.123.123.123',
'exchangeRate' => 1.024,
'shippingCost' => 3.5,
'tax' => 0.55,
'customerPhone' => '+1-555-796-3644',
'shippingCostTax' => 234,
'orderItems' => [
[
'productName' => 'Handcrafted Wooden Table',
'productUrl' => 'https://bogus-clarity.name/',
'productImage' => 'https://bogus-clarity.name/product/image.jpg',
'sku' => '978-0-10-081434-9',
'quantity' => 4,
'price' => 45.43,
'sourceItemId' => '387179',
'sourceProductId' => '477353',
'sourceVariantId' => '17742',
'description' => 'Variant: White Oak. Size: 10\'x10\''
],
[
'productName' => 'Another prod',
'productUrl' => 'https://test.site/',
'sku' => '5555',
'quantity' => 4,
'price' => 45.43,
'sourceItemId' => '387180',
'sourceProductId' => '477353',
'sourceVariantId' => '17742',
'description' => 'Variant: White Oak. Size: 10\'x10\''
]
],
'address' => [
[
'firstName' => 'Milford',
'lastName' => 'Mayert',
'address1' => '991 Nicolas Landing',
'city' => 'Rippinfurt',
'state' => 'AZ',
'zip' => '08731',
'country' => 'US',
'type' => 'SHIPPING',
'address2' => 'Apt. 796',
'stateAbr' => 'AZ',
'lat' => 40.7128,
'lng' => -74.006
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.production.orderprotection.com/v1/orders"
payload := strings.NewReader("{\n \"sourceOrderId\": \"#517AB\",\n \"sourceOrderNumber\": \"#634C\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"currency\": \"USD\",\n \"total\": 15.4,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"premiumCost\": 1,\n \"premiumDiscount\": 1,\n \"discountTotal\": 1.2,\n \"customerIp\": \"123.123.123.123\",\n \"exchangeRate\": 1.024,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234,\n \"orderItems\": [\n {\n \"productName\": \"Handcrafted Wooden Table\",\n \"productUrl\": \"https://bogus-clarity.name/\",\n \"productImage\": \"https://bogus-clarity.name/product/image.jpg\",\n \"sku\": \"978-0-10-081434-9\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387179\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n },\n {\n \"productName\": \"Another prod\",\n \"productUrl\": \"https://test.site/\",\n \"sku\": \"5555\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387180\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n }\n ],\n \"address\": [\n {\n \"firstName\": \"Milford\",\n \"lastName\": \"Mayert\",\n \"address1\": \"991 Nicolas Landing\",\n \"city\": \"Rippinfurt\",\n \"state\": \"AZ\",\n \"zip\": \"08731\",\n \"country\": \"US\",\n \"type\": \"SHIPPING\",\n \"address2\": \"Apt. 796\",\n \"stateAbr\": \"AZ\",\n \"lat\": 40.7128,\n \"lng\": -74.006\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.production.orderprotection.com/v1/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sourceOrderId\": \"#517AB\",\n \"sourceOrderNumber\": \"#634C\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"currency\": \"USD\",\n \"total\": 15.4,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"premiumCost\": 1,\n \"premiumDiscount\": 1,\n \"discountTotal\": 1.2,\n \"customerIp\": \"123.123.123.123\",\n \"exchangeRate\": 1.024,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234,\n \"orderItems\": [\n {\n \"productName\": \"Handcrafted Wooden Table\",\n \"productUrl\": \"https://bogus-clarity.name/\",\n \"productImage\": \"https://bogus-clarity.name/product/image.jpg\",\n \"sku\": \"978-0-10-081434-9\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387179\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n },\n {\n \"productName\": \"Another prod\",\n \"productUrl\": \"https://test.site/\",\n \"sku\": \"5555\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387180\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n }\n ],\n \"address\": [\n {\n \"firstName\": \"Milford\",\n \"lastName\": \"Mayert\",\n \"address1\": \"991 Nicolas Landing\",\n \"city\": \"Rippinfurt\",\n \"state\": \"AZ\",\n \"zip\": \"08731\",\n \"country\": \"US\",\n \"type\": \"SHIPPING\",\n \"address2\": \"Apt. 796\",\n \"stateAbr\": \"AZ\",\n \"lat\": 40.7128,\n \"lng\": -74.006\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.production.orderprotection.com/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sourceOrderId\": \"#517AB\",\n \"sourceOrderNumber\": \"#634C\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"currency\": \"USD\",\n \"total\": 15.4,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"premiumCost\": 1,\n \"premiumDiscount\": 1,\n \"discountTotal\": 1.2,\n \"customerIp\": \"123.123.123.123\",\n \"exchangeRate\": 1.024,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234,\n \"orderItems\": [\n {\n \"productName\": \"Handcrafted Wooden Table\",\n \"productUrl\": \"https://bogus-clarity.name/\",\n \"productImage\": \"https://bogus-clarity.name/product/image.jpg\",\n \"sku\": \"978-0-10-081434-9\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387179\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n },\n {\n \"productName\": \"Another prod\",\n \"productUrl\": \"https://test.site/\",\n \"sku\": \"5555\",\n \"quantity\": 4,\n \"price\": 45.43,\n \"sourceItemId\": \"387180\",\n \"sourceProductId\": \"477353\",\n \"sourceVariantId\": \"17742\",\n \"description\": \"Variant: White Oak. Size: 10'x10'\"\n }\n ],\n \"address\": [\n {\n \"firstName\": \"Milford\",\n \"lastName\": \"Mayert\",\n \"address1\": \"991 Nicolas Landing\",\n \"city\": \"Rippinfurt\",\n \"state\": \"AZ\",\n \"zip\": \"08731\",\n \"country\": \"US\",\n \"type\": \"SHIPPING\",\n \"address2\": \"Apt. 796\",\n \"stateAbr\": \"AZ\",\n \"lat\": 40.7128,\n \"lng\": -74.006\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"status": "ok"
}{
"message": "Unauthorized",
"statusCode": 401
}{
"message": "order not found",
"error": "Not Found",
"statusCode": 404
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Order ID on your platform
"#517AB"
Order Number on your platform
"#634C"
Creation date of the order on your platform
"2000-05-15T21:00:00.000Z"
Order currency
ADP, AED, AFA, AFN, ALK, ALL, AMD, ANG, AOA, AOK, AON, AOR, ARA, ARP, ARS, ARY, ATS, AUD, AWG, AYM, AZM, AZN, BAD, BAM, BBD, BDT, BEC, BEF, BEL, BGJ, BGK, BGL, BGN, BHD, BIF, BMD, BND, BOB, BOP, BOV, BRB, BRC, BRE, BRL, BRN, BRR, BSD, BTN, BUK, BWP, BYB, BYN, BYR, BZD, CAD, CDF, CHC, CHE, CHF, CHW, CLF, CLP, CNY, COP, COU, CRC, CSD, CSJ, CSK, CUC, CUP, CVE, CYP, CZK, DDM, DEM, DJF, DKK, DOP, DZD, ECS, ECV, EEK, EGP, ERN, ESA, ESB, ESP, ETB, EUR, FIM, FJD, FKP, FRF, GBP, GEK, GEL, GHC, GHP, GHS, GIP, GMD, GNE, GNF, GNS, GQE, GRD, GTQ, GWE, GWP, GYD, HKD, HNL, HRD, HRK, HTG, HUF, IDR, IEP, ILP, ILR, ILS, INR, IQD, IRR, ISJ, ISK, ITL, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAJ, LAK, LBP, LKR, LRD, LSL, LSM, LTL, LTT, LUC, LUF, LUL, LVL, LVR, LYD, MAD, MDL, MGA, MGF, MKD, MLF, MMK, MNT, MOP, MRO, MRU, MTL, MTP, MUR, MVQ, MVR, MWK, MXN, MXP, MXV, MYR, MZE, MZM, MZN, NAD, NGN, NIC, NIO, NLG, NOK, NPR, NZD, OMR, PAB, PEH, PEI, PEN, PES, PGK, PHP, PKR, PLN, PLZ, PTE, PYG, QAR, RHD, ROK, ROL, RON, RSD, RUB, RUR, RWF, SAR, SBD, SCR, SDD, SDG, SDP, SEK, SGD, SHP, SIT, SKK, SLL, SOS, SRD, SRG, SSP, STD, STN, SUR, SVC, SYP, SZL, THB, TJR, TJS, TMM, TMT, TND, TOP, TPE, TRL, TRY, TTD, TWD, TZS, UAH, UAK, UGS, UGW, UGX, USD, USN, USS, UYI, UYN, UYP, UYU, UYW, UZS, VEB, VEF, VES, VNC, VND, VUV, WST, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XDR, XEU, XFO, XFU, XOF, XPD, XPF, XPT, XRE, XSU, XTS, XUA, XXX, YDD, YER, YUD, YUM, YUN, ZAL, ZAR, ZMK, ZMW, ZRN, ZRZ, ZWC, ZWD, ZWL, ZWN, ZWR "USD"
Order total
15.4
Order subtotal
11.3
Customer email
"john@doe.com"
Customer name
"John"
If this was a replacement for another Order, you can include the original order id here.
"12345"
Updated date of the order on your platform
"2000-05-15T21:00:00.000Z"
Cancellation date of the order on your platform
"2000-05-15T21:00:00.000Z"
Date when the policy was cancelled
"2024-03-20T12:00:00.000Z"
Platform identifier
shopify, woocommerce, magento, bigcommerce, api "api"
Premium paid after discounts
1.5
Gross cost of revenue
1
Premium Discount
1
Order discount
1.2
Customer IP address
"123.123.123.123"
This should only be set if the store currency is USD and the order currency is not USD
1.024
Order shipping cost
3.5
Order tax
0.55
Customer phone number
"+1-555-796-3644"
Tax associated with shipping
234
Array of product items
Show child attributes
Show child attributes
[
{
"productName": "Handcrafted Wooden Table",
"productUrl": "https://bogus-clarity.name/",
"productImage": "https://bogus-clarity.name/product/image.jpg",
"sku": "978-0-10-081434-9",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387179",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
},
{
"productName": "Another prod",
"productUrl": "https://test.site/",
"sku": "5555",
"quantity": 4,
"price": 45.43,
"sourceItemId": "387180",
"sourceProductId": "477353",
"sourceVariantId": "17742",
"description": "Variant: White Oak. Size: 10'x10'"
}
]
Shipping or Billing Address
Show child attributes
Show child attributes
Response
The order passes validation and has been successfully created.
"ok"

