Skip to main content
PUT
/
v1
/
orders
/
{sourceOrderId}
Update order
curl --request PUT \
  --url https://api.production.orderprotection.com/v1/orders/{sourceOrderId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "sourceOrderNumber": "#634C",
  "currency": "USD",
  "policyCancelledAt": "2024-03-20T12:00:00.000Z",
  "originalSourceOrderId": "12345",
  "sourceCreatedAt": "2000-05-15T21:00:00.000Z",
  "sourceUpdatedAt": "2000-05-15T21:00:00.000Z",
  "sourceCancelledAt": "2000-05-15T21:00:00.000Z",
  "platformId": "api",
  "premiumPaid": 1.5,
  "total": 15.4,
  "discountTotal": 1.2,
  "shippingCost": 3.5,
  "tax": 0.55,
  "subtotal": 11.3,
  "customerEmail": "john@doe.com",
  "customerName": "John",
  "customerPhone": "+1-555-796-3644",
  "shippingCostTax": 234
}
'
import requests

url = "https://api.production.orderprotection.com/v1/orders/{sourceOrderId}"

payload = {
"sourceOrderNumber": "#634C",
"currency": "USD",
"policyCancelledAt": "2024-03-20T12:00:00.000Z",
"originalSourceOrderId": "12345",
"sourceCreatedAt": "2000-05-15T21:00:00.000Z",
"sourceUpdatedAt": "2000-05-15T21:00:00.000Z",
"sourceCancelledAt": "2000-05-15T21:00:00.000Z",
"platformId": "api",
"premiumPaid": 1.5,
"total": 15.4,
"discountTotal": 1.2,
"shippingCost": 3.5,
"tax": 0.55,
"subtotal": 11.3,
"customerEmail": "john@doe.com",
"customerName": "John",
"customerPhone": "+1-555-796-3644",
"shippingCostTax": 234
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
sourceOrderNumber: '#634C',
currency: 'USD',
policyCancelledAt: '2024-03-20T12:00:00.000Z',
originalSourceOrderId: '12345',
sourceCreatedAt: '2000-05-15T21:00:00.000Z',
sourceUpdatedAt: '2000-05-15T21:00:00.000Z',
sourceCancelledAt: '2000-05-15T21:00:00.000Z',
platformId: 'api',
premiumPaid: 1.5,
total: 15.4,
discountTotal: 1.2,
shippingCost: 3.5,
tax: 0.55,
subtotal: 11.3,
customerEmail: 'john@doe.com',
customerName: 'John',
customerPhone: '+1-555-796-3644',
shippingCostTax: 234
})
};

fetch('https://api.production.orderprotection.com/v1/orders/{sourceOrderId}', 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/{sourceOrderId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'sourceOrderNumber' => '#634C',
'currency' => 'USD',
'policyCancelledAt' => '2024-03-20T12:00:00.000Z',
'originalSourceOrderId' => '12345',
'sourceCreatedAt' => '2000-05-15T21:00:00.000Z',
'sourceUpdatedAt' => '2000-05-15T21:00:00.000Z',
'sourceCancelledAt' => '2000-05-15T21:00:00.000Z',
'platformId' => 'api',
'premiumPaid' => 1.5,
'total' => 15.4,
'discountTotal' => 1.2,
'shippingCost' => 3.5,
'tax' => 0.55,
'subtotal' => 11.3,
'customerEmail' => 'john@doe.com',
'customerName' => 'John',
'customerPhone' => '+1-555-796-3644',
'shippingCostTax' => 234
]),
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/{sourceOrderId}"

payload := strings.NewReader("{\n \"sourceOrderNumber\": \"#634C\",\n \"currency\": \"USD\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"total\": 15.4,\n \"discountTotal\": 1.2,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234\n}")

req, _ := http.NewRequest("PUT", 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.put("https://api.production.orderprotection.com/v1/orders/{sourceOrderId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sourceOrderNumber\": \"#634C\",\n \"currency\": \"USD\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"total\": 15.4,\n \"discountTotal\": 1.2,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.production.orderprotection.com/v1/orders/{sourceOrderId}")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"sourceOrderNumber\": \"#634C\",\n \"currency\": \"USD\",\n \"policyCancelledAt\": \"2024-03-20T12:00:00.000Z\",\n \"originalSourceOrderId\": \"12345\",\n \"sourceCreatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceUpdatedAt\": \"2000-05-15T21:00:00.000Z\",\n \"sourceCancelledAt\": \"2000-05-15T21:00:00.000Z\",\n \"platformId\": \"api\",\n \"premiumPaid\": 1.5,\n \"total\": 15.4,\n \"discountTotal\": 1.2,\n \"shippingCost\": 3.5,\n \"tax\": 0.55,\n \"subtotal\": 11.3,\n \"customerEmail\": \"john@doe.com\",\n \"customerName\": \"John\",\n \"customerPhone\": \"+1-555-796-3644\",\n \"shippingCostTax\": 234\n}"

response = http.request(request)
puts response.read_body
{
  "status": "ok"
}
{
"message": "'sourceOrderId' is required",
"statusCode": 400
}
{
"message": "Unauthorized",
"statusCode": 401
}
{
"message": "Not Found",
"error": "Not Found",
"statusCode": 404
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

sourceOrderId
string
required

Body

application/json
sourceOrderNumber
string
required

Order Number on your platform

Example:

"#634C"

currency
enum<string>
required

Order currency

Available options:
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,
CS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
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
Example:

"USD"

policyCancelledAt
string<date-time> | null

Date when the policy was cancelled

Example:

"2024-03-20T12:00:00.000Z"

originalSourceOrderId
string

If this was a replacement for another Order, you can include the original order id here

Example:

"12345"

sourceCreatedAt
string<date-time>

Creation date of the order on your platform

Example:

"2000-05-15T21:00:00.000Z"

sourceUpdatedAt
string<date-time>

Updated date of the order on your platform

Example:

"2000-05-15T21:00:00.000Z"

sourceCancelledAt
string<date-time>

Cancellation date of the order on your platform

Example:

"2000-05-15T21:00:00.000Z"

platformId
enum<string>

Platform identifier

Available options:
shopify,
woocommerce,
magento,
bigcommerce,
api
Example:

"api"

premiumPaid
number

Premium paid

Example:

1.5

total
number

Order total

Example:

15.4

discountTotal
number

Order discount

Example:

1.2

shippingCost
number

Order shipping cost

Example:

3.5

tax
number

Order tax

Example:

0.55

subtotal
number

Order subtotal

Example:

11.3

customerEmail
string

Customer email

Example:

"john@doe.com"

customerName
string

Customer name

Example:

"John"

customerPhone
string

Customer phone number

Example:

"+1-555-796-3644"

shippingCostTax
number

Tax associated with shipping

Example:

234

Response

The order has been successfully updated.

status
string
required
read-only
Example:

"ok"