Skip to main content
POST
Checkout order
This is the core endpoint for hosted checkout. Merchants POST their signed orders, and you return a URL to your payment page.

Flow

  1. Merchant creates and signs an order
  2. Merchant POSTs order to your /orders/checkout
  3. You verify the signature and create a checkout session
  4. You return a redirect_url to your payment page
  5. Merchant redirects their customer to your page
  6. Customer completes payment on your hosted UI
  7. You send signed proof to merchant’s /transfer/webhook
  8. You redirect customer back to merchant’s completed URL

Implementation

Validation Checklist

Before accepting an order:
  • Merchant is registered with your gateway
  • Order signature is valid (signed by merchant’s private key)
  • Order has not expired (expiresAt)
  • Your OCID is in the accepts array
  • Currency is supported
  • Amount is reasonable (fraud checks)

Hosted Payment Page

On your payment page (/checkout/{sessionId}):
  1. Retrieve the session and order
  2. Display order details (items, amount, merchant name)
  3. Present payment options (cards, wallets, bank transfer)
  4. Process payment using your internal systems
  5. On success, call merchant’s webhook and redirect to urls.completed
  6. On failure/cancel, redirect to urls.cancelled
Always verify the session hasn’t expired and hasn’t already been paid before processing payment.

Headers

X-OC-ID
string
required

Caller's OCID (Opencharge ID)

X-OC-Timestamp
string
required

Unix timestamp in seconds

X-OC-Nonce
string
required

Unique request identifier for replay protection

X-OC-Signature
string
required

secp256k1 ECDSA signature of the canonical request

Body

application/json

Request from merchant to initiate hosted checkout

order
object
required

Signed order object from merchant

signature
string
required

Merchant's signature of the order

urls
object
required

Response

Checkout session created, redirect URL returned

Response with redirect URL for hosted checkout

redirect_url
string<uri>
required

URL to redirect customer to complete payment