Payment dialog
The preferred way to integrate payment service is to use Fliqa's payment dialog:
Prerequisites
- Enable
paymentservice - Create a Point of sale and copy the Point of sale
ID - Whitelist Allowed domains from where the dialog will be triggered OR
- Create an Api key/Api secret pair
Once in production Fliqa must approve all new Points of sale or changes to an existing Point of sale.
The approval process might take some time,
so please make sure all entered data is correct.
Setup
Copy the following code snippet to your HTML page to display the payment dialog:
- Fixed amount dialog
- Custom amount dialog
<head>
<script src="https://assets.fliqa.io/sdk/latest/fliqaComponent.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
...
<button onclick="executePayment()">Bank account</button>
<script>
function executePayment() {
fliqaComponent().then(fliqa => {
fliqa.pay({
production: <false for sandbox testing, otherwise can be omitted>,
accessTokenGet: getAccessToken, // optional
paymentCreatedCallback: paymentCreated, // optional
paymentCompleteCallback: paymentComplete, // optional
dialogCloseCallback: dialogClose, // optional
data: {
payment: {
providerId: <optional: currently only 'Revolut' or 'N26' are supported>,
pointOfSaleId: <point_of_sale_id>,
name: <name_of_transaction>,
description: <description_of_transaction>,
amount: <amount>,
currency: <currency>,
country: <optional_country_pre-select>,
locale: <optional_locale>,
data: [
{ "optional_key": "optional_value" }
]
}
}
});
});
}
function getAccessToken() {
// optional but recommended - provide access token via you backend for SDK channel
return "access_token";
}
function paymentCreated(paymentResponse) {
if (paymentResponse) {
console.log('Payment created: ' + JSON.stringify(paymentResponse));
}
else {
console.log('ERROR: ' + paymentResponse);
}
}
function paymentComplete(paymentResponse) {
if (paymentResponse) {
console.log('Payment complete: ' + JSON.stringify(paymentResponse));
}
else {
console.log('ERROR: ' + paymentResponse);
}
}
function dialogClose(paymentResponse) {
if (paymentResponse) {
console.log('Payment dialog closed for payment: ' + JSON.stringify(paymentResponse));
}
else {
console.log('ERROR: ' + paymentResponse);
}
}
</script>
<head>
<script src="https://assets.fliqa.io/sdk/latest/fliqaComponent.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
...
<button onclick="executePayment()">Bank account</button>
<script>
function executePayment() {
fliqaComponent().then(fliqa => {
fliqa.pay({
production: <false for sandbox testing, otherwise can be omitted>,
accessTokenGet: getAccessToken,
paymentCreatedCallback: paymentCreated,
paymentCompleteCallback: paymentComplete,
dialogCloseCallback: dialogClose,
data: {
defaultAmount: <default_amount>,
minAmount: <min_allowed_amount>,
maxAmount: <max_allowed_amount>,
payment: {
providerId: <optional: currently only 'Revolut' or 'N26' are supported>,
pointOfSaleId: <point_of_sale_id>,
name: <name_of_transaction>,
description: <description_of_transaction>,
currency: <currency>,
country: <optional_country>,
locale: <optional_locale>,
data: [
{ "optional_key": "optional_value" }
]
}
}
});
});
}
function getAccessToken() {
// optional but recommended - provide access token via you backend for SDK channel
return "access_token";
}
function paymentCreated(paymentResponse) {
if (paymentResponse) {
console.log('Payment created: ' + JSON.stringify(paymentResponse));
}
else {
console.log('ERROR: ' + paymentResponse);
}
}
function paymentComplete(paymentResponse) {
if (paymentResponse) {
console.log('Payment complete: ' + JSON.stringify(paymentResponse));
}
else {
console.log('ERROR: ' + paymentResponse);
}
}
function dialogClose(paymentResponse) {
if (paymentResponse) {
console.log('Payment dialog closed for payment: ' + JSON.stringify(paymentResponse));
}
else {
console.log('ERROR: ' + paymentResponse);
}
}
</script>
Make sure that you include viewport to your hosting page head HTML:
<meta name="viewport" content="width=device-width, initial-scale=1">
If not included, Fliqa's dialog size and scale might be off
Dialog data
production(boolean / optional): set to false when testing withSandboxotherwise true or can be omittedaccessTokenGet(optional): reference to method to deliver access token, not needed if domain is whitelistedpaymentCreatedCallback(optional): reference to method to receive initial payment when user starts process with bankpaymentCompleteCallback(optional): reference to method to receive completed payment (if it was completed) when user ends paymentdialogCloseCallback(optional): reference to method that is triggered when user closes dialog
Payment data
User entered amount (optional)
defaultAmount(decimal / optional): default / starting amount when user can enter amountminAmount(decimal / optional): min amount that user can enter (including)maxAmount(decimal / optional): max amount that user can enter (including)
Details
providerId(optional): preselect payment provider. Currently supported: 'Revolut', 'N26'pointOfSaleId(mandatory): point of sale id configured in admin portalname(mandatory): name of transaction (ie. Top-up, Payment for ...)description(mandatory): description of transaction (will be visible on customers bank side)currency(mandatory): ISO currency codecountry(optional): ISO country code, preselect country (if country is possible)locale(optional): preselect user locale, otherwise will default to customer machine locale. Currently supporteddata(optional): key, value pairs to use as reference for payment internally by tenant (ie. customer id, cart id ...)
Dialog events
accessTokenGet
You can provide a valid access token for the given environment and sdk channel if desired.
If not provided your domain and Point of sale ID will be used to start up the dialog.
The event is triggered as soon as the dialog starts up.
paymentCreatedCallback
New payment created event is triggered as soon as the end-user selects his bank/provider.
The paymentResponse JSON will be populated with all known data at this point of the transaction.
paymentCompleteCallback
The payment compete event is triggered as soon as the payment has been approved or denied.
The paymentResponse JSON will be populated with all known data at this point of the transaction.
Source account number IBAN might not be known at this point.
The end-user might abandon the payment process on the bank side, in this case the complete event will not be triggered.
Payment response JSON examples
Payment response is analog to Payment details JSON
- Payment created
- Payment completed
{
"paymentId": <payment_id>,
"status": "started",
"created": "2024-08-14T09:51:23.777Z",
"modified": "2024-08-14T09:51:25.286Z",
"paymentData": [
{
"name": "redirect",
"label": "Redirect",
"additional_data": null,
"properties": null,
"value": <redirect_url>
}],
"providerId": <provider_id>,
"name": <payment_name>,
"description": <payment_description>,
"pointOfSaleId": <point_of_sale_id>,
"sourceIban": null,
"sourceName": null,
"targetIban": <point_of_sale_iban>,
"targetName": <point_of_sale_public_name>,
"amount": 0.01,
"currency": "EUR",
"country": "SI",
"data": [
{
"key": "custom_key",
"value": "custom_value"
}],
"locale": "en"
}
{
"paymentId": <payment_id>,
"status": "success",
"created": "2024-08-14T09:44:39.329Z",
"modified": "2024-08-14T09:46:24.981Z",
"paymentData": [
{
"name": "status",
"label": "Payment status",
"additional_data": null,
"properties": null,
"value": null
}],
"providerId": <provider_id>,
"name": <payment_name>,
"description": <payment_description>,
"pointOfSaleId": <point_of_sale_id>,
"sourceIban": <account_holder_iban>,
"sourceName": <account_holder_name>,
"targetIban": <point_of_sale_iban>,
"targetName": <point_of_sale_public_name>,
"amount": 0.01,
"currency": "EUR",
"country": "SI",
"data": [
{
"key": "custom_key",
"value": "custom_value"
}],
"locale": "en"
}