> ## 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.

# 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.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/checkout-intents/openapi.documented.yml post /api/v1/checkout-intents/purchase
openapi: 3.0.0
info:
  title: Universal Checkout API
  version: 1.0.5
  description: >-
    Turn any product URL into a completed checkout. Instantly retrieve price,
    tax, and shipping for any product, and let users buy without ever leaving
    your native AI experience.


    View the [Rye API docs](https://docs.rye.com).
  termsOfService: https://rye.com/terms-of-service
  license:
    name: UNLICENSED
  contact:
    name: Rye
    email: dev@rye.com
    url: https://docs.rye.com
servers:
  - url: https://staging.api.rye.com
security: []
paths:
  /api/v1/checkout-intents/purchase:
    post:
      tags:
        - Checkout Intents
      summary: Purchase product
      description: >-
        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.
      operationId: Purchase
      parameters: []
      requestBody:
        description: The request body containing the checkout intent purchase parameters
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckoutIntentPurchaseParams'
              description: ''
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckoutIntent'
        '401':
          description: Authentication Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthenticationError'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidateError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RuntimeError'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AmazonUnavailableError'
      security:
        - bearerAuth:
            - checkout_intents:write
      x-codeSamples:
        - lang: JavaScript
          source: |-
            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);
        - lang: Python
          source: |-
            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)
        - lang: Java
          source: |-
            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);
                }
            }
        - lang: cURL
          source: |-
            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
                    }'
components:
  schemas:
    CheckoutIntentPurchaseParams:
      allOf:
        - $ref: '#/components/schemas/CheckoutIntentPostParams'
        - $ref: '#/components/schemas/CheckoutIntentConfirmParams'
      description: >-
        Post body for the purchase endpoint - combines create + confirm in one
        step.

        Triggers the durable workflow that handles offer retrieval and order
        placement.
    CheckoutIntent:
      anyOf:
        - $ref: '#/components/schemas/RetrievingOfferCheckoutIntent'
        - $ref: '#/components/schemas/AwaitingConfirmationCheckoutIntent'
        - $ref: '#/components/schemas/RequiresActionCheckoutIntent'
        - $ref: '#/components/schemas/PlacingOrderCheckoutIntent'
        - $ref: '#/components/schemas/CompletedCheckoutIntent'
        - $ref: '#/components/schemas/FailedCheckoutIntent'
    AuthenticationError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
      required:
        - name
        - message
      type: object
      additionalProperties: false
    ValidateError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
        status:
          type: number
          format: double
        fields:
          $ref: '#/components/schemas/FieldErrors'
      required:
        - name
        - message
        - status
        - fields
      type: object
      additionalProperties: false
    RuntimeError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
      required:
        - name
        - message
      type: object
      additionalProperties: false
    AmazonUnavailableError:
      properties:
        name:
          type: string
        message:
          type: string
        stack:
          type: string
      required:
        - name
        - message
      type: object
      additionalProperties: false
    CheckoutIntentPostParams:
      properties:
        discoverPromoCodes:
          type: boolean
        constraints:
          $ref: '#/components/schemas/CheckoutConstraints'
        promoCodes:
          items:
            $ref: '#/components/schemas/PromoCode'
          type: array
          maxItems: 16
        variantSelections:
          items:
            $ref: '#/components/schemas/VariantSelection'
          type: array
        buyer:
          $ref: '#/components/schemas/Buyer'
        quantity:
          type: integer
          format: int32
          example: 1
          minimum: 0
        productUrl:
          type: string
          example: https://www.amazon.com/dp/B0DFC9MT8Q
      required:
        - buyer
        - quantity
        - productUrl
      type: object
    CheckoutIntentConfirmParams:
      properties:
        paymentMethod:
          $ref: '#/components/schemas/PaymentMethod'
      required:
        - paymentMethod
      type: object
    RetrievingOfferCheckoutIntent:
      allOf:
        - $ref: '#/components/schemas/BaseCheckoutIntent'
        - properties:
            state:
              type: string
              enum:
                - retrieving_offer
              nullable: false
          required:
            - state
          type: object
      title: Retrieving Offer
    AwaitingConfirmationCheckoutIntent:
      allOf:
        - $ref: '#/components/schemas/BaseCheckoutIntent'
        - properties:
            paymentMethod:
              $ref: '#/components/schemas/PaymentMethod'
            offer:
              $ref: '#/components/schemas/Offer'
            state:
              type: string
              enum:
                - awaiting_confirmation
              nullable: false
          required:
            - offer
            - state
          type: object
      title: Awaiting Confirmation
    RequiresActionCheckoutIntent:
      allOf:
        - $ref: '#/components/schemas/BaseCheckoutIntent'
        - properties:
            nextAction:
              $ref: '#/components/schemas/NextAction'
            paymentMethod:
              $ref: '#/components/schemas/PaymentMethod'
            offer:
              $ref: '#/components/schemas/Offer'
            state:
              type: string
              enum:
                - requires_action
              nullable: false
          required:
            - nextAction
            - paymentMethod
            - offer
            - state
          type: object
      title: Requires Action
    PlacingOrderCheckoutIntent:
      allOf:
        - $ref: '#/components/schemas/BaseCheckoutIntent'
        - properties:
            paymentMethod:
              $ref: '#/components/schemas/PaymentMethod'
            offer:
              $ref: '#/components/schemas/Offer'
            state:
              type: string
              enum:
                - placing_order
              nullable: false
          required:
            - paymentMethod
            - offer
            - state
          type: object
      title: Placing Order
    CompletedCheckoutIntent:
      allOf:
        - $ref: '#/components/schemas/BaseCheckoutIntent'
        - properties:
            estimatedDeliveryDate:
              type: string
              format: date-time
              nullable: true
              deprecated: true
            orderId:
              type: string
              nullable: true
            paymentMethod:
              $ref: '#/components/schemas/PaymentMethod'
            offer:
              $ref: '#/components/schemas/Offer'
            state:
              type: string
              enum:
                - completed
              nullable: false
          required:
            - orderId
            - paymentMethod
            - offer
            - state
          type: object
      title: Completed
    FailedCheckoutIntent:
      allOf:
        - $ref: '#/components/schemas/BaseCheckoutIntent'
        - properties:
            failureReason:
              $ref: '#/components/schemas/FailureReason'
            paymentMethod:
              $ref: '#/components/schemas/PaymentMethod'
            offer:
              $ref: '#/components/schemas/Offer'
            state:
              type: string
              enum:
                - failed
              nullable: false
          required:
            - failureReason
            - state
          type: object
      title: Failed
    FieldErrors:
      properties: {}
      type: object
      additionalProperties:
        properties:
          value: {}
          message:
            type: string
        required:
          - message
        type: object
    CheckoutConstraints:
      properties:
        offerRetrievalEffort:
          $ref: '#/components/schemas/OfferRetrievalEffort'
          example: max
        maxShippingPrice:
          type: integer
          format: int32
          example: 500
          minimum: 0
        maxTotalPrice:
          type: integer
          format: int32
          example: 100000
          minimum: 0
      type: object
    PromoCode:
      type: string
      example: SAVE20
      description: |-
        Promo code string with validation constraints.
        - Must contain only letters, digits, underscores, or hyphens
        - Maximum length of 32 characters
      pattern: ^[a-zA-Z0-9_\-]+$
      maxLength: 32
    VariantSelection:
      properties:
        value:
          anyOf:
            - type: string
            - type: number
              format: double
          example: Small, Red, XS, L, etc.
          maxLength: 60
        label:
          type: string
          example: Size, Color, etc.
          maxLength: 30
      required:
        - value
        - label
      type: object
    Buyer:
      properties:
        postalCode:
          type: string
          example: '10001'
          maxLength: 255
        country:
          type: string
          example: US
        province:
          type: string
          example: NY
          maxLength: 255
        city:
          type: string
          example: New York
          maxLength: 255
        address2:
          type: string
          example: Apt 1
          maxLength: 255
        address1:
          type: string
          example: 123 Main St
          maxLength: 255
        phone:
          type: string
          example: '1234567890'
        email:
          type: string
          example: john.doe@example.com
        lastName:
          type: string
          example: Doe
          maxLength: 255
        firstName:
          type: string
          example: John
          maxLength: 255
      required:
        - postalCode
        - country
        - province
        - city
        - address1
        - phone
        - email
        - lastName
        - firstName
      type: object
    PaymentMethod:
      anyOf:
        - $ref: '#/components/schemas/StripeTokenPaymentMethod'
        - $ref: '#/components/schemas/BasisTheoryPaymentMethod'
        - $ref: '#/components/schemas/NekudaPaymentMethod'
        - $ref: '#/components/schemas/PravaPaymentMethod'
        - $ref: '#/components/schemas/DrawdownPaymentMethod'
        - $ref: '#/components/schemas/X402PaymentMethod'
    BaseCheckoutIntent:
      properties:
        discoverPromoCodes:
          type: boolean
        constraints:
          $ref: '#/components/schemas/CheckoutConstraints'
        promoCodes:
          items:
            $ref: '#/components/schemas/PromoCode'
          type: array
        variantSelections:
          items:
            $ref: '#/components/schemas/VariantSelection'
          type: array
        buyer:
          $ref: '#/components/schemas/Buyer'
        quantity:
          type: integer
          format: int32
          minimum: 0
        productUrl:
          type: string
        createdAt:
          type: string
          format: date-time
        id:
          type: string
      required:
        - buyer
        - quantity
        - productUrl
        - createdAt
        - id
      type: object
    Offer:
      properties:
        commission:
          $ref: '#/components/schemas/CommissionPotential'
        shipping:
          $ref: '#/components/schemas/Shipping'
        cost:
          $ref: '#/components/schemas/Cost'
        appliedPromoCodes:
          items:
            type: string
          type: array
      required:
        - shipping
        - cost
      type: object
    NextAction:
      $ref: '#/components/schemas/X402NextAction'
    FailureReason:
      properties:
        message:
          type: string
        code:
          $ref: '#/components/schemas/FailureReasonCode'
      required:
        - message
        - code
      type: object
    OfferRetrievalEffort:
      type: string
      enum:
        - max
        - low
      description: >-
        Controls how much effort the system should spend retrieving an offer.

        - 'max': Full effort including AI agent fallback (slower, higher success
        rate)

        - 'low': Fast API-only retrieval, fails if API unavailable (faster,
        lower success rate)


        Default: 'max'
    StripeTokenPaymentMethod:
      properties:
        stripeToken:
          type: string
          example: tok_1RkrWWHGDlstla3f1Fc7ZrhH
        type:
          type: string
          enum:
            - stripe_token
          nullable: false
          example: stripe_token
      required:
        - stripeToken
        - type
      type: object
      title: Stripe
    BasisTheoryPaymentMethod:
      properties:
        basisTheoryToken:
          type: string
        type:
          type: string
          enum:
            - basis_theory_token
          nullable: false
      required:
        - basisTheoryToken
        - type
      type: object
      title: Basis Theory
    NekudaPaymentMethod:
      properties:
        nekudaMandateData:
          $ref: '#/components/schemas/Record_string.string-or-number_'
        nekudaUserId:
          type: string
        type:
          type: string
          enum:
            - nekuda_token
          nullable: false
      required:
        - nekudaUserId
        - type
      type: object
      title: Nekuda
    PravaPaymentMethod:
      properties:
        pravaToken:
          type: string
        type:
          type: string
          enum:
            - prava_token
          nullable: false
      required:
        - pravaToken
        - type
      type: object
      title: Prava
    DrawdownPaymentMethod:
      properties:
        type:
          type: string
          enum:
            - drawdown
          nullable: false
      required:
        - type
      type: object
      title: Drawdown
    X402PaymentMethod:
      properties:
        network:
          type: string
          enum:
            - base
            - solana
            - tempo
        type:
          type: string
          enum:
            - x402
          nullable: false
      required:
        - network
        - type
      type: object
      title: X402
    CommissionPotential:
      properties:
        estimate:
          type: boolean
        amount:
          $ref: '#/components/schemas/Money'
      required:
        - estimate
        - amount
      type: object
      description: The commission a developer would earn if this offer is placed.
    Shipping:
      properties:
        availableOptions:
          items:
            $ref: '#/components/schemas/ShippingOption'
          type: array
        selectedOptionId:
          type: string
      required:
        - availableOptions
      type: object
    Cost:
      properties:
        total:
          $ref: '#/components/schemas/Money'
        surcharge:
          $ref: '#/components/schemas/Money'
        discount:
          $ref: '#/components/schemas/Money'
        tax:
          $ref: '#/components/schemas/Money'
        shipping:
          $ref: '#/components/schemas/Money'
        subtotal:
          $ref: '#/components/schemas/Money'
      required:
        - total
        - subtotal
      type: object
    X402NextAction:
      properties:
        x402:
          properties:
            expiresAt:
              type: string
            recipient:
              type: string
            currency:
              type: string
              enum:
                - USDC
              nullable: false
            maxAmountRequired:
              type: string
            network:
              type: string
            scheme:
              type: string
              enum:
                - exact
              nullable: false
          required:
            - expiresAt
            - recipient
            - currency
            - maxAmountRequired
            - network
            - scheme
          type: object
        type:
          type: string
          enum:
            - x402
          nullable: false
      required:
        - x402
        - type
      type: object
    FailureReasonCode:
      type: string
      enum:
        - unknown
        - checkout_intent_expired
        - payment_failed
        - payment_cvc_expired
        - insufficient_stock
        - product_out_of_stock
        - offer_retrieval_failed
        - order_placement_failed
        - developer_not_found
        - missing_shipping_method
        - unsupported_currency
        - invalid_input
        - incorrect_cost_breakdown
        - unsupported_store_no_guest_checkout
        - workflow_invocation_failed
        - variant_selections_invalid
        - variant_selections_required
        - form_validation_error
        - captcha_blocked
        - bot_protection_blocked
        - constraint_total_price_exceeded
        - constraint_shipping_cost_exceeded
        - promo_code_discovery_not_enabled
        - product_not_found
      description: Type derived from runtime array - always in sync
    Record_string.string-or-number_:
      properties: {}
      additionalProperties:
        anyOf:
          - type: string
          - type: number
            format: double
      type: object
      description: Construct a type with a set of properties K of type T
    Money:
      properties:
        currencyCode:
          type: string
          example: USD
        amountSubunits:
          type: integer
          format: int32
          example: 1500
      required:
        - currencyCode
        - amountSubunits
      type: object
    ShippingOption:
      properties:
        deliveryEstimate:
          allOf:
            - $ref: '#/components/schemas/DeliveryEstimate'
          nullable: true
        discount:
          $ref: '#/components/schemas/Money'
        cost:
          $ref: '#/components/schemas/Money'
        id:
          type: string
      required:
        - cost
        - id
      type: object
    DeliveryEstimate:
      properties:
        latest:
          type: string
          format: date-time
          description: Latest date that items will be delivered by.
          example: '2026-03-28T00:00:00Z'
        earliest:
          type: string
          format: date-time
          description: Earliest date that items will be delivered by.
          example: '2026-03-25T00:00:00Z'
      type: object
      description: >-
        Estimated range of dates that items will be delivered in. At least one
        of

        `earliest` or `latest` are guaranteed to be set.


        Interpretation:


        * If both `earliest` and `latest` are set, then the delivery estimate is
        the range between the two dates.

        * If only `earliest` is set, then the delivery estimate is any date
        after that date.

        * If only `latest` is set, then the delivery estimate is any date before
        that date.
  securitySchemes:
    bearerAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Rye API key

````