Skip to main content
After the customer completes checkout, they’re sent back to your website. Here’s what happens.

What Ozura Does Automatically

When a customer successfully pays:
1. Customer clicks "Pay Now"

2. Payment is processed

3. Ozura marks the session as "completed" ← Automatic!

4. Customer is redirected to your successUrl with payment details
Ozura marks the session complete automatically before redirecting – you don’t need to call a “complete” endpoint. However, you should verify the session status server-side before fulfilling orders to prevent URL spoofing.

Possible Outcomes

OutcomeWhere Customer Ends UpSession Status
Payment succeededYour successUrlcompleted
Fixable error (card declined)Stays on checkout – inline error shownpending
Unrecoverable error (system issue)Your errorUrl with error detailsfailed
Customer cancelledYour cancelUrlcancelled
Session expiredOzura expiration page → button → your cancelUrlexpired

Handling Success

When payment succeeds, the customer is redirected to your successUrl with payment details in the URL:
https://yoursite.com/success?success=true&sessionId=session_xxx&transactionId=txn_abc123&amount=25.00&currency=USD&cardLastFour=4242&cardBrand=visa&firstName=John&lastName=Doe&email=john@example.com

Success URL Parameters

Transaction Info:
ParameterWhat It IsExample
sessionIdYour session ID (for verification)session_xxxxxx
transactionIdUnique payment IDtxn_abc123
amountAmount charged25.00
currencyCurrency codeUSD
Card Info:
ParameterWhat It IsExample
cardLastFourLast 4 digits of card4242
cardBrandCard networkvisa
Customer Billing Info:
ParameterWhat It IsExample
firstNameCustomer first nameJohn
lastNameCustomer last nameDoe
emailCustomer emailjohn@example.com

Example: Success Page (JavaScript)

// Parse URL parameters
const params = new URLSearchParams(window.location.search);
const sessionId = params.get('sessionId');
const transactionId = params.get('transactionId');
const amount = params.get('amount');

// Parse metadata (JSON-encoded)
let metadata = {};
try {
  metadata = JSON.parse(params.get('metadata') || '{}');
} catch (e) {}

console.log('Order ID:', metadata.orderId);

Handling Errors

Fixable Errors (Stay on Checkout)

Card declined, wrong CVV, invalid card number – the customer stays on the checkout page and sees an inline error. They can correct their info and try again.

Unrecoverable Errors (Redirect to errorUrl)

System errors, connectivity issues – the customer is redirected to your errorUrl with error details:
https://yoursite.com/error?success=false&errorCode=SYSTEM_ERROR&error=Payment+service+unavailable&cancelUrl=https://yoursite.com/cart
ParameterDescriptionExample
errorCodeError type codeSYSTEM_ERROR, AUTH_ERROR
errorHuman-readable messagePayment service unavailable
cancelUrlReturn URL (your cancelUrl)https://yoursite.com/cart

Always Verify Before Fulfilling Orders

Always verify payments server-side before fulfilling orders.
A malicious user could attempt to visit your success URL directly. Always check the session status:
app.get('/success', async (req, res) => {
  const { sessionId } = req.query;
  
  // Check session status with Checkout API
  // No headers required - session ID acts as access token
  const response = await fetch(`https://checkout.ozura.io/api/sessions/${sessionId}`);
  const data = await response.json();
  
  if (data.data.session.status === 'completed') {
    // ✅ Session verified as completed
    // ⚠️ YOUR RESPONSIBILITY: Fulfill the order with your business logic
    await updateOrderStatus(sessionId, 'paid'); // YOUR implementation
    res.render('success');
  } else {
    // Not confirmed - don't fulfill
    res.redirect('/error?error=Payment+not+confirmed');
  }
});

Session Statuses

StatusWhat It MeansRedirects To
pendingWaiting for payment (not done yet)
completedPayment successfulsuccessUrl
failedPayment attempt failederrorUrl
cancelledCustomer clicked cancelcancelUrl
expiredSession timed out (30 minutes)cancelUrl

Summary

StepWho Does It
Process paymentOzura (automatic)
Mark session completeOzura (automatic)
Redirect to successUrlOzura (automatic)
Show confirmationYou (your business logic)
Verify session statusYou (recommended for security)
Fulfill orderYou (your business logic: emails, database, shipping, etc.)

Next Steps