Create a session.
const url = 'https://api.ridleypay.com/v1/sessions';const options = { method: 'POST', headers: { 'Idempotency-Key': 'ord_abc123', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"amount":99.99,"reference":"WOO-123","currency":"JMD","description":"Order #123: Blue Widget","success_url":"https://store.example.com/order-received/123","cancel_url":"https://store.example.com/checkout","customer_email":"jane@example.com","customer_name":"Jane Doe","metadata":{"order_id":42,"order_key":"wc_order_abc"},"subtotal":89.99,"discount":10,"shipping":5,"tax":{"amount":15,"lines":[{"name":"GCT","rate":15,"amount":15}]},"capture_method":"automatic","save_payment_method":true,"apply_tax":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.ridleypay.com/v1/sessions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: ord_abc123' \ --data '{ "amount": 99.99, "reference": "WOO-123", "currency": "JMD", "description": "Order #123: Blue Widget", "success_url": "https://store.example.com/order-received/123", "cancel_url": "https://store.example.com/checkout", "customer_email": "jane@example.com", "customer_name": "Jane Doe", "metadata": { "order_id": 42, "order_key": "wc_order_abc" }, "subtotal": 89.99, "discount": 10, "shipping": 5, "tax": { "amount": 15, "lines": [ { "name": "GCT", "rate": 15, "amount": 15 } ] }, "capture_method": "automatic", "save_payment_method": true, "apply_tax": true }'Creates a new checkout session and returns a checkout_url to redirect
your customer to. The session expires after 24 hours.
Supports an optional Idempotency-Key header. If the same key is
sent within 24 hours, the original response is returned.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters”Example
ord_abc123Request Bodyrequired
Section titled “Request Bodyrequired”object
The payment amount. Must be at least 0.01. Must not be greater than 999999.99.
Example
99.99A unique reference for the payment (e.g. your order ID). Must not be greater than 255 characters.
Example
WOO-123ISO 4217 currency code. Defaults to the source’s configured currency. Must be 3 characters.
Example
JMDAn optional description for the payment. Must not be greater than 500 characters.
Example
Order #123: Blue WidgetURL to redirect to after a successful payment. Must be a valid URL.
Example
https://store.example.com/order-received/123URL to redirect to if the customer cancels. Must be a valid URL.
Example
https://store.example.com/checkoutCustomer’s email address. Must be a valid email address.
Example
jane@example.comCustomer’s full name. Must not be greater than 255 characters.
Example
Jane DoeArbitrary key-value data to attach to the payment. Returned in webhooks.
object
Example
{ "order_id": 42, "order_key": "wc_order_abc"}Order subtotal before tax, shipping, and discounts. Must be at least 0.
Example
89.99Total discount amount applied to the order. Must be at least 0.
Example
10Shipping cost. Must be at least 0.
Example
5Tax breakdown object with total amount and optional line items.
object
Must be at least 0.
Example
15object
This field is required when tax.lines is present. Must not be greater than 255 characters.
Example
bMust be at least 0.
Example
39This field is required when tax.lines is present. Must be at least 0.
Example
84Example
[ { "name": "GCT", "rate": 15, "amount": 15 }]Example
{ "amount": 15, "lines": [ { "name": "GCT", "rate": 15, "amount": 15 } ]}How to handle the payment. “automatic” (default) captures immediately. “manual” authorizes only, and you must call /payments/{reference}/capture later.
Example
automaticSave the card on file so it can be charged later without the customer present (recurring schedules and /charges). Supported on PowerTranz.
Example
trueCalculate tax from your team tax settings. With exclusive tax, amount is the subtotal and tax is added; with inclusive tax, tax is extracted from amount. Overrides tax.
Example
trueResponses
Section titled “ Responses ”Session created
object
object
object
object
Example
{ "data": { "id": "cs_a1b2c3d4e5f6g7h8", "type": "sessions", "attributes": { "amount": 99.99, "currency": "USD", "reference": "WOO-123", "checkout_url": "https://pay.example.com/checkout/cs_a1b2c3d4e5f6g7h8", "expires_at": "2026-03-05T12:00:00.000000Z" }, "links": { "self": "https://pay.example.com/api/v1/sessions/cs_a1b2c3d4e5f6g7h8", "checkout": "https://pay.example.com/checkout/cs_a1b2c3d4e5f6g7h8" } }}Invalid API key
object
object
Example
{ "errors": [ { "status": "401", "title": "Unauthorized", "detail": "Invalid or missing API key. Provide a secret key (sk_) as a Bearer token." } ]}Reference already used
object
object
Example
{ "errors": [ { "status": "409", "title": "Conflict", "detail": "A payment with this reference has already been completed." } ]}Validation error
object
object
object
object
Example
{ "errors": [ { "status": "422", "title": "Unprocessable Entity", "detail": "The amount field is required.", "meta": { "errors": { "amount": [ "The amount field is required." ] } } } ]}