Payment Flow
Understand the complete payment lifecycle from order creation to settlement.
This guide explains the complete payment flow from order creation to completion.
Flow Overview​
Detailed Steps​
1. Order Creation​
The merchant creates a payment order with transaction details.
Order State: pending
Required Data:
- Amount and currency
- Success/failure/callback URLs
- Merchant reference
2. Payment Link Creation​
Generate a payment URL for the customer.
Link State: active
Optional Configuration:
- Link lifetime (default: 1 hour)
- Language preference
- Payment flow (direct/interactive)
- Pre-selected payment method
3. Customer Redirect​
Redirect the customer to the payment page.
// Redirect customer
header('Location: ' . $paymentUrl);
exit;
Or use JavaScript:
window.location.href = paymentUrl;
4. Payment Method Selection​
Customer sees the payment page:
Available Methods depend on:
- Currency
- Amount (min/max limits)
- Country
- Merchant configuration
5. Payment Processing​
Customer completes the payment with their chosen method.
Processing States:
- Submitting to payment provider
- Waiting for bank response
- Verifying transaction
6. Payment Result​
The payment completes with a success or failure.
Success Path:
Payment Processing → Completed → Webhook → Redirect to success_url
Failure Path:
Payment Processing → Failed → Webhook → Redirect to failure_url
7. Webhook Notification​
Paysera sends a callback to your server.
Webhook Contains:
- An
eventobject (type+name) identifying what changed - The order state (or, for thin payment events, the affected payment) — branch on
order.status/payment.status, not on the event name - Timestamps
See the Webhook Events Reference for the exact events and payloads.
8. Customer Redirect​
Customer is redirected back to your site.
Success URL receives:
- Query parameters you included in success_url
- Customer lands on thank you page
Failure URL receives:
- Query parameters you included in failure_url
- Customer can retry or contact support
Complete Sequence Diagram​
Alternative Flows​
Bank Transfer (Pending)​
Bank transfers may remain pending until the customer completes the transfer:
Pending State:
- Customer receives bank details
- Order stays in
pendingstatus - Webhook sent when bank confirms transfer
Multiple Payment Attempts​
A customer may fail and retry:
Payment Link Expiration​
Timing Considerations​
| Stage | Typical Duration |
|---|---|
| Order + Link creation | < 1 second |
| Customer decision | Varies |
| Payment processing | 5-30 seconds |
| Webhook delivery | < 5 seconds |
| Redirect | < 1 second |
Error Handling​
Network Errors​
If your server doesn't receive the webhook:
- Paysera retries (5s, 60s, 3600s)
- Query order status as backup
Payment Provider Errors​
If the bank/gateway fails:
- Customer sees error message
- Can retry with same or different method
- Order remains in
pendingstatus
Timeout Handling​
- Payment links expire after configured lifetime
- Create a new link if needed
- Order can be reused for new links