Checkout Sessions API

Accept payments with hosted checkout pages

The OVGC Checkout Sessions API lets you create secure, hosted payment pages. Create a session from your server, redirect your customer to the checkout URL, and we handle the rest.

Hosted Checkout

No payment UI to build

Secure by Default

PCI compliant, encrypted

Multi-Gateway

SellHub, Stripe, and more

Quick Start

1

Get your API key

Go to Integrations > API Keys and copy your secret key.

2

Create a checkout session

POST to /api/checkout-sessions with amount, currency, and redirect URLs.

3

Redirect your customer

Send the customer to the checkout_url returned in the response.

4

Handle the result

Customer is redirected to your success_url or cancel_url. Verify server-side.

Authentication

Include your API key in the Authorization header.

http
Authorization: Bearer ovgc_live_your_api_key_here

Never expose your secret API key in client-side code. Always make API calls from your backend server.

Create a Checkout Session

POST/api/checkout-sessions

Creates a new checkout session and returns a hosted checkout URL.

Request Parameters

ParameterTypeRequiredDescription
amountintegerrequiredAmount in smallest currency unit (e.g. cents)
currencystringoptionalThree-letter ISO currency code. Defaults to USD
emailstringrequiredCustomer email address
product_titlestringoptionalProduct name shown on checkout page
success_urlstringrequiredRedirect URL after successful payment
cancel_urlstringrequiredRedirect URL after failed/cancelled payment
metadataobjectoptionalCustom key-value pairs for your reference

Sessions expire after 30 minutes. This is fixed and cannot be changed.

Example Request

bash
curl -X POST https://dashboard.ovgcpayments.com/api/checkout-sessions \
  -H "Authorization: Bearer ovgc_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 2500,
    "currency": "USD",
    "email": "customer@example.com",
    "product_title": "Premium Plan",
    "success_url": "https://yoursite.com/success",
    "cancel_url": "https://yoursite.com/cancel"
  }'

Example Response

json
{
  "data": {
    "session": {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "amount": 2500,
      "currency": "USD",
      "status": "pending",
      "expires_at": "2026-04-14 12:30:00"
    },
    "checkout_url": "https://billing.ovgcpayments.com/checkout/a1b2c3d4..."
  }
}

Redirect the customer to checkout_url. This is a fully hosted page.

Verify Payment Status

GET/api/checkout-sessions/:id

Verify the payment server-side before fulfilling the order.

bash
curl https://dashboard.ovgcpayments.com/api/checkout-sessions/SESSION_ID \
  -H "Authorization: Bearer ovgc_live_your_api_key"
json
{
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "amount": 2500,
    "currency": "USD",
    "status": "completed"
  }
}

Always verify payment server-side. Never trust client-side redirects alone.

Webhooks

Configure webhooks in your dashboard to receive real-time notifications.

Available Events

EventDescription
payment.succeededPayment was successfully processed
payment.declinedPayment was declined
refund.createdA refund was initiated
payout.completedPayout was sent to merchant

Signature Verification

javascript
const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const timestamp = req.headers['x-webhook-timestamp'];
  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${timestamp}.${payload}`)
    .digest('hex');
  return `sha256=${expected}` === signature;
}

Status Reference

StatusDescription
pendingSession created, awaiting payment
completedPayment successful
declinedPayment was declined
expiredSession expired (30 min timeout)
paidTransaction captured, awaiting settlement
settledFunds moved to available balance

Error Codes

CodeStatusDescription
BAD_REQUEST400Missing or invalid parameters
UNAUTHORIZED401Invalid or missing API key
NOT_FOUND404Session not found
SESSION_EXPIRED400Checkout session has expired
INTERNAL_ERROR500Unexpected server error

Need help? Email support@ovgcpayments.com