NodeRailsCRYPTO PAYMENT INFRASTRUCTURE
DocumentationAPI Reference
Dashboard

Checkout Sessions

A checkout session represents a hosted payment page. Create a session, redirect your customer to the session URL, and NodeRails handles the rest: chain selection, wallet connection, and payment capture.

💡

Hosted payment page

Checkout sessions power the NodeRails hosted payment UI. Your customer never leaves a NodeRails-hosted page, reducing PCI-equivalent complexity for crypto payments.

Create a checkout session

POST/checkout-sessions

Creates a new checkout session. Returns a session object with line items.

Request body

ParameterTypeRequiredDescription
appIdstringYesYour app UUID
successUrlstringYesURL to redirect on successful payment
cancelUrlstringYesURL to redirect on cancellation
itemsCheckoutItem[]YesLine items (min 1)
customerAccountIdstringNoExisting customer UUID
mode"PAYMENT" | "SUBSCRIPTION"NoCheckout mode (default: PAYMENT)
expiresInMinutesnumberNoAuto-expire in 1–1440 minutes
metadataobjectNoArbitrary key-value metadata

CheckoutItem

FieldTypeRequiredDescription
namestringYesItem name (1–255 chars)
amountstringNoPrice in fiat (decimal string)
currencystringNoCurrency code (max 10 chars)
quantitynumberNoItem quantity (positive integer)
descriptionstringNoItem description (max 500)
productPlanIdstringNoLink to a product plan
productPlanPriceIdstringNoSpecific price option
isPriceOptionbooleanNoWhether to use price option
SDK exampletypescript
const session = await noderails.checkoutSessions.create({
  successUrl: 'https://example.com/success',
  cancelUrl: 'https://example.com/cancel',
  items: [
    {
      name: 'Pro Plan',
      amount: '49.99',
      currency: 'USD',
      quantity: 1,
    },
  ],
  metadata: { orderId: 'order_123' },
});

// Redirect your customer to the hosted payment page:
// https://pay.noderails.com/checkout/{session.id}
console.log(session.id);     // UUID
console.log(session.status); // "OPEN"
cURLbash
curl -X POST https://api.noderails.com/checkout-sessions \
  -H "x-api-key: nr_live_sk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "your-app-id",
    "successUrl": "https://example.com/success",
    "cancelUrl": "https://example.com/cancel",
    "items": [{
      "name": "Pro Plan",
      "amount": "49.99",
      "currency": "USD",
      "quantity": 1
    }]
  }'

List checkout sessions

GET/checkout-sessions

Query parameters

ParameterTypeDescription
appIdstringFilter by app UUID
status"OPEN" | "COMPLETE" | "EXPIRED"Filter by status
pagenumberPage number (default: 1)
pageSizenumberItems per page (1–100)
SDK exampletypescript
const result = await noderails.checkoutSessions.list({
  status: 'OPEN',
  page: 1,
  pageSize: 25,
});

console.log(result.data);       // CheckoutSession[]
console.log(result.pagination); // { total, page, pageSize, totalPages }

Retrieve a checkout session

GET/checkout-sessions/:id
SDK exampletypescript
const session = await noderails.checkoutSessions.retrieve('cs_abc123');
console.log(session.status); // "OPEN" | "COMPLETE" | "EXPIRED"

Expire a checkout session

POST/checkout-sessions/:id/expire

Manually expires an open checkout session, preventing any further payments.

SDK exampletypescript
const expired = await noderails.checkoutSessions.expire('cs_abc123');
console.log(expired.status); // "EXPIRED"

Create from payment link

POST/checkout-sessions/from-link

Creates a checkout session from a payment link slug. This is a public endpoint, no authentication required.

ParameterTypeRequiredDescription
slugstringYesPayment link slug (1–100 chars)

Create from invoice

POST/checkout-sessions/from-invoice

Creates a checkout session from an invoice ID. This is a public endpoint, no authentication required.

ParameterTypeRequiredDescription
invoiceIdstringYesInvoice UUID

Response object

All responses are wrapped in { "success": true, "data": ... }. List endpoints add pagination with total, page, pageSize, and totalPages.

CheckoutSession object (create / expire)json
{
  "success": true,
  "data": {
    "id": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
    "appId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "customerAccountId": null,
    "paymentIntentId": null,
    "mode": "PAYMENT",
    "status": "OPEN",
    "sourceType": "CHECKOUT",
    "sourceId": null,
    "amount": "49.99",
    "currency": "USD",
    "subtotal": "49.99",
    "taxAmount": "0",
    "taxDescription": null,
    "allowedChains": "ALL",
    "allowedTokens": "ALL",
    "successUrl": "https://example.com/success",
    "cancelUrl": "https://example.com/cancel",
    "selectedPriceId": null,
    "requireBillingDetails": false,
    "metadata": { "orderId": "order_123" },
    "expiresAt": "2025-01-16T10:30:00.000Z",
    "completedAt": null,
    "createdAt": "2025-01-15T10:30:00.000Z",
    "updatedAt": "2025-01-15T10:30:00.000Z",
    "items": [
      {
        "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "checkoutSessionId": "d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
        "productPlanId": null,
        "productPlanPriceId": null,
        "name": "Pro Plan",
        "description": null,
        "amount": "49.99",
        "currency": "USD",
        "quantity": 1,
        "isPriceOption": false,
        "createdAt": "2025-01-15T10:30:00.000Z"
      }
    ]
  }
}

CheckoutSession fields

idstringUnique checkout session UUID
appIdstringApp this session belongs to
customerAccountIdstring | nullLinked customer UUID, if any
paymentIntentIdstring | nullAssociated payment intent UUID once payment begins
modestringPAYMENT or SUBSCRIPTION
statusstringOPEN, COMPLETE, or EXPIRED
sourceTypestringOrigin type: CHECKOUT, PAYMENT_LINK, INVOICE, or SUBSCRIPTION
sourceIdstring | nullID of the originating resource (payment link, invoice, etc.)
amountstringTotal payment amount as a decimal string
currencystringFiat currency code (e.g. USD)
subtotalstringAmount before tax
taxAmountstringCalculated tax amount
taxDescriptionstring | nullTax label shown to customer (e.g. 'VAT 20%')
allowedChains'ALL' | number[]Permitted blockchain chain IDs
allowedTokens'ALL' | string[]Permitted token identifiers
successUrlstringRedirect URL after successful payment
cancelUrlstringRedirect URL on cancellation
selectedPriceIdstring | nullSelected product plan price UUID
requireBillingDetailsbooleanWhether billing details are required at checkout
metadataobjectArbitrary key-value pairs
expiresAtstringISO 8601 expiration timestamp
completedAtstring | nullISO 8601 timestamp when session completed
createdAtstringISO 8601 creation timestamp
updatedAtstringISO 8601 last-update timestamp
itemsCheckoutSessionItem[]Line items in this session

CheckoutSessionItem fields

idstringItem UUID
checkoutSessionIdstringParent checkout session UUID
productPlanIdstring | nullLinked product plan UUID
productPlanPriceIdstring | nullLinked price UUID
namestringItem display name
descriptionstring | nullItem description
amountstringPrice per unit as decimal string
currencystringCurrency code
quantitynumberItem quantity
isPriceOptionbooleanWhether this item uses a price option
createdAtstringISO 8601 creation timestamp
💡

Retrieve response

The retrieve endpoint returns additional nested objects: app (full app record), paymentIntent (full payment intent), and each item includes productPlan and productPlanPrice when linked.