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 _return = await client.returns.retrieve('returnId');
console.log(_return.id);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
)
return_ = client.returns.retrieve(
"returnId",
)
print(return_.id)package com.rye.example;
import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.returns.Return;
import com.rye.models.returns.ReturnRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();
Return return_ = client.returns().retrieve("returnId");
}
}curl https://staging.api.rye.com/api/v1/returns/$RETURN_ID \
-H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY"<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.rye.com/api/v1/returns/{returnId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://staging.api.rye.com/api/v1/returns/{returnId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
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/returns/{returnId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"updatedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"timeline": {
"requestedAt": "2023-11-07T05:31:56Z",
"failedAt": "2023-11-07T05:31:56Z",
"deniedAt": "2023-11-07T05:31:56Z",
"refundedAt": "2023-11-07T05:31:56Z",
"refundIssuedAt": "2023-11-07T05:31:56Z",
"returnApprovedAt": "2023-11-07T05:31:56Z"
},
"reason": "defective",
"checkoutIntentId": "<string>",
"orderId": "<string>",
"state": "requested",
"id": "<string>",
"refunds": [
{
"shopperRefundTotal": {
"currencyCode": "USD",
"amountSubunits": 1500
},
"refundedAt": "2023-11-07T05:31:56Z",
"id": "<string>"
}
],
"failure": {
"message": "<string>",
"code": "drawdown_credit_failed"
},
"denial": {
"reason": "final_sale",
"note": "<string>"
},
"nextAction": {
"type": "ship_items_to_merchant",
"shipItemsToMerchant": {
"label": {
"url": "<string>"
}
}
}
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}Returns
Get return
Fetch a Return by id. Tenancy is scoped to the authenticated developer.
GET
/
api
/
v1
/
returns
/
{returnId}
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 _return = await client.returns.retrieve('returnId');
console.log(_return.id);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
)
return_ = client.returns.retrieve(
"returnId",
)
print(return_.id)package com.rye.example;
import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.returns.Return;
import com.rye.models.returns.ReturnRetrieveParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();
Return return_ = client.returns().retrieve("returnId");
}
}curl https://staging.api.rye.com/api/v1/returns/$RETURN_ID \
-H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY"<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.rye.com/api/v1/returns/{returnId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://staging.api.rye.com/api/v1/returns/{returnId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<api-key>")
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/returns/{returnId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"updatedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"timeline": {
"requestedAt": "2023-11-07T05:31:56Z",
"failedAt": "2023-11-07T05:31:56Z",
"deniedAt": "2023-11-07T05:31:56Z",
"refundedAt": "2023-11-07T05:31:56Z",
"refundIssuedAt": "2023-11-07T05:31:56Z",
"returnApprovedAt": "2023-11-07T05:31:56Z"
},
"reason": "defective",
"checkoutIntentId": "<string>",
"orderId": "<string>",
"state": "requested",
"id": "<string>",
"refunds": [
{
"shopperRefundTotal": {
"currencyCode": "USD",
"amountSubunits": 1500
},
"refundedAt": "2023-11-07T05:31:56Z",
"id": "<string>"
}
],
"failure": {
"message": "<string>",
"code": "drawdown_credit_failed"
},
"denial": {
"reason": "final_sale",
"note": "<string>"
},
"nextAction": {
"type": "ship_items_to_merchant",
"shipItemsToMerchant": {
"label": {
"url": "<string>"
}
}
}
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}Response
OK
A single Return record. The state discriminator tells you which of
denial, failure, and refunds is populated; nextAction is set once the
Return is approved (see {@link NextActionResponse}).
Was this page helpful?

