Prerequisites
Before starting your integration, ensure you have:Merchant Onboarding
Complete KYB/AML verification and contractual approval
Sandbox Access
Access to test environment for integration and testing
Credentials
Client-Id, RSA key pair (private key stored securely), and keyVersion
Technical Setup
HTTPS-enabled backend and ability to expose webhook endpoint
Choose Your Payment Flow
Select the payment flow that best matches your use case:| Use Case | Recommended Flow | Description |
|---|---|---|
| In-store POS with scanner | Retail Pay | Merchant scans user’s dynamic QR code |
| Printed or on-screen QR | QR Order Pay | User scans merchant’s QR code |
| Mobile app checkout | Link Pay | App-to-app payment redirection |
| Web checkout (desktop) | QR Order Pay or Link Pay | Based on user device |
You may implement more than one flow using the same credentials.
Integration Overview
All Rebell payment integrations follow the same seven core steps:1
Implement Request Signing
Set up RSA-SHA256 authentication for secure API communication
2
Create Payment
Call the appropriate payment API based on your chosen flow
3
Handle Immediate Response
Process SUCCESS, PROCESSING, or FAIL status from initial API call
4
Implement Webhook Endpoint
Receive asynchronous payment notifications from Rebell
5
Handle Final Payment Result
Update order status based on webhook notifications
6
Implement Inquiry API
Use as fallback when webhooks are delayed or for active confirmation
7
Production Deployment
Switch credentials and endpoints from sandbox to production
Step-by-Step Implementation
Step 1: Implement Authentication & Signing
Generate RSA-2048 Key Pair
Generate RSA-2048 Key Pair
Upload Public Key to Rebell
Upload Public Key to Rebell
Upload your public key through the Rebell merchant portal to receive your keyVersion identifier.
Store Private Key Securely
Store Private Key Securely
Store your private key in a Hardware Security Module (HSM) or cloud KMS. Never embed keys in mobile apps or frontend code.
Implement Signing Logic
Implement Signing Logic
Sign every request with these components:
- HTTP method
- Request path
- Client-Id
- Request-Time (ISO 8601 UTC)
- Request body (JSON)
Step 2: Create a Payment
Choose the appropriate endpoint based on your payment flow:- Generate a unique
paymentRequestId(used for idempotency) - Store mapping between
paymentRequestIdand your internal order ID - Log requests and responses (excluding sensitive data)
Step 3: Handle Immediate Response
Evaluate theresult object returned by the API:
- SUCCESS
- PROCESSING
- FAIL
Payment is final
- Payment is authorized and complete
- You can immediately print receipt and deliver goods
- No need to wait for webhook (though you’ll still receive one)
Step 4: Implement Webhooks (Required)
Webhooks are the source of truth for final payment results. Implementation requirements:- Expose an HTTPS POST endpoint
- Verify RSA signature on every webhook
- Make handler idempotent (handle duplicate notifications)
- Update order state only once per payment
- Return 200 OK to acknowledge receipt
Example Webhook Handler
Step 5: Use Inquiry API (Fallback)
Use the Inquiry API only when:- Initial response is
PROCESSING - Webhook is delayed
- POS requires active confirmation
- Poll every 3-5 seconds
- Stop after receiving
SUCCESSorFAIL - Do not exceed retry limits (max 30 seconds)
Inquiry API
Step 6: Map Errors Correctly
Error handling checklist:- Always check
resultStatusfirst - Handle user errors appropriately (rejection, insufficient balance)
- Do not retry business failures
- Retry safely only on network or 5xx errors
- Never reuse a
paymentRequestId
Minimal End-to-End Example
Here’s a complete QR Order Pay flow:1
Create Order
Merchant backend creates order in your system
2
Call API
Call
POST /v1/payments/createQrOrder with signed request3
Display QR
Render the returned QR code to user
4
User Pays
User scans QR and confirms payment in Rebell SuperApp
5
Receive Webhook
Rebell sends webhook notification with final result
6
Complete Order
Merchant backend marks order as PAID and fulfills
This same structure applies to all payment flows (Retail Pay, QR Order Pay, Link Pay).
Testing Checklist
Sandbox Testing
Before requesting production access, verify:Core Functionality
Core Functionality
- All APIs tested in sandbox
- Signing logic validated
- Webhooks received and signature verified
- Inquiry API logic tested
- Idempotency verified (duplicate requests handled correctly)
Error Scenarios
Error Scenarios
Test these failure cases:
- User rejection
- Insufficient balance
- Expired QR code
- Invalid payment code
- Network timeout
- Signature validation failure
Edge Cases
Edge Cases
- PROCESSING status handling
- Delayed webhooks
- Duplicate webhook notifications
- Concurrent payment requests
Go-Live Checklist
Before switching to production:Credentials
- Production credentials configured
- Production public key uploaded
- Sandbox keys removed from production config
Infrastructure
- Webhook endpoint switched to production URL
- HTTPS properly configured
- Load balancing tested
Monitoring
- Logging enabled
- Alerting configured for:
- Webhook failures
- Signature errors
- High PROCESSING rate
Operations
- Internal runbook prepared
- Support team trained
- Rollback plan documented
Common Integration Mistakes
Avoid these common pitfalls:Next Steps
Authentication & Environments
Learn detailed RSA signing and environment configuration
Payment Flows
Explore specific payment methods (Retail Pay, QR Order Pay, Link Pay)
Webhooks
Implement webhook handling and signature verification
Error Handling
Complete reference for error codes and recovery logic
Additional Resources
- Detailed API specs → See individual payment flow sections
- Advanced authentication → See Authentication Deep Dive
- UI/UX guidance → See Product Guides
- Mini App integrations → See Mini App Development