Error Handling & Troubleshooting
The payabl. SDKs surface errors at every stage — initialization, network, and payment processing. This guide shows where errors appear in your code, how to diagnose common scenarios, and what to include when you report an issue.
How errors surface in the SDK
Errors reach your app through two channels:
1. The payment result. Every payment flow returns a result with three outcomes — completed, cancelled, or failed. Always handle all three:
Android:
when (result) {
is PBLPaymentResult.Completed -> { /* update order status */ }
is PBLPaymentResult.Canceled -> { /* user backed out */ }
is PBLPaymentResult.Failed -> { /* surface the failure, allow retry */ }
}iOS:
switch result {
case .completed: break // update order status
case .canceled: break // user backed out
case .failed: break // surface the failure, allow retry
}2. SDK errors outside the payment result (iOS). Configuration and session problems raised before or outside a payment flow are delivered through PBLErrorDelegate:
extension CartViewModel: PBLErrorDelegate {
func errorOccured(error: any Error) {
// e.g., configuration or session issues
}
}On Android, wrap PayablSDK.init and flow launches in a try/catch to capture initialization errors.
Common error scenarios
| Scenario | Example | What to check |
|---|---|---|
| Initialization errors | The SDK fails to initialize due to missing or invalid configuration parameters | Your PBLConfiguration values and setup — see Android SDK / iOS SDK |
| Session errors | Session rejected at launch | The session was reused, expired, or created for a different environment — create a fresh session per attempt (Setup Your Server) |
| Environment mismatches | Sandbox session with production SDK settings, or vice versa | Backend endpoint and SDK environment must match — see Testing |
| Network connectivity | The app cannot reach payabl. servers | Internet connection, firewall settings, and proxies blocking requests |
| Payment processing failures | Transactions declined or failing | Retry with the sandbox test cards to separate integration issues from payment declines — declines such as insufficient funds come from the card issuer and are expected in normal operation |
| Method-specific setup | One payment method missing or failing while others work | That method's setup page — deep links for Instant Bank Transfer, registration for Google Pay, certificate exchange for Apple Pay |
Troubleshooting steps
- Reproduce and isolate — replicate the error in the sandbox and note the exact steps.
- Verify configuration — session credentials fresh, environment matching, method-specific setup complete.
- Review logs — monitor Logcat (Android) or the Xcode console (iOS) for error messages and stack traces during SDK operations.
- Test connectivity — confirm the device/simulator has internet access and nothing is blocking requests.
- Compare against the demo app — the demo apps implement every flow correctly against the sandbox; if the demo works on your device and your integration doesn't, diff your setup against the demo source.
Gateway and card error references
The authoritative transaction status and decline reasons are available on the gateway side (for example, via the notification_url webhook and your transaction records). To understand why payments decline and how to reduce declines, see Declines and Failed Payments. For detailed code catalogs:
- payabl. Response codes — status codes generated and returned by payabl.
- Card issuer error codes
- Mastercard Merchant Advice Codes
When to contact support
If the issue persists, contact [email protected]. To help us resolve your issue quickly, include:
- The
transaction_idorsession_idof the affected payment (returned by your/mobile/initcall) — this lets us locate the exact transaction immediately. - Step-by-step reproduction — what you did, what you expected, what happened instead.
- Your merchant ID, the platform (Android/iOS) and SDK version, and the environment (sandbox/production).
- Logs from Logcat or the Xcode console covering the failure.
Always use the latest SDK version to benefit from the most recent improvements and fixes — check the repository READMEs for current versions.
Updated 8 days ago
