Our Web Component renders BLIK in your payment form, and presents the waiting screen while the shopper completes the payment in their bank app.
Make sure to use the latest version of our Components. For more information, see Release Notes.
Before you begin
This page explains how to add BLIK to your existing Web Components integration. The Web Components integration works the same way for all payment methods. If you haven't done this integration yet, refer to our Components integration guide.
Before starting your BLIK integration:
- Make sure that you have set up your back end implementation, and created an instance of
AdyenCheckout
. - Add BLIK in your Customer Area.
Show BLIK in your payment form
To show BLIK Component in your payment form, you need to:
- Specify in your /paymentMethods request:
- countryCode: PL
- amount.currency: Any supported currency. For example, PLN.
- amount.value: The value of the payment, in minor units.
Make sure your AdyenCheckout
configuration has the onAdditionalDetails
event handler, which is required for BLIK.
-
Add the BLIK Component:
a. Create a DOM element for BLIK, placing it where you want the form to be rendered:<div id="blik-container"></div>
b. Create an instance of the BLIK Component, and mount it.
function handleOnAdditionalDetails(state, component) { state.data // Provides the data that you need to pass in the `/payments/details` call. component // Provides the active component instance that called this event. } const blikComponent = checkout.create('blik', { onAdditionalDetails: handleOnAdditionalDetails // Optional, only if you want to override the onAdditionalDetails defined in your AdyenCheckout instance }).mount('#blik-container');
Make a payment
When the shopper selects to pay, the Component calls the onChange
event, which contains a state.data
.
-
If
state.isValid
is true, collect thestate.data
and pass this to your server. -
From your server, make a /payments request, specifying:
paymentMethod
: Thestate.data.paymentMethod
from theonChange
event from your front end.
curl https://checkout-test.adyen.com/v68/payments \ -H "x-API-key: YOUR_X-API-KEY" \ -H "content-type: application/json" \ -d '{ "merchantAccount":"YOUR_MERCHANT_ACCOUNT", "reference":"YOUR_ORDER_NUMBER", "amount":{ "currency":"PLN", "value":1000 }, "{hint:state.data.paymentMethod from onChange}paymentMethod{/hint}":{ "type":"blik", "blikCode":"777987" }, "countryCode" : "PL" }'
# Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen::Client.new adyen.api_key = "YOUR_X-API-KEY" response = adyen.checkout.payments({ :amount => { :currency => "PLN", :value => 1000 }, :reference => "YOUR_ORDER_NUMBER", :paymentMethod => { :type => "blik", :blikCode => "777987" }, :countryCode => "PL", :merchantAccount => "YOUR_MERCHANT_ACCOUNT" })
// Set your X-API-KEY with the API key from the Customer Area. $client = new \Adyen\Client(); $client->setXApiKey("YOUR_X-API-KEY"); $service = new \Adyen\Service\Checkout($client); $params = array( "amount" => array( "currency" => "PLN", "value" => 1000 ), "reference" => "YOUR_ORDER_NUMBER", "paymentMethod" => array( "type" => "blik", "blikCode" => "777987" ), "countryCode" => "PL", "merchantAccount" => "YOUR_MERCHANT_ACCOUNT" ); $result = $service->payments($params);
#Set your X-API-KEY with the API key from the Customer Area. adyen = Adyen.Adyen() adyen.client.xapikey = 'YOUR_X-API-KEY' result = adyen.checkout.payments({ 'amount': { 'value': 1000, 'currency': 'PLN' }, 'reference': 'YOUR_ORDER_NUMBER', 'paymentMethod': { 'type': 'blik', 'blikCode': '777987' }, 'countryCode': 'PL', 'merchantAccount': 'YOUR_MERCHANT_ACCOUNT' })
// Set your X-API-KEY with the API key from the Customer Area. const {Client, Config, CheckoutAPI} = require('@adyen/api-library'); const config = new Config(); // Set your X-API-KEY with the API key from the Customer Area. config.apiKey = '[API_KEY]'; config.merchantAccount = '[YOUR_MERCHANT_ACCOUNT]'; const client = new Client({ config }); client.setEnvironment("TEST"); const checkout = new CheckoutAPI(client); checkout.payments({ amount: { currency: "PLN", value: 1000 }, paymentMethod: { type: 'blik', blikCode: '777987' }, reference: "YOUR_ORDER_NUMBER", countryCode: "PL", merchantAccount: config.merchantAccount }).then(res => res);
The /payments response contains:
resultCode
: Pending.action
: Use this object in the next step to display the waiting screen while the shopper completes the payment in their BLIK app.
Show the waiting screen
Pass the action
object from the /payments response to your front end:
blikComponent.handleAction(action)
The Component uses handleAction(action)
to show the waiting screen on your frontend. During this time, the shopper uses their BLIK app to complete the payment.
In the background, the Component checks the status of the payment and calls:
onAdditionalDetails
if the shopper successfully completes the payment or the bank has refused the payment.onError
if the payment not successful or the shopper does not complete the payment in 15 minutes.
Check the payment result
To check the payment result, use the state.data
object from the corresponding event handler:
onAdditionalDetails
for successful payments.onError
for unsuccessful or timed out payments.
From your server, make a POST /payments/details request with:
details
: thestate.data.details
from theonAdditionalDetails
oronError
event.paymentData
: thestate.data.paymentData
from theonAdditionalDetails
oronError
event.
You receive a response containing:
additionalData
: Object containing the value and currency for the payment.pspReference
: Our unique identifier for the transaction.resultCode
: Authorised for successful payments or Refused for unsuccessful or timed out payments. Use this to present the payment result to your shopper.
Present the payment result
Use the resultCode
from the /payments/details response to show the payment outcome on your frontend.
You will also receive the outcome of the payment asynchronously in a webhook.
The resultCode
values you can receive for BLIK are:
resultCode | Description | Action to take |
---|---|---|
Authorised | The payment was successful. | Inform the shopper that the payment has been successful. You will receive the funds in 2-3 days. |
Error | There was an error when the payment was being processed. | Inform the shopper that there was an error processing their payment. The response contains a refusalReason , indicating the cause of the error. |
Pending or Received |
The shopper has completed the payment but the final result is not yet known. It may take minutes or hours for the payments network to confirm this. | Inform the shopper that you've received their order, and are waiting for the payment to be completed. You will receive the final result of the payment in an AUTHORISATION webhook. |
Refused | The payment was refused by the shopper's bank. | Ask the shopper to try the payment again using a different payment method. |
The webhooks you can receive for BLIK are:
eventCode | success field | Description | Action to take |
---|---|---|---|
AUTHORISATION | false | The transaction failed. | Cancel the order and inform the shopper that the payment failed. |
AUTHORISATION | true | The shopper successfully completed the payment. | Inform the shopper that the payment has been successful and proceed with the order. |
Test and go live
To test BLIK, you can use any 6-digit blikCode
that starts with 777.
You can test different refused payment result scenarios by using the following amounts in your /payments request:
Refusal reason | Amount |
---|---|
ALIAS_DECLINED | 288.00 |
TAS_DECLINED | 192.00 |
USER_DECLINED | 144.00 |
SEC_DECLINED | 216.00 |
SYSTEM_ERROR | 264.00 |
GENERAL_ERROR | 360.00 |
INSUFFICIENT_FUNDS | 120.00 |
TIMEOUT | 312.00 |
LIMIT_EXCEEDED | 96.00 |
USER_TIMEOUT | 336.00 |
ISSUER_DECLINED | 9.99 |
You can check the status of BLIK test payments in your Customer Area > Transactions > Payments.
Before you can accept live BLIK payments, you need to add BLIK in your live Customer Area.