Error Response Format
All API errors follow this structure:HTTP Status Codes
| Code | Meaning | What to Do |
|---|---|---|
400 | Bad Request | Check your request parameters |
401 | Unauthorized | Verify your API keys |
404 | Not Found | Session doesn’t exist |
409 | Conflict | Session already completed/cancelled |
410 | Gone | Session expired |
500 | Server Error | Retry the request |
Two Types of Errors
Ozura Checkout handles errors differently based on whether the customer can fix them:Fixable Errors (Customer Stays on Checkout)
These errors allow the customer to try again without leaving the checkout page:- Card declined
- Insufficient funds
- Invalid card number
- Expired card
- Wrong CVV
- Address verification failed
Unrecoverable Errors (Redirect to errorUrl)
These errors require redirecting the customer away from checkout:- Server/system errors
- Authentication failures
- Network connectivity issues
- Payment processor unavailable
errorUrl with error details in the URL.
Redirect Behavior Summary
| Situation | What Happens | Session Status |
|---|---|---|
| Payment successful | Redirect to successUrl | completed |
| Fixable error (card declined) | Stays on checkout – inline error | pending |
| Unrecoverable error | Redirect to errorUrl | failed |
| Customer cancels | Redirect to cancelUrl | cancelled |
| Session expires | Ozura expiration page → cancelUrl | expired |
Error URL Parameters
When an unrecoverable error occurs, the customer is redirected to yourerrorUrl:
| Parameter | Description | Example |
|---|---|---|
success | Always false | false |
errorCode | Machine-readable error type | SYSTEM_ERROR, AUTH_ERROR |
error | Human-readable message | Payment service unavailable |
cancelUrl | Your cancelUrl (for “return” navigation) | https://yoursite.com/cart |
Error Codes
| Code | Meaning |
|---|---|
SYSTEM_ERROR | Server or connectivity issue |
AUTH_ERROR | Payment service authentication failed |
SESSION_FAILED | Session marked as failed in database |
Building Your Error Page
Recommended Approach: Redirect to Cart with Message
Instead of showing a dead-end error page, redirect customers back to their cart with a popup message: Set your errorUrl to your cart page with a flag:Retry Logic for API Calls
If you get a500 error, it’s safe to retry with exponential backoff:
Network Retry Protection
To prevent duplicate sessions from network issues, use an idempotency key:idempotencyKey twice, you’ll get back the original session instead of creating a duplicate.