What you should know
How to start
Initiating a payout
Let’s start by hardcoding everything. Throughout this guide we will be taking care of more and more details to make sure everything is accurate.Initiate the payout
payoutId to uniquely identify this payout.
This is so that you always have a reference to the payout you are initiating, even if you do not receive a response from us due to network errors.
This allows you to always reconcile all payments between your system and PawaPay.
You should store this payoutId in your system before initiating the payout with PawaPay.The amount and currency should be relatively self-explanatory.
This is the amount that will be disbursed to the customer.
Any fees will be deducted from your PawaPay wallet balance on successful completion of the payout.
Principal amount (the amount specified in amount) will be reserved from your PawaPay wallet.
If the payout fails, the funds will be returned to your PawaPay wallet immediately.Then the provider and phoneNumber specify who is paying exactly.
Mobile money wallets are identified by the phone number, like bank accounts are by their IBAN.
The provider specifies which mobile money operator this wallet is registered at. For example MTN Ghana or MPesa Kenya.You will receive a response for the initiation.status shows whether this payout was ACCEPTED for processing or not.
We will go through failure modes later in the guide.The payout will be processed
Get the final status of the payment
status which is COMPLETED indicating that the payout has been processed successfully.And done!
- How to make this easy to maintain
- How to handle failures so that discrepancies between your system and PawaPay don’t happen
- And much more…
Getting the phone number from the customer
To make a payout to a customer, we need to have their valid phone number and need to know the provider they are using. We suggest validating that information when you are receiving that information whether that is during account signup or a separate process.Asking for the phone number
prefix within the country object.
This is the country calling code for that country.
We recommend showing that in front of the input box for entering the phone number.
This makes it clear that the number entered should not include the country code.We have also added flag to the country object to make it look a little nicer.The providers that have been configured on your PawaPay account for payouts are in the providers property.
It includes both the provider code to use in calls to initiate a payout and the displayName for it.
To enable new providers being automatically added to your payout flows, we’ve also added the logo of the provider as the logo.
This way it is possible to implement the payout flow dynamically, so that when new providers are enabled on your PawaPay account, they become available for your customers without additional effort.Validating the phone number
prefix to what was entered as the phone number.You can now send it to validation. We will handle basic things like whitespace, characters etc.
We also make sure the number of digits is correct for the country and handle leading zeros.phoneNumber is the sanitized MSISDN format of the phone number that you can use to initiate the payout.
We strongly recommend using this endpoint for validating numbers especially due to some countries not strictly following ITU E.164.Also, in the response, you will find the provider. This is the predicted provider for this phoneNumber.
We recommend preselecting the predicted provider for the customer.
In most countries we see very high accuracy for predictions removing another step from the payment experience.We recommend making it possible to override the prediction as the accuracy is not 100%.Initiate the payout
Done again!
Handling amounts
Depending on your use case, the amount will either be chosen by the customer or determined by you. As the support for decimals in amount differs by provider and transaction limits apply, let’s take a look at how to handle that.Decimals support
NONE and TWO_PLACES.
It’s easy to provide dynamic validation now that is appropriate for the provider.
If the amount is determined by your system, you can apply rounding rules based on the above.If you are preparing the payout amounts beforehand and do not need to do it dynamically, this information is also documented in the providers section.Transaction limits
minAmount and maxAmount.And done!
Handling enqueued payouts and provider availability
Providers might have downtime in processing payouts. Let’s take a look at how to best handle cases when payout processing may be delayed or temporarily unavailable.Checking if the provider is operational
OPERATIONAL- the provider is available and processing payouts normally.DELAYED- the provider is having downtime and all payout requests are being enqueued in PawaPay.CLOSED- the provider is having downtime and PawaPay is rejecting all payout requests.
DELAYED) or is not possible at the moment and they can try again later (CLOSED).If your payouts are not initiated by customers, you can validate the status of the provider and delay initiating payouts while the provider is unavailable (CLOSED).Handling delayed processing
DELAYED will be ACCEPTED on initiation.
They will then be moved to the ENQUEUED status.
Our 24/7 payment operations team will be monitoring the provider for when their payout service becomes operational again.
When that happens, the payouts will get processed as usual.To find out whether a payout is enqueued, you can check payout status.ENQUEUED status.
If the payout is already in PROCESSING status, the request will be rejected.You will receive a callback with a FAILED status when cancellation has been completed.Handling failures on initiation
Having implemented the above suggestions payout initiations should never be rejected. Let’s take a look at a couple of edge cases to make sure everything is handled.Handling HTTP 500 with failureCode UNKNOWN_ERROR
UNKNOWN_ERROR failureCode indicates that something unexpected has gone wrong when processing the payment.
There is no status in the response in this case.It is not safe to assume the initiation has failed for this payout.
You should verify the status of the payout using the check payout status endpoint.
Only if the payout is NOT_FOUND should it be considered FAILED.We will take a look later in the guide, how to ensure consistency of payment statuses between your system and PawaPay.And done!
Handling processing failures
Handling failures during processing
status of the payout is FAILED you can find further information about the failure from failureReason.
It includes the failureCode and the failureMessage indicating what has gone wrong.Find all the failure codes and implement handling as you choose.And done!
Ensuring consistency
When working with financial APIs there are some considerations to take to ensure that you never think a payment is failed, when it is actually successful or vice versa. It is essential to keep systems in sync on the statuses of payments. Let’s take a look at some considerations and pseudocode to ensure consistency.Defensive status handling
Handling network errors and system crashes
payoutId for each payment is to ensure that you can always ask us what is the status of a payment, even if you never get a response from us.You should always store this payoutId in your system before initiating a payout.ACCEPTED by PawaPay.Implementing an automated reconciliation cycle
Payments in reconciliation
When using PawaPay, you might find that a payment status isIN_RECONCILIATION.
This means that there was a problem determining the correct final status of a payment.
When using PawaPay all payments are reconciled by default and automatically - we validate all final statuses to ensure there are no discrepancies.
When encountering payments that are IN_RECONCILIATION you do not need to take any action.
The payment has already been sent to our automatic reconciliation engine and it’s final status will be determined soon.
The reconciliation time varies by provider. Payments that turn out to be successful are reconciled faster.