3. Integrate Papi to your webshop
Integrate Papi into your application, including handling payment flows, callbacks, and environment-specific URLs.
Environments
Use the correct environment URLs based on your application's stage:
- Sandbox (Preproduction): For testing purposes.
- URL:
https://paymentapi23i.ibonia.com/
- URL:
- Production: For live transactions.
- URL:
https://api.papi.mg/
- URL:
Payment Flow Overview
The payment process consists of the following steps:
- Create a payment link: Send an API request to generate a payment link for the customer.
- Redirect the customer: Use the returned payment URL to redirect the customer to the secure payment page.
- Process the payment: The customer completes the payment on the secure page.
- Receive a callback: After the payment, the system notifies your server with the payment result (success or failure).
- Handle the result: Update your application based on the payment status from the callback.
Step-by-Step guide to implementing payment integration
This guide will walk you through integrating the payment API step by step, from creating endpoints for redirection to handling callbacks and making payment link requests.
Step 1: Create pages for redirection
You need to set up two pages on your website for redirecting customers after payment:
-
Success URL: This is the page the customer will be redirected to after a successful payment. It can be an existing page (e.g., a product listing page) or a newly created one. Once the page is set up, take note of its URL, as it will be required when making the request to generate a payment link.
-
Failure URL: This is the page the customer will be redirected to after an unsuccessful payment. It is typically an error page, but it can also be an existing page (e.g., a product listing page) with a custom message to inform the customer of the payment failure, rather than the default behavior. Once the page is set up, take note of its URL, as it will be required when making the request to generate a payment link.