Skip to main content
POST
/
api
/
v1
/
checkout-intents
/
{id}
/
payment
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.addPayment('id', {
  paymentMethod: { stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH', type: 'stripe_token' },
});

console.log(checkoutIntent);
{
  "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",
  "discoverPromoCodes": true,
  "constraints": {
    "offerRetrievalEffort": "max",
    "maxShippingPrice": 500,
    "maxTotalPrice": 100000
  },
  "promoCodes": [
    "SAVE20"
  ],
  "variantSelections": [
    {
      "value": "Small, Red, XS, L, etc.",
      "label": "Size, Color, etc."
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://docs-test.rye.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Rye API key

Path Parameters

id
string
required

The id of the checkout intent to add payment details to

Body

application/json

The request body containing the payment details

paymentMethod
Stripe · object
required

Response

Payment response

buyer
object
required
quantity
integer<int32>
required
Required range: x >= 0
productUrl
string
required
createdAt
string<date-time>
required
id
string
required
state
enum<string>
required
Available options:
retrieving_offer
discoverPromoCodes
boolean
constraints
object
promoCodes
string[]

Promo code string with validation constraints.

  • Must contain only letters, digits, underscores, or hyphens
  • Maximum length of 32 characters
Maximum string length: 32
Pattern: ^[a-zA-Z0-9_\-]+$
variantSelections
object[]