Create Payment

Create a new payment session and get a checkout URL to redirect your customer.

POST/api/v1/payments/create

Request Body

FieldTypeRequiredDescription
amountintegerRequiredAmount in cents (5000 = $50.00)
currencystringRequired3-letter code: usd, eur, gbp, etc.
successUrlstringRequiredRedirect URL after successful payment
cancelUrlstringRequiredRedirect URL if customer cancels
customerEmailstringOptionalCustomer's email address
customerNamestringOptionalCustomer's full name
descriptionstringOptionalPayment description (shown in dashboard)
webhookUrlstringOptionalURL to receive payment status updates
metadataobjectOptionalCustom data (e.g., order ID)

Example Request

json
{
"amount": 9999,
"currency": "usd",
"customerEmail": "john@example.com",
"customerName": "John Doe",
"description": "Order #12345",
"successUrl": "https://yoursite.com/thank-you?order=12345",
"cancelUrl": "https://yoursite.com/checkout",
"webhookUrl": "https://yoursite.com/api/webhooks/ultrapay",
"metadata": {
"orderId": "12345",
"productName": "Premium Plan"
}
}

Success Response

json
{
"success": true,
"data": {
"transactionId": "550e8400-e29b-41d4-a716-446655440000",
"paymentUrl": "https://checkout.stripe.com/c/pay/cs_live_xxx...",
"sessionId": "cs_live_a1b2c3d4...",
"expiresAt": "2025-01-01T12:30:00.000Z"
}
}

Response Fields

FieldDescription
transactionIdUltraPay transaction ID (save this!)
paymentUrlStripe Checkout URL - redirect customer here
sessionIdStripe Checkout Session ID
expiresAtWhen the payment link expires (usually 30 min)

URL Privacy

Your successUrl and cancelUrl are hidden from Stripe. After payment, customers are redirected through our servers first, then to your URL. This keeps your domain private.

Important: Never Use Iframes

⚠️ Warning: Never embed the paymentUrl in an iframe. Always use a full page redirect.

Payment URLs must be opened via window.location.href or a standard link. Iframes are blocked because:

  • Stripe actively blocks checkout pages from loading in iframes
  • Most browsers block third-party cookies in iframes, breaking payments
  • Iframe embedding is a common phishing technique that payment processors prevent
  • 3D Secure authentication cannot complete properly in an iframe

cURL Example

bash
curl -X POST https://pay.ultrapay.cc/api/v1/payments/create \
-H "X-Public-Key: upp_your_public_key" \
-H "X-Secret-Key: ups_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"amount": 5000,
"currency": "usd",
"customerEmail": "customer@example.com",
"successUrl": "https://yoursite.com/thank-you",
"cancelUrl": "https://yoursite.com/checkout"
}'
navigate select