Payments
Overview
When a user clicks the "Pay with Fliz Pay" button on your website, your system should initiate an API call to the Fliz endpoint https://api.flizpay.de/transactions
. This call generates a redirect URL that leads to the Fliz checkout page. The contents of this URL will vary depending on the user's device:
- For
desktop
users, the URL will contain aQR code
. This QR code will encode the order information, which our app will then use to process the transaction. - For
mobile
users, the URL will include adeep link
containing all the necessary information to redirect the user to the Fliz app.
Your website should display this URL within an iframe, allowing Fliz to handle the transaction process. Once the payment is complete on our end, the user will be redirected back to your specified success or failure page, depending on the outcome of the transaction.
Additionally, your server will receive a notification through our webhook, indicating whether the transaction succeeded or failed.
Making the API Call
Assuming you have the necessary API key, you can proceed to make the API call. Here's an example using curl:
curl --request POST \
--url https://api.flizpay.de/transactions \
--header 'X-API-key: YOUR_API_KEY' \
--header 'X-Client-Type: YOUR_CLIENT_TYPE' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"amount": 10000,
"currency": "EUR",
"externalId": "order101",
"successUrl": "https://shop.com/success",
"failureUrl": "https://shop.com/failure",
"metadata": { "internalCustomerId": "customer_10456" }
}'
Headers
Header | Description | Example |
---|---|---|
X-API-KEY | The API key to authenticate | 935b978d2ye195459dmba139053e38e0k096ef729e14326796e293412f69ab05 |
Body params
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
amount | integer | Yes | The cart total | 10000 |
currency | string | Yes | The currency of the amount field | EUR |
externalId | string | Yes | Your unique reference for the current cart | order101 |
successUrl | uri | No | Your store URL for fliz to redirect to if payment is successfull | yourshop․com/success?transactionReference=abcderfkrke |
failureUrl | uri | No | Your store URL for fliz to redirect to if payment is fails | yourshop.com/failure |
metadata | object | No | Any key-value pair you wish to store with a Fliz transaction | "internalCustomerId": "customer_10456" |
Response
Field | Description | Example |
---|---|---|
redirectUrl | The Fliz checkout Url, it contains query parameter reference which points to your transaction | checkout.flizpay.de/reference=2aeea37eba1d127b1c03bdce7f8fecaf |
Response and Redirect
After successfully submitting a payment request to Fliz, the following steps occur:
- Fliz creates a new transaction object in our database. This object contains all the details of your transaction and is assigned a status of "pending". The transaction is linked to your unique internal accountId for reference.
- Fliz generates a redirect URL associated with this newly created pending transaction. This URL is our checkout page with the transaction reference as query parameter.
- You should open the provided redirect URL within an iframe on your website. This allows your customer to view and complete the payment process securely through Fliz's interface, without leaving your site.
Completing the payment
Once the customer reaches the Fliz checkout page, they will be asked to authorize the payment with their bank on our app. After the payment process is completed, the user will be redirected to one of two possible URLs provided by your store depending on the outcome:
successUrl
: If the payment is successfully processed.failuerUrl
: If the payment fails for any reason.
Both the success and failure URLs will include the following data as query parameters:
Field | Type | Description |
---|---|---|
externalId | string | The id that you provided when creating the transaction. |
Regardless of the payment outcome, Fliz will also send a POST request to the callback URL specified in your Fliz Dashboard. This request will inform your server about the payment status.
You should update the state of your order based on this request. For more detailed information on this process, please refer to the Webhooks section on the next page.