Checkout
Checkout is a simple, secure and fast way to provide your customers with a seamless checkout experience. It is a hosted payment page that is easy to integrate with your website or application.
Checkout uses a session-based approach to handle payments. This means that you first create a checkout session and then redirect your customer to the checkout page. The checkout page will then use the session to process the payment.
Integration guide
To integrate Checkout with your website, you need the following:
- Paypack account
- Paypack application
- Register your checkout page
Paypack account
To create a Paypack account, visit the Paypack website and click on the Get Started button. You will be redirected to the sign up page where you will be asked to provide your email address and a password. Once you have provided the required information, click on the Register button to create your account.
Paypack application
To create a Paypack application, navigate to the applications tab and click on the Create Application button. You will be asked to provide a name for your application and a description. Once you have provided the required information, click on the Create button to create your application.
Register your checkout page
Once you have created your Paypack application, you need to register your checkout page. To do this, click on the configure button on the application row. You will be redirected to the application configuration page where you will be asked to provide details regarding your checkout. Once you have provided the required information, click on the Save button to save your changes.
Creating a checkout session
To create a checkout session, you need to make a POST request to the following endpoint:
Endpoint
https://checkout.paypack.rw/api/checkouts/initiate
Request Headers
Field | Type | Description |
---|---|---|
Accept | string | application/json |
Content-Type | string | application/json |
Body
Field | Type | Description |
---|---|---|
items | array | An array of items to be purchased. |
app_id | string | The application key. |
string | The customer's email address. | |
Example
curl --location --request POST 'https://checkout.paypack.rw/api/checkouts/initiate' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data-raw '{
"items": [ { "name": "T-shirt", "price": 1000, "quantity": 1 } ],
"app_id": "xxxxx-xxxx-xxxx-xxxx-xxxxxxx",
"email": "mail@mail.com"
}'
Response
Field | Type | Description |
---|---|---|
session_id | string | The checkout session id. |
amount | int | The total amount to be paid. |
kind | string | The kind of session you have created session:created ,session:commited ,session:processed |
payment_link | string | The payment link to redirect the customer to. |
created_at | string | The date and time the session was created. |
Process a checkout session
To process a checkout session, you need to support webhooks to receive the session:processed
event. This event is triggered when the customer has completed or cancelled the payment process. You can then process the payment and update the order status.
Troubleshooting
Phone number is not found
When you have an unverified account, you are allowed to use no more than 3 phone numbers which are registered to your account. To resolve this issue, you need to register the phone number to your account by navigating to the Approved numbers tab. You can also verify your account to be able to use any phone number.