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 checkoutIntent = await client.checkoutIntents.purchase({
buyer: {
address1: '123 Main St',
city: 'New York',
country: 'US',
email: 'john.doe@example.com',
firstName: 'John',
lastName: 'Doe',
phone: '1234567890',
postalCode: '10001',
province: 'NY',
},
paymentMethod: { stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH', type: 'stripe_token' },
productUrl: 'https://www.amazon.com/dp/B0DFC9MT8Q',
quantity: 1,
});
console.log(checkoutIntent);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_intent = client.checkout_intents.purchase(
buyer={
"address1": "123 Main St",
"city": "New York",
"country": "US",
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "1234567890",
"postal_code": "10001",
"province": "NY",
},
payment_method={
"stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
"type": "stripe_token",
},
product_url="https://www.amazon.com/dp/B0DFC9MT8Q",
quantity=1,
)
print(checkout_intent)package com.rye.example;
import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.checkoutintents.Buyer;
import com.rye.models.checkoutintents.CheckoutIntent;
import com.rye.models.checkoutintents.CheckoutIntentPurchaseParams;
import com.rye.models.checkoutintents.PaymentMethod;
public final class Main {
private Main() {}
public static void main(String[] args) {
CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();
CheckoutIntentPurchaseParams params = CheckoutIntentPurchaseParams.builder()
.buyer(Buyer.builder()
.address1("123 Main St")
.city("New York")
.country("US")
.email("john.doe@example.com")
.firstName("John")
.lastName("Doe")
.phone("1234567890")
.postalCode("10001")
.province("NY")
.build())
.paymentMethod(PaymentMethod.StripeTokenPaymentMethod.builder()
.stripeToken("tok_1RkrWWHGDlstla3f1Fc7ZrhH")
.type(PaymentMethod.StripeTokenPaymentMethod.Type.STRIPE_TOKEN)
.build())
.productUrl("https://www.amazon.com/dp/B0DFC9MT8Q")
.quantity(1)
.build();
CheckoutIntent checkoutIntent = client.checkoutIntents().purchase(params);
}
}curl https://staging.api.rye.com/api/v1/checkout-intents/purchase \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY" \
-d '{
"buyer": {
"address1": "123 Main St",
"city": "New York",
"country": "US",
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"phone": "1234567890",
"postalCode": "10001",
"province": "NY"
},
"paymentMethod": {
"stripeToken": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
"type": "stripe_token"
},
"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/checkout-intents/purchase",
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([
'buyer' => [
'postalCode' => '10001',
'country' => 'US',
'province' => 'NY',
'city' => 'New York',
'address1' => '123 Main St',
'phone' => '1234567890',
'email' => 'john.doe@example.com',
'lastName' => 'Doe',
'firstName' => 'John',
'address2' => 'Apt 1'
],
'quantity' => 1,
'productUrl' => 'https://www.amazon.com/dp/B0DFC9MT8Q',
'paymentMethod' => [
'stripeToken' => 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
'type' => 'stripe_token'
],
'referenceId' => 'order-1234',
'discoverPromoCodes' => true,
'constraints' => [
'offerRetrievalEffort' => 'max',
'maxShippingPrice' => 500,
'maxTotalPrice' => 100000
],
'promoCodes' => [
'SAVE20'
],
'variantSelections' => [
[
'value' => 'Small, Red, XS, L, etc.',
'label' => 'Size, Color, etc.'
]
]
]),
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/checkout-intents/purchase"
payload := strings.NewReader("{\n \"buyer\": {\n \"postalCode\": \"10001\",\n \"country\": \"US\",\n \"province\": \"NY\",\n \"city\": \"New York\",\n \"address1\": \"123 Main St\",\n \"phone\": \"1234567890\",\n \"email\": \"john.doe@example.com\",\n \"lastName\": \"Doe\",\n \"firstName\": \"John\",\n \"address2\": \"Apt 1\"\n },\n \"quantity\": 1,\n \"productUrl\": \"https://www.amazon.com/dp/B0DFC9MT8Q\",\n \"paymentMethod\": {\n \"stripeToken\": \"tok_1RkrWWHGDlstla3f1Fc7ZrhH\",\n \"type\": \"stripe_token\"\n },\n \"referenceId\": \"order-1234\",\n \"discoverPromoCodes\": true,\n \"constraints\": {\n \"offerRetrievalEffort\": \"max\",\n \"maxShippingPrice\": 500,\n \"maxTotalPrice\": 100000\n },\n \"promoCodes\": [\n \"SAVE20\"\n ],\n \"variantSelections\": [\n {\n \"value\": \"Small, Red, XS, L, etc.\",\n \"label\": \"Size, Color, etc.\"\n }\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/checkout-intents/purchase")
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 \"buyer\": {\n \"postalCode\": \"10001\",\n \"country\": \"US\",\n \"province\": \"NY\",\n \"city\": \"New York\",\n \"address1\": \"123 Main St\",\n \"phone\": \"1234567890\",\n \"email\": \"john.doe@example.com\",\n \"lastName\": \"Doe\",\n \"firstName\": \"John\",\n \"address2\": \"Apt 1\"\n },\n \"quantity\": 1,\n \"productUrl\": \"https://www.amazon.com/dp/B0DFC9MT8Q\",\n \"paymentMethod\": {\n \"stripeToken\": \"tok_1RkrWWHGDlstla3f1Fc7ZrhH\",\n \"type\": \"stripe_token\"\n },\n \"referenceId\": \"order-1234\",\n \"discoverPromoCodes\": true,\n \"constraints\": {\n \"offerRetrievalEffort\": \"max\",\n \"maxShippingPrice\": 500,\n \"maxTotalPrice\": 100000\n },\n \"promoCodes\": [\n \"SAVE20\"\n ],\n \"variantSelections\": [\n {\n \"value\": \"Small, Red, XS, L, etc.\",\n \"label\": \"Size, Color, etc.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"buyer": {
"postalCode": "10001",
"country": "US",
"province": "NY",
"city": "New York",
"address1": "123 Main St",
"phone": "1234567890",
"email": "john.doe@example.com",
"lastName": "Doe",
"firstName": "John",
"address2": "Apt 1"
},
"quantity": 1,
"productUrl": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"state": "retrieving_offer",
"referenceId": "order-1234",
"discoverPromoCodes": true,
"constraints": {
"offerRetrievalEffort": "max",
"maxShippingPrice": 500,
"maxTotalPrice": 100000
},
"promoCodes": [
"SAVE20"
],
"variantSelections": [
{
"value": "Small, Red, XS, L, etc.",
"label": "Size, Color, etc."
}
]
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"status": 123,
"fields": {},
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}Checkout Intents
Purchase product
Create a checkout intent and immediately trigger the purchase workflow.
This is a “fire-and-forget” endpoint that combines create + confirm in one step. The workflow handles offer retrieval, payment authorization, and order placement asynchronously. Poll the GET endpoint to check status.
POST
/
api
/
v1
/
checkout-intents
/
purchase
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 checkoutIntent = await client.checkoutIntents.purchase({
buyer: {
address1: '123 Main St',
city: 'New York',
country: 'US',
email: 'john.doe@example.com',
firstName: 'John',
lastName: 'Doe',
phone: '1234567890',
postalCode: '10001',
province: 'NY',
},
paymentMethod: { stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH', type: 'stripe_token' },
productUrl: 'https://www.amazon.com/dp/B0DFC9MT8Q',
quantity: 1,
});
console.log(checkoutIntent);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_intent = client.checkout_intents.purchase(
buyer={
"address1": "123 Main St",
"city": "New York",
"country": "US",
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"phone": "1234567890",
"postal_code": "10001",
"province": "NY",
},
payment_method={
"stripe_token": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
"type": "stripe_token",
},
product_url="https://www.amazon.com/dp/B0DFC9MT8Q",
quantity=1,
)
print(checkout_intent)package com.rye.example;
import com.rye.client.CheckoutIntentsClient;
import com.rye.client.okhttp.CheckoutIntentsOkHttpClient;
import com.rye.models.checkoutintents.Buyer;
import com.rye.models.checkoutintents.CheckoutIntent;
import com.rye.models.checkoutintents.CheckoutIntentPurchaseParams;
import com.rye.models.checkoutintents.PaymentMethod;
public final class Main {
private Main() {}
public static void main(String[] args) {
CheckoutIntentsClient client = CheckoutIntentsOkHttpClient.fromEnv();
CheckoutIntentPurchaseParams params = CheckoutIntentPurchaseParams.builder()
.buyer(Buyer.builder()
.address1("123 Main St")
.city("New York")
.country("US")
.email("john.doe@example.com")
.firstName("John")
.lastName("Doe")
.phone("1234567890")
.postalCode("10001")
.province("NY")
.build())
.paymentMethod(PaymentMethod.StripeTokenPaymentMethod.builder()
.stripeToken("tok_1RkrWWHGDlstla3f1Fc7ZrhH")
.type(PaymentMethod.StripeTokenPaymentMethod.Type.STRIPE_TOKEN)
.build())
.productUrl("https://www.amazon.com/dp/B0DFC9MT8Q")
.quantity(1)
.build();
CheckoutIntent checkoutIntent = client.checkoutIntents().purchase(params);
}
}curl https://staging.api.rye.com/api/v1/checkout-intents/purchase \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CHECKOUT_INTENTS_API_KEY" \
-d '{
"buyer": {
"address1": "123 Main St",
"city": "New York",
"country": "US",
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"phone": "1234567890",
"postalCode": "10001",
"province": "NY"
},
"paymentMethod": {
"stripeToken": "tok_1RkrWWHGDlstla3f1Fc7ZrhH",
"type": "stripe_token"
},
"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/checkout-intents/purchase",
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([
'buyer' => [
'postalCode' => '10001',
'country' => 'US',
'province' => 'NY',
'city' => 'New York',
'address1' => '123 Main St',
'phone' => '1234567890',
'email' => 'john.doe@example.com',
'lastName' => 'Doe',
'firstName' => 'John',
'address2' => 'Apt 1'
],
'quantity' => 1,
'productUrl' => 'https://www.amazon.com/dp/B0DFC9MT8Q',
'paymentMethod' => [
'stripeToken' => 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
'type' => 'stripe_token'
],
'referenceId' => 'order-1234',
'discoverPromoCodes' => true,
'constraints' => [
'offerRetrievalEffort' => 'max',
'maxShippingPrice' => 500,
'maxTotalPrice' => 100000
],
'promoCodes' => [
'SAVE20'
],
'variantSelections' => [
[
'value' => 'Small, Red, XS, L, etc.',
'label' => 'Size, Color, etc.'
]
]
]),
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/checkout-intents/purchase"
payload := strings.NewReader("{\n \"buyer\": {\n \"postalCode\": \"10001\",\n \"country\": \"US\",\n \"province\": \"NY\",\n \"city\": \"New York\",\n \"address1\": \"123 Main St\",\n \"phone\": \"1234567890\",\n \"email\": \"john.doe@example.com\",\n \"lastName\": \"Doe\",\n \"firstName\": \"John\",\n \"address2\": \"Apt 1\"\n },\n \"quantity\": 1,\n \"productUrl\": \"https://www.amazon.com/dp/B0DFC9MT8Q\",\n \"paymentMethod\": {\n \"stripeToken\": \"tok_1RkrWWHGDlstla3f1Fc7ZrhH\",\n \"type\": \"stripe_token\"\n },\n \"referenceId\": \"order-1234\",\n \"discoverPromoCodes\": true,\n \"constraints\": {\n \"offerRetrievalEffort\": \"max\",\n \"maxShippingPrice\": 500,\n \"maxTotalPrice\": 100000\n },\n \"promoCodes\": [\n \"SAVE20\"\n ],\n \"variantSelections\": [\n {\n \"value\": \"Small, Red, XS, L, etc.\",\n \"label\": \"Size, Color, etc.\"\n }\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/checkout-intents/purchase")
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 \"buyer\": {\n \"postalCode\": \"10001\",\n \"country\": \"US\",\n \"province\": \"NY\",\n \"city\": \"New York\",\n \"address1\": \"123 Main St\",\n \"phone\": \"1234567890\",\n \"email\": \"john.doe@example.com\",\n \"lastName\": \"Doe\",\n \"firstName\": \"John\",\n \"address2\": \"Apt 1\"\n },\n \"quantity\": 1,\n \"productUrl\": \"https://www.amazon.com/dp/B0DFC9MT8Q\",\n \"paymentMethod\": {\n \"stripeToken\": \"tok_1RkrWWHGDlstla3f1Fc7ZrhH\",\n \"type\": \"stripe_token\"\n },\n \"referenceId\": \"order-1234\",\n \"discoverPromoCodes\": true,\n \"constraints\": {\n \"offerRetrievalEffort\": \"max\",\n \"maxShippingPrice\": 500,\n \"maxTotalPrice\": 100000\n },\n \"promoCodes\": [\n \"SAVE20\"\n ],\n \"variantSelections\": [\n {\n \"value\": \"Small, Red, XS, L, etc.\",\n \"label\": \"Size, Color, etc.\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"buyer": {
"postalCode": "10001",
"country": "US",
"province": "NY",
"city": "New York",
"address1": "123 Main St",
"phone": "1234567890",
"email": "john.doe@example.com",
"lastName": "Doe",
"firstName": "John",
"address2": "Apt 1"
},
"quantity": 1,
"productUrl": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"id": "<string>",
"state": "retrieving_offer",
"referenceId": "order-1234",
"discoverPromoCodes": true,
"constraints": {
"offerRetrievalEffort": "max",
"maxShippingPrice": 500,
"maxTotalPrice": 100000
},
"promoCodes": [
"SAVE20"
],
"variantSelections": [
{
"value": "Small, Red, XS, L, etc.",
"label": "Size, Color, etc."
}
]
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"status": 123,
"fields": {},
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}{
"name": "<string>",
"message": "<string>",
"stack": "<string>"
}Authorizations
Rye API key
Body
application/json
The request body containing the checkout intent purchase parameters
Show child attributes
Show child attributes
Required range:
x >= 0Example:
1
Example:
"https://www.amazon.com/dp/B0DFC9MT8Q"
- Stripe
- Basis Theory
- Drawdown
- X402
Show child attributes
Show child attributes
Maximum string length:
255Example:
"order-1234"
Show child attributes
Show child attributes
Maximum array length:
16Promo code string with validation constraints.
- Must contain only letters, digits, underscores, or hyphens
- Maximum length of 32 characters
Maximum string length:
32Pattern:
^[a-zA-Z0-9_\-]+$Show child attributes
Show child attributes
Response
Created
- Retrieving Offer
- Awaiting Confirmation
- Requires Action
- Placing Order
- Completed
- Failed
Show child attributes
Show child attributes
Required range:
x >= 0Available options:
retrieving_offer Maximum string length:
255Example:
"order-1234"
Show child attributes
Show child attributes
Promo code string with validation constraints.
- Must contain only letters, digits, underscores, or hyphens
- Maximum length of 32 characters
Maximum string length:
32Pattern:
^[a-zA-Z0-9_\-]+$Show child attributes
Show child attributes
Was this page helpful?
⌘I

