Skip to main content
Before a customer can pay, you create a “session” that holds all the payment details.

Quick Start (30 seconds)

Create a session and redirect your customer:
curl -X POST https://checkout.ozura.io/api/sessions/create \
  -H "X-API-KEY: your_vault_key" \
  -H "X-OZURA-API-KEY: your_merchant_key" \
  -H "Content-Type: application/json" \
  -d '{
    "merchantId": "your_merchant_id",
    "merchantName": "My Store",
    "amount": "25.00",
    "currency": "USD",
    "successUrl": "https://yoursite.com/success",
    "cancelUrl": "https://yoursite.com/cancel",
    "errorUrl": "https://yoursite.com/error"
  }'
Then redirect your customer to the returned checkoutUrl. Done!

The Basics

WhatValue
API URLPOST https://checkout.ozura.io/api/sessions/create
Content-Typeapplication/json
Called FromYour server (never from browser JavaScript)
What’s “your server”? Backend code like Node.js, PHP, Python, Ruby, etc. If you’re using a website builder (Shopify, Wix), check if they offer serverless functions. If you only have static HTML, use Payment Links instead.

Required Headers

Every request needs these two headers:
X-API-KEY: your_vault_api_key
X-OZURA-API-KEY: your_merchant_api_key
What’s a header? Headers are extra information sent with your request (like an ID badge). They’re set separately from the request body — see the code examples below.Vault API Key: Provided when you signed up. If you didn’t save it, contact Ozura support.Merchant API Key: Dashboard → Settings → API Keys.

Required Fields

Your request body must include these fields:
{
  "merchantId": "your_merchant_id",
  "merchantName": "Your Store Name",
  "amount": "25.00",
  "successUrl": "https://yoursite.com/success",
  "cancelUrl": "https://yoursite.com/cancel",
  "errorUrl": "https://yoursite.com/error"
}
FieldWhat to PutExample
merchantIdYour Merchant ID from Dashboard"merchant_abc123"
merchantNameYour business name (customer sees this)"Bob's Coffee Shop"
amountHow much to charge (string or number)*"25.00" or 25.00
successUrlConfirmation page after payment"https://yoursite.com/thank-you"
cancelUrlReturn destination (cart page)"https://yoursite.com/cart"
errorUrlSystem error handler"https://yoursite.com/cart?checkoutError=true"
Why full URLs? Use absolute URLs like https://yoursite.com/success, not just /success. The redirect happens from Ozura’s servers, so we need the full URL to find your website.
*amount is required for standard payments. Accepts string (e.g., "25.00") or number (e.g., 25.00). Not needed when using items or checkoutMode: "donation".

Understanding the Three URLs

These three URLs control where customers end up after checkout.

Quick Summary

URLPurposeWhen UsedWhat You Receive
successUrlShow receipt/confirmationPayment successfulTransaction details, card info, customer data
cancelUrlReturn to shoppingUser cancels OR session expiresNothing (just a return path)
errorUrlHandle system errorsServer/connectivity failuresError code, message, return URL

successUrl – Your Confirmation Page

Purpose: Where customers land after successful payment to see their receipt/confirmation. When it’s used: After payment is processed and confirmed. What you receive: Full transaction details as URL parameters:
https://yoursite.com/success?success=true&sessionId=session_xxx&transactionId=txn_123&amount=25.00&currency=USD&cardLastFour=4242&cardBrand=visa&firstName=John&lastName=Doe&email=john@example.com

cancelUrl – Your “Go Back” Destination

Purpose: Where customers return when they don’t complete checkout. When it’s used: Customer clicks “Cancel”, session expires (30 min), or customer visits old/bookmarked checkout URL. What you receive: Nothing – it’s just a return path. Best Practice: Point to your cart page or wherever the customer was before checkout.

errorUrl – Your System Error Handler

Purpose: Handle unrecoverable errors (NOT card declines). When it’s used: Server failures, connectivity issues, authentication errors. NOT for card declines – those show inline messages and let customers retry. What you receive: Error details as URL parameters:
https://yoursite.com/error?success=false&errorCode=SYSTEM_ERROR&error=Payment+service+unavailable&cancelUrl=https://yoursite.com/cart

Optional Fields

Common Options

FieldDefaultWhat It Does
currency"USD"Currency code (e.g., "USD", "EUR", "GBP", "CAD")
metadata{}Your custom data (JSON object, returned in success URL)
appearance{}Custom styling (see Appearance)

Cart Items (Alternative to Amount)

Instead of a flat amount, you can send an array of cart items for a rich, itemized checkout display.
{
  "items": [
    {
      "productId": "sku_001",
      "name": "Blue T-Shirt",
      "price": 29.99,
      "quantity": 2,
      "imageUrl": "https://cdn.example.com/tshirt.jpg"
    }
  ]
}
Limits: Maximum 100 items per cart, maximum cart total: $999,999,999.99. See the full Cart Item Fields section below for all options.

Checkout Modes (Mutually Exclusive)

ModeHow to UseBest For
Simple AmountPass amount onlyQuick payments, invoices
Itemized CartPass items array onlyE-commerce with multiple products
DonationPass checkoutMode: "donation"Charities, non-profits, tips
These modes are mutually exclusive:
  • Cannot use amount + items together
  • Cannot use items + checkoutMode: "donation" together
  • Can use amount + checkoutMode: "donation" (sets default donation amount)

Cart Item Fields

Each item in the items array supports:

Required Fields

FieldTypeDescription
productIdstringYour product SKU or ID (max 100 chars)
namestringProduct name shown to customer (max 200 chars)
pricenumberUnit price (e.g., 29.99). Must be ≥ 0
quantityintegerQuantity (1-10,000)

Visual Display Fields (Optional)

FieldTypeDescription
imageUrlstringProduct image URL (HTTPS recommended)
descriptionstringShort product description (max 500 chars)
variantstringVariant details, e.g., "Size: L, Color: Blue"
brandstringBrand name displayed above product name
categorystringProduct category

Pricing & Discount Fields (Optional)

FieldTypeDescription
originalPricenumberOriginal price before discount (shows strikethrough)
discountLabelstringDiscount badge text, e.g., "SALE", "20% OFF"
taxExemptbooleanIf true, item displays “Tax Free” badge

Response

{
  "success": true,
  "data": {
    "sessionId": "session_xxxxxxxxxxxxxx",
    "checkoutUrl": "https://checkout.ozura.io/checkout/session_xxxxxxxxxxxxxx",
    "expiresAt": "2025-01-07T12:15:00.000Z",
    "embedCode": "<script>...</script>",
    "pricing": {
      "subtotal": 25.00,
      "tax": 0,
      "shipping": 0,
      "total": 25.00,
      "currency": "USD"
    }
  }
}
FieldWhat It Is
checkoutUrlSend your customer here! This is the payment page URL.
sessionIdSave this – you’ll need it to verify the payment later.
expiresAtWhen the session expires (customer must pay before this).
embedCodeReady-to-use HTML/JS for popup/iframe modes.
pricingCalculated totals (subtotal, tax, shipping, total).

What’s Next?

You have a checkoutUrl. Now redirect your customer to checkout.