Payments
Payment Flow
In principle, the Checkout Session flow has 5 steps (as shown in the diagram below):
Your customer click a "Pay by Bank" button. It trigger a request to your backend to create a Checkout Session
On your backend side, create a Checkout Session using your API Key.
Mentium API will return you the Checkout Session with a Checkout URL
Redirect your customer to this Checkout URL
Customer complete the payment
Once payment is complete, the customer is redirected to the
Success URL
you provided.
Creating a Checkout Session
In order to accept a payment through your website or using a Mentium Link, you need to start by creating a Checkout Session.
Request parameters
You must provide either a valid customerId
or customerDetails. If customerDetails
is specified it will create a customer or use the existing customer if the email is already used.
Parameter | Required | Type | Description |
---|---|---|---|
| yes | number | A positive number. The amount charged to your customer |
| no ( | string | A valid Customer ID |
| no ( | object | A JSON object that contains your customer information: |
| no | string | The URL the customer will be directed to after the payment or subscription creation is successful. e.g. |
| no | string | The URL the customer will be directed to after the payment failed. |
| no | string | If set, a back button will be displayed and customers will be directed to this URL if they decide to cancel payment and return to your website. |
Note: To create a checkout session, your seller must be VERIFIED
. Otherwise you will get an error.
Checkout Session Object
Property | Description |
---|---|
| The unique CheckoutSession ID |
| The amount of charged to the customer (in USD) |
| The customer details (first name, last name, email and phone). Required unless |
| The customer details (first name, last name, email and phone). Required unless |
|
|
| The account ID of the person who will receive the payment |
| The amount that will be paid to the account ID provided in |
| The URL the customer will be directed to after the payment or subscription creation is successful. e.g. |
| The URL the customer will be directed to after the payment failed. |
| If set, a back button will be displayed and customers will be directed to this URL if they decide to cancel payment and return to your website. |
Error codes
When the user confirms the payment it is possible that the payment fails. An error code is passed to the onError
callback function. Error code is a short string with a brief explanation.
Error Type | Description | Next steps |
---|---|---|
| The customer bank account has been closed | The customer must use a different bank account |
| The balance of the charged bank account is not available. | The customer must use a different bank account You can also contact Mentium support at support@mentium.io |
| The balance of the charged bank account is not enough to cover the transaction. Note: It's required to have at least twice the transaction amount on the bank account | The customer must use a different bank account |
| A payment with the same informations has been submitted in the last 5min | Verify the provided |
| An unexpected error occurred during the transaction. | Contact Mentium support at support@mentium.io |
As the payments are created, processed, and finalised, they go through a number of states that you will get as an API response, through webhook notifications, and in the Dashboard.
Don't hesitate to reach out with any questions or feedback. You can email Mentium directly at support@mentium.io, or join our discord server.
Last updated