JavaScript
import CheckoutIntents from 'checkout-intents';
const client = new CheckoutIntents({
apiKey: process.env['CHECKOUT_INTENTS_API_KEY'], // This is the default and can be omitted
});
const cancellation = await client.orders.cancel('id', {
reason: { code: 'requested_by_customer' },
});
console.log(cancellation);import os
from checkout_intents import CheckoutIntents
client = CheckoutIntents(
api_key=os.environ.get("CHECKOUT_INTENTS_API_KEY"), # This is the default and can be omitted
)
cancellation = client.orders.cancel(
id="id",
reason={
"code": "requested_by_customer"
},
)
print(cancellation)package com.rye.example;
import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.orders.Cancellation;
import com.rye.models.orders.OrderCancelParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();
OrderCancelParams params = OrderCancelParams.builder()
.id("id")
.reason(OrderCancelParams.Reason.builder()
.code(OrderCancelParams.Reason.Code.REQUESTED_BY_CUSTOMER)
.build())
.build();
Cancellation cancellation = client.orders().cancel(params);
}
}curl https://staging.api.rye.com/api/v1/orders/$ID/cancel \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY" \
-d '{
"reason": {
"code": "requested_by_customer"
}
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.rye.com/api/v1/orders/{id}/cancel",
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([
'reason' => [
'message' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://staging.api.rye.com/api/v1/orders/{id}/cancel"
payload := strings.NewReader("{\n \"reason\": {\n \"message\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}require 'uri'
require 'net/http'
url = URI("https://staging.api.rye.com/api/v1/orders/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": {\n \"message\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"reason": {
"message": "<string>"
},
"marketplaceOrderId": "<string>",
"checkoutIntentId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"state": "requested"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"status": 123,
"fields": {},
"stack": "<string>"
}Orders
Cancel order
Request cancellation of an order.
Order cancellations are subject to each merchant’s cancellation policy.
POST
/
api
/
v1
/
orders
/
{id}
/
cancel
JavaScript
import CheckoutIntents from 'checkout-intents';
const client = new CheckoutIntents({
apiKey: process.env['CHECKOUT_INTENTS_API_KEY'], // This is the default and can be omitted
});
const cancellation = await client.orders.cancel('id', {
reason: { code: 'requested_by_customer' },
});
console.log(cancellation);import os
from checkout_intents import CheckoutIntents
client = CheckoutIntents(
api_key=os.environ.get("CHECKOUT_INTENTS_API_KEY"), # This is the default and can be omitted
)
cancellation = client.orders.cancel(
id="id",
reason={
"code": "requested_by_customer"
},
)
print(cancellation)package com.rye.example;
import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.orders.Cancellation;
import com.rye.models.orders.OrderCancelParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();
OrderCancelParams params = OrderCancelParams.builder()
.id("id")
.reason(OrderCancelParams.Reason.builder()
.code(OrderCancelParams.Reason.Code.REQUESTED_BY_CUSTOMER)
.build())
.build();
Cancellation cancellation = client.orders().cancel(params);
}
}curl https://staging.api.rye.com/api/v1/orders/$ID/cancel \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY" \
-d '{
"reason": {
"code": "requested_by_customer"
}
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.rye.com/api/v1/orders/{id}/cancel",
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([
'reason' => [
'message' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://staging.api.rye.com/api/v1/orders/{id}/cancel"
payload := strings.NewReader("{\n \"reason\": {\n \"message\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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))
}require 'uri'
require 'net/http'
url = URI("https://staging.api.rye.com/api/v1/orders/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": {\n \"message\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"reason": {
"message": "<string>"
},
"marketplaceOrderId": "<string>",
"checkoutIntentId": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"state": "requested"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"status": 123,
"fields": {},
"stack": "<string>"
}Authorizations
Rye API key
Path Parameters
The order id
Body
application/json
The cancellation reason (code + optional note)
Show child attributes
Show child attributes
Was this page helpful?
⌘I

