These are general best practices and we encourage you to always inculcate this practice when building services with payment API.
Make asynchronous calls
Always try to handle all payments asynchronously. After disbursement, always check the transaction status after a few seconds to confirm the payment was successfully sent.
Ensure you implement status elegantly to avoid rate limiting. You can check the status of a request after a few seconds and double the wait time before the next status check.
Map error response as much as you can and ensure only user-friendly error is returned to users.
Always treat a request as a success after you’ve conclusively determine the status as success. Any response with statusCode not equal to zero should be treated as not successful or pending depending on the endpoint being consumed.
Leverage Webhook where applicable
Create a service to listen to your webhook and process accordingly. Only initiate status check after the receiving webhook confirms payment is received to avoid excessive status check and rate-limiting.
Ensure hash parsed to your webhooks are validated, recreate the hash and compare it to what was received. See Hash Handling for more details on how to generate hash.
Resolve Customer Details
When making bill payments, always get an appropriate list of services applicable to the biller and ensure to validate the reference provided by the customer.
When making a bank payment, ensure to validate the bank account details provided by the customer before making the actual transfer.
Updated about 1 year ago