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 checkoutSession = await client.betas.checkoutSessions.create({
productUrl: 'https://www.amazon.com/dp/B0DFC9MT8Q',
quantity: 1,
});
console.log(checkoutSession.url);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
)
checkout_session = client.betas.checkout_sessions.create(
product_url="https://www.amazon.com/dp/B0DFC9MT8Q",
quantity=1,
)
print(checkout_session.url)package com.rye.example;
import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.betas.CheckoutSession;
import com.rye.models.betas.checkoutsessions.CheckoutSessionCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();
CheckoutSessionCreateParams params = CheckoutSessionCreateParams.builder()
.productUrl("https://www.amazon.com/dp/B0DFC9MT8Q")
.quantity(1)
.build();
CheckoutSession checkoutSession = client.betas().checkoutSessions().create(params);
}
}curl https://staging.api.rye.com/api/v1/betas/checkout-sessions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY" \
-d '{
"productUrl": "https://www.amazon.com/dp/B0DFC9MT8Q",
"quantity": 1,
"referenceId": "order-1234"
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.rye.com/api/v1/betas/checkout-sessions",
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([
'productUrl' => 'https://www.amazon.com/dp/B0DFC9MT8Q',
'quantity' => 1,
'variantSelections' => [
[
'value' => 'Small, Red, XS, L, etc.',
'label' => 'Size, Color, etc.'
]
],
'promoCodes' => [
'<string>'
],
'constraints' => [
'offerRetrievalEffort' => 'max',
'maxShippingPrice' => 500,
'maxTotalPrice' => 100000
],
'discoverPromoCodes' => true,
'referenceId' => 'order-1234',
'buyer' => [
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john.doe@example.com',
'phone' => '1234567890',
'address1' => '123 Main St',
'address2' => 'Apt 1',
'city' => 'New York',
'province' => 'NY',
'country' => 'US',
'postalCode' => '10001'
]
]),
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/betas/checkout-sessions"
payload := strings.NewReader("{\n \"productUrl\": \"https://www.amazon.com/dp/B0DFC9MT8Q\",\n \"quantity\": 1,\n \"variantSelections\": [\n {\n \"value\": \"Small, Red, XS, L, etc.\",\n \"label\": \"Size, Color, etc.\"\n }\n ],\n \"promoCodes\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"offerRetrievalEffort\": \"max\",\n \"maxShippingPrice\": 500,\n \"maxTotalPrice\": 100000\n },\n \"discoverPromoCodes\": true,\n \"referenceId\": \"order-1234\",\n \"buyer\": {\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"phone\": \"1234567890\",\n \"address1\": \"123 Main St\",\n \"address2\": \"Apt 1\",\n \"city\": \"New York\",\n \"province\": \"NY\",\n \"country\": \"US\",\n \"postalCode\": \"10001\"\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/betas/checkout-sessions")
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 \"productUrl\": \"https://www.amazon.com/dp/B0DFC9MT8Q\",\n \"quantity\": 1,\n \"variantSelections\": [\n {\n \"value\": \"Small, Red, XS, L, etc.\",\n \"label\": \"Size, Color, etc.\"\n }\n ],\n \"promoCodes\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"offerRetrievalEffort\": \"max\",\n \"maxShippingPrice\": 500,\n \"maxTotalPrice\": 100000\n },\n \"discoverPromoCodes\": true,\n \"referenceId\": \"order-1234\",\n \"buyer\": {\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"phone\": \"1234567890\",\n \"address1\": \"123 Main St\",\n \"address2\": \"Apt 1\",\n \"city\": \"New York\",\n \"province\": \"NY\",\n \"country\": \"US\",\n \"postalCode\": \"10001\"\n }\n}"
response = http.request(request)
puts response.read_body{
"url": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"status": 123,
"fields": {},
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}Create checkout session
Create a new checkout session.
Checkout sessions are hosted checkout forms your shoppers can use to complete their purchases.
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 checkoutSession = await client.betas.checkoutSessions.create({
productUrl: 'https://www.amazon.com/dp/B0DFC9MT8Q',
quantity: 1,
});
console.log(checkoutSession.url);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
)
checkout_session = client.betas.checkout_sessions.create(
product_url="https://www.amazon.com/dp/B0DFC9MT8Q",
quantity=1,
)
print(checkout_session.url)package com.rye.example;
import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.betas.CheckoutSession;
import com.rye.models.betas.checkoutsessions.CheckoutSessionCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();
CheckoutSessionCreateParams params = CheckoutSessionCreateParams.builder()
.productUrl("https://www.amazon.com/dp/B0DFC9MT8Q")
.quantity(1)
.build();
CheckoutSession checkoutSession = client.betas().checkoutSessions().create(params);
}
}curl https://staging.api.rye.com/api/v1/betas/checkout-sessions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY" \
-d '{
"productUrl": "https://www.amazon.com/dp/B0DFC9MT8Q",
"quantity": 1,
"referenceId": "order-1234"
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://staging.api.rye.com/api/v1/betas/checkout-sessions",
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([
'productUrl' => 'https://www.amazon.com/dp/B0DFC9MT8Q',
'quantity' => 1,
'variantSelections' => [
[
'value' => 'Small, Red, XS, L, etc.',
'label' => 'Size, Color, etc.'
]
],
'promoCodes' => [
'<string>'
],
'constraints' => [
'offerRetrievalEffort' => 'max',
'maxShippingPrice' => 500,
'maxTotalPrice' => 100000
],
'discoverPromoCodes' => true,
'referenceId' => 'order-1234',
'buyer' => [
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john.doe@example.com',
'phone' => '1234567890',
'address1' => '123 Main St',
'address2' => 'Apt 1',
'city' => 'New York',
'province' => 'NY',
'country' => 'US',
'postalCode' => '10001'
]
]),
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/betas/checkout-sessions"
payload := strings.NewReader("{\n \"productUrl\": \"https://www.amazon.com/dp/B0DFC9MT8Q\",\n \"quantity\": 1,\n \"variantSelections\": [\n {\n \"value\": \"Small, Red, XS, L, etc.\",\n \"label\": \"Size, Color, etc.\"\n }\n ],\n \"promoCodes\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"offerRetrievalEffort\": \"max\",\n \"maxShippingPrice\": 500,\n \"maxTotalPrice\": 100000\n },\n \"discoverPromoCodes\": true,\n \"referenceId\": \"order-1234\",\n \"buyer\": {\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"phone\": \"1234567890\",\n \"address1\": \"123 Main St\",\n \"address2\": \"Apt 1\",\n \"city\": \"New York\",\n \"province\": \"NY\",\n \"country\": \"US\",\n \"postalCode\": \"10001\"\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/betas/checkout-sessions")
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 \"productUrl\": \"https://www.amazon.com/dp/B0DFC9MT8Q\",\n \"quantity\": 1,\n \"variantSelections\": [\n {\n \"value\": \"Small, Red, XS, L, etc.\",\n \"label\": \"Size, Color, etc.\"\n }\n ],\n \"promoCodes\": [\n \"<string>\"\n ],\n \"constraints\": {\n \"offerRetrievalEffort\": \"max\",\n \"maxShippingPrice\": 500,\n \"maxTotalPrice\": 100000\n },\n \"discoverPromoCodes\": true,\n \"referenceId\": \"order-1234\",\n \"buyer\": {\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"email\": \"john.doe@example.com\",\n \"phone\": \"1234567890\",\n \"address1\": \"123 Main St\",\n \"address2\": \"Apt 1\",\n \"city\": \"New York\",\n \"province\": \"NY\",\n \"country\": \"US\",\n \"postalCode\": \"10001\"\n }\n}"
response = http.request(request)
puts response.read_body{
"url": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"status": 123,
"fields": {},
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}Authorizations
Rye API key
Body
The request body containing the checkout session parameters
"https://www.amazon.com/dp/B0DFC9MT8Q"
x >= 01
Show child attributes
Show child attributes
16Show child attributes
Show child attributes
255"order-1234"
Optional layout for the checkout UI (e.g. "wizard"). Defaults to the standard layout.
default, wizard Optional buyer information, used to pre-fill the checkout form with the buyer's information.
Show child attributes
Show child attributes
Response
Checkout session
A checkout session represents a hosted checkout form that shoppers can use to complete their purchases.
Checkout sessions provide a pre-built UI for collecting payment and shipping information, allowing you to quickly integrate checkout functionality without building your own forms.
URL to send your user to for checkout. This URL is valid for 4 hours.
Was this page helpful?

