Payment Page
The payment page allows you to request a payment from a customer together with the customer experience for the payment. Funds will be moved from the customer’s mobile money wallet to your account in pawaPay.
In this guide, we will go through some different use cases and make sure the payment statuses are in sync between you and pawaPay.
If you haven’t already, check out the following information to set you up for success with this guide.
What you should know
Understand some considerations to take into account when working with mobile money.
How to start
Sort out API tokens and callbacks.
What does it look like
The pawaPay Payment Page allows you to quickly integrate mobile money into your website or mobile app providing:
- A user experience for your customers that is optimised for mobile money.
- Responsive design that works on desktop and mobile.
- Low code integration supporting all countries and providers.
- Support for both e-commerce and e-wallet use cases.
With just a single API call and a redirect, the customers can pay you.
Enter details
Authorise the payment
All done
It is also integrated with the rest of the pawaPay Merchant API, providing benefits such as:
- Phone numbers are validated to be in the correct format.
- The provider to use for the payment is predicted based on the entered phone number.
- Minimum and maximum transaction limits are always up to date and validated.
- When new countries or providers are enabled, they are available for your customers immediately.
- Information about provider downtime is integrated into the user experience.
- And many more improvements to come…
How to use it
Let’s take a look at a couple of different use cases for the Payment page. Then we will also see how to handle payment results.
Payment page for all countries
The payment page can support accepting a payment from any country in any amount below the transaction limits for the provider.
We do that using the Deposit via payment page endpoint.
We ask you to generate a UUIDv4 depositId
to uniquely identify the deposit that will be processed using the payment page.
This is so that you always have a reference to the deposit you are expecting, 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 depositId in your system before initiating the deposit with pawaPay.
The returnUrl
specifies where the customer should be redirected to after they have gone through the payment process.
The reason
field is optional. It will be shown on the payment page to the customer to indicate what they are paying for.
The payment page allows them to choose the country from the dropdown.
Payment page with fixed phone number
If you have registered users who should only use the number that they signed up with for payments, you can fix the phone number on the payment page.
The msisdn
fixes the mobile money wallet that can be used for this payment.
When collecting the phone number, we strongly recommend using our predict provider endpoint. It validates the phone number and returns it in a format that works for use with the payment page.
The payment page only allows them to choose the amount to pay.
Payment page with fixed amount
In case you know how much the customer should be paying, but they can choose the mobile money wallet they want to pay from, you can fix the amount as well.
The amount
specifies the amount that can be used for this payment.
Providers have transaction limits. You can use the active configuration endpoint to validate the amount is within the transaction limits.
The payment page will fail to initiate if the amount is out of bounds.
It is not possible to fix the amount
without specifying the country
.
The payment page will allow the customer to specify the phone number of the mobile money wallet they are paying from.
Get a payment page with fixed amount and phone number
When you have only registered users and the amount is predetermined, you can initiate the payment page to fix those parameters so the customers cannot change them.
We do that using the Deposit via payment page endpoint.
In the request we have specified the msisdn
(phone number) that must be used for the payment.
We have also fixed the amount
to 100 so it cannot be changed by the customer.
We then need to take the customer to the payment page
In the response you will receive the redirectUrl
.
You should redirect the customer to the redirectUrl
.
Once they have completed the payment process, they will be redirected to the returnUrl
you provided in the request.
And done!
We’ve now created a payment page and redirected the customer to it.
Now let’s take a look at how to find out whether the payment was completed successfully.
How to find out the payment result
How do I find out if the payment was completed?
When the customer initiates the payment by pressing “Pay” on the payment page, the deposit will be registered in pawaPay with the depositId
you specified.
When the payment completes you will receive a deposit callback with the final status of the payment.
If you have not configured callbacks, you can poll the check deposit status endpoint.
Please note that the deposit will only be initiated when the customer presses the pay button.
If they abandon the payment page, the deposit will be NOT_FOUND
and should be considered FAILED
after 15 minutes.
On your returnUrl
you should validate the final status of the payment by either confirming the callback has been received or using the check deposit status endpoint.
The payment page session will be active for 15 minutes after which it will expire. No callback will be delivered on expiration.
Also, if the customer abandons the payment page, no callback will be delivered.
And done!
We now know what happened to the payment and can make sure it’s reflected accurately.
Let’s now take a look at how to handle failed payments.
Handling processing failures
Handling failures during processing
If the status
of the deposit is FAILED
you can find further information about the failure from failureReason
.
It includes the failureCode
and the failureMessage
indicating what has gone wrong.
The failureMessage
from pawaPay API is meant for you and your support and operations teams.
You are free to decide what message to show to the customer.
Find all the failure codes and implement handling as you choose.
We recommend showing the customer the failure reason and an easy way to retry the payment in case of failure.
A new payment page needs to be created with a new depositId
for the retry.
We have standardised the numerous different failure codes and scenarios with all the different providers.
The quality of the failure codes varies by provider.
The UNSPECIFIED_FAILURE
code indicates that the provider indicated a failure with the payment, but did not provide any more specifics on the reason of the failure.
In case there is a general failure, the UNKNOWN_ERROR
failureCode would be returned.
And done!
We have now also taken care of failures that can happen during payment processing. This way the customer knows what has happened and can take appropriate action to try again.
Now let’s see how to ensure that payment statuses between your system and pawaPay are in sync.
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
All statuses should be checked defensively without assumptions.
Handling network errors and system crashes
The key reason we require you to provide a depositId
for each payment is to ensure that you can always ask us what the status of a payment is, even if you never get a response from us.
You should always store this depositId
in your system before initiating a deposit.
The important thing to notice here is that we only mark a payment as FAILED when there is a clear indication of its failure.
We use the check deposit status endpoint when in doubt whether the payment was ACCEPTED
by pawaPay.
Implementing an automated reconciliation cycle
Implementing the considerations listed above avoids almost all discrepancies of payment statuses between your system and pawaPay. When using callbacks to receive the final statuses of payments, issues like network connectivity, system downtime, and configuration errors might cause the callback not to be received by your system. To avoid keeping your customers waiting, we strongly recommend implementing a status recheck cycle.
This might look something like the following.
Having followed the rest of the guide, with this simple reconciliation cycle, you should not have any inconsistencies between your system and pawaPay. Having these checks automated will take a load off your operations and support teams as well.
Payments in reconciliation
When using pawaPay, you might find that a payment status is IN_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.
What to do next?
We’ve made everything easy to test in our sandbox environment before going live.
Test different failure scenarios
We have different phone numbers that you can use to test various failure scenarios on your sandbox account.
Review failure codes
Make sure all the failure codes are handled.
Add another layer of security
To ensure your funds are safe even if your API token should leak, you can always implement signatures for financial calls to add another layer of security.
And when you are ready to go live
Have a look at what to consider to make sure everything goes well.