A Bancontact card payment is like a regular card payment, except that there is no security code, and 3D Secure 1 is mandatory.
Our iOS Drop-in renders the Bancontact card in your payment form, securely collects sensitive card information, and redirects the shopper to the issuer's website to perform 3D Secure authentication.
When adding Bancontact card to your integration, you need to:
- Handle the redirect result when the shopper returns back to your website after performing 3D Secure authentication.
Before you begin
This page explains how to add Bancontact card to your existing iOS Drop-in integration. The iOS Drop-in integration works the same way for all payment methods. If you haven't done this integration yet, refer to our Drop-in integration guide.
Before starting your integration:
- Make sure that you have set up your back end implementation, and added Drop-in to your payment form.
- Add Bancontact card in your test Customer Area.
Show Bancontact card in your payment form
To show Bancontact card in your payment form:
-
Specify in your /paymentMethods request:
- countryCode: BE
- amount.currency: EUR
-
When initializing the Drop-in, create a configuration object and pass your Client Key.
let configuration = DropInComponent.PaymentMethodsConfiguration() //The Client Key from your Customer Area. configuration.clientKey = "YOUR_CLIENT_KEY"
Make a payment
When the shopper proceeds to pay, Drop-in invokes the didSubmit
method which contains data.paymentMethod
.
- Pass
data.paymentMethod
to your server. - From your server, make a /payments request, specifying:
paymentMethod
: Thedata.paymentMethod
from thedidSubmit
event from your client app.returnUrl
: The URL where the shopper will be redirected back to after completing 3D Secure 1 authentication. Use the custom URL for your app, for example,my-app://
. For more information on setting custom URL schemes, refer to the Apple Developer documentation.
curl https://checkout-test.adyen.com/v66/payments \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
"amount":{
"currency":"EUR",
"value":1000
},
"reference":"YOUR_ORDER_NUMBER",
"{hint:data.paymentMethod from didSubmit}paymentMethod{/hint}": {
"type": "bcmc",
"encryptedCardNumber": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
"encryptedExpiryMonth": "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
"encryptedExpiryYear": "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
},
"returnUrl":"my-app://",
"merchantAccount":"YOUR_MERCHANT_ACCOUNT"
}'
# 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 => "EUR",
:value => 1000
},
:reference => "YOUR_ORDER_NUMBER",
:paymentMethod => {
:type => "bcmc",
:encryptedCardNumber => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
:encryptedExpiryMonth => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
:encryptedExpiryYear => "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
},
:returnUrl => "adyencheckout://your.package.name",
:merchantAccount => "YOUR_MERCHANT_ACCOUNT"
})
// Set your X-API-KEY with the API key from the Customer Area.
Client client = new Client(xApiKey,Environment.TEST);
Checkout checkout = new Checkout(client);
PaymentsRequest paymentsRequest = new PaymentsRequest();
paymentsRequest.setMerchantAccount("YOUR_MERCHANT_ACCOUNT");
Amount amount = new Amount();
amount.setCurrency("EUR");
amount.setValue(1000L);
paymentsRequest.setAmount(amount);
String encryptedCardNumber = "adyenjs_0_1_18$...encryptedCardNumber";
String encryptedExpiryMonth = "adyenjs_0_1_18$...encryptedExpiryMonth";
String encryptedExpiryYear = "adyenjs_0_1_18$...encryptedExpiryYear";
paymentsRequest.setReference("YOUR_ORDER_NUMBER");
paymentsRequest.addEncryptedCardData(encryptedCardNumber,encryptedExpiryMonth, encryptedExpiryYear);
paymentsRequest.setReturnUrl("adyencheckout://your.package.name");
PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest);
// 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" => "EUR",
"value" => 1000
),
"reference" => "YOUR_ORDER_NUMBER",
"paymentMethod" => array(
"type" => "bcmc",
"encryptedCardNumber" => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
"encryptedExpiryMonth" => "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
"encryptedExpiryYear" => "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
),
"returnUrl" => "adyencheckout://your.package.name",
"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': 'EUR'
},
'reference': 'YOUR_ORDER_NUMBER',
'paymentMethod': {
'type': 'bcmc',
'encryptedCardNumber': 'adyenjs_0_1_18$MT6ppy0FAMVMLH...',
'encryptedExpiryMonth': 'adyenjs_0_1_18$MT6ppy0FAMVMLH...',
'encryptedExpiryYear': 'adyenjs_0_1_18$MT6ppy0FAMVMLH...'
},
'returnUrl': 'adyencheckout://your.package.name',
'merchantAccount': 'YOUR_MERCHANT_ACCOUNT'
})
// Set your X-API-KEY with the API key from the Customer Area.
var client = new Client ("YOUR_X-API-KEY", Environment.Test);
var checkout = new Checkout(client);
var amount = new Model.Checkout.Amount("EUR", 1000);
var details = new Model.Checkout.DefaultPaymentMethodDetails{
Type = "bcmc",
EncryptedCardNumber = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
EncryptedExpiryMonth = "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
EncryptedExpiryYear = "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
};
var paymentRequest = new Adyen.Model.Checkout.PaymentRequest
{
Reference = "YOUR_ORDER_NUMBER",
Amount = amount,
ReturnUrl = @"adyencheckout://your.package.name",
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
PaymentMethod = details
};
var paymentResponse = checkout.Payments(paymentsRequest);
// 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: "EUR", value: 1000 },
paymentMethod: {
type: 'bcmc',
encryptedSecurityCode: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
encryptedExpiryMonth: "adyenjs_0_1_18$MT6ppy0FAMVMLH...",
encryptedExpiryYear: "adyenjs_0_1_18$MT6ppy0FAMVMLH..."
},
reference: "YOUR_ORDER_NUMBER",
merchantAccount: config.merchantAccount,
returnUrl: "adyencheckout://your.package.name"
}).then(res => res);
The /payments response contains:
-
action
: Object containing information about the redirect. Pass this to your front end or client app. -
action.paymentData
: Store this value on your server — you need to submit this in your /payments/details request when handling the redirect result.
{
"resultCode": "RedirectShopper",
"action": {
"data": {
"MD": "OEVudmZVMUlkWjd0MDNwUWs2bmhSdz09...",
"PaReq": "eNpVUttygjAQ/RXbDyAXBYRZ00HpTH3wUosPfe...",
"TermUrl": "adyencheckout://your.package.name"
},
"method": "POST",
"paymentData": "Ab02b4c0!BQABAgA4e3wGkhVah4CJL19qdegdmm9E...",
"paymentMethodType": "bcmc",
"type": "redirect",
"url": "https://test.adyen.com/hpp/3d/validate.shtml"
},
"details": [
{
"key": "MD",
"type": "text"
},
{
"key": "PaRes",
"type": "text"
}
],
...
}
- Pass the
action
object to your client app.
Handle the redirect result
Drop-in uses dropInComponent.handle(action)
to redirect the shopper to perform 3D Secure authentication.
-
To inform Drop-in when the shopper returns to your app, implement the following in your
UIApplicationDelegate
:
After Drop-in completes the action, it invokes thefunc application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool { RedirectComponent.applicationDidOpen(from: url) return true }
didProvide
method. -
From your server, make a POST /payments/details request providing the
data
from thedidProvide
method from your client app.-
resultCode
: Use this to present the result to your shopper. -
pspReference
: Our unique identifier for the transaction.
-
Present the payment result
Use the resultCode from the /payments/details response to present the payment result to your shopper. You will also receive the outcome of the payment asynchronously in a notification webhook.
For Bancontact card payments, you can receive the following resultCode
values:
resultCode | Description | Action to take |
---|---|---|
Authorised | The payment was successful. | Inform the shopper that the payment was successful. |
Cancelled | The shopper cancelled the payment. | Ask the shopper whether they want to continue with the order, or ask them to select a different payment method. |
Error | There was an error when the payment was being processed. For more information, check the
refusalReason
field. |
Inform the shopper that there was an error processing their payment. |
Refused | The payment was refused. For more information, check the
refusalReason
field. |
Ask the shopper to try the payment again using a different payment method. |
Recurring payments
We support recurring transactions for Bancontact through SEPA Direct Debit. To make recurring payments, you need to:
Create a token
To create a token, include in your /payments request:
-
storePaymentMethod
: true - shopperReference: Your unique identifier for the shopper (minimum length three characters).
When the payment has been settled, you receive a notification webhook containing:
-
eventCode
: RECURRING_CONTRACT -
originalReference
: ThepspReference
of the initial payment. -
pspReference
: This is the token that you need to make recurring payments for this shopper.
Make a payment with a token
To make a payment with the token, include in your /payments request:
-
paymentMethod.storedPaymentMethodId
: ThepspReference
from the RECURRING_CONTRACT. You can also get this value by using the /listRecurringDetails endpoint. -
shopperReference
: The unique shopper identifier that you specified when creating the token. -
shopperInteraction
: ContAuth. -
recurringProcessingModel
: Subscription or UnscheduledCardOnFile.
For more information about the shopperInteraction
and recurringProcessingModel
fields, refer to Recurring transaction types.
curl https://checkout-test.adyen.com/v66/payments \
-H "x-API-key: YOUR_X-API-KEY" \
-H "content-type: application/json" \
-d '{
"amount":{
"value":1000,
"currency":"EUR"
},
"paymentMethod":{
"type":"sepadirectdebit",
"recurringDetailReference":"7219687191761347"
},
"reference":"YOUR_ORDER_NUMBER",
"merchantAccount":"YOUR_MERCHANT_ACCOUNT",
"shopperReference":"YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
"shopperInteraction":"ContAuth",
"recurringProcessingModel": "Subscription"
}'
# 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 => "EUR",
:value => 1000
},
:reference => "YOUR_ORDER_NUMBER",
:paymentMethod => {
:type => "sepadirectdebit",
:recurringDetailReference => "7219687191761347"
},
:returnUrl => "https://your-company.com/checkout?shopperOrder=12xy..",
:shopperReference => "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
:merchantAccount => "YOUR_MERCHANT_ACCOUNT",
:shopperInteraction => "ContAuth",
:recurringProcessingModel => "Subscription"
})
// Set YOUR_X-API-KEY with the API key from the Customer Area.
// Change to Environment.LIVE and add the Live URL prefix when you're ready to accept live payments.
Client client = new Client("YOUR_X-API-KEY", Environment.TEST);
Checkout checkout = new Checkout(client);
PaymentsRequest paymentsRequest = new PaymentsRequest();
String merchantAccount = "YOUR_MERCHANT_ACCOUNT";
paymentsRequest.setMerchantAccount(merchantAccount);
Amount amount = new Amount();
amount.setCurrency("EUR");
amount.setValue(15000L);
paymentsRequest.setAmount(amount);
DefaultPaymentMethodDetails paymentMethodDetails = new DefaultPaymentMethodDetails();
paymentMethodDetails.setRecurringDetailReference("7219687191761347");
paymentMethodDetails.setType("sepadirectdebit");
paymentsRequest.setPaymentMethod(paymentMethodDetails);
paymentsRequest.setReference("YOUR_ORDER_NUMBER");
paymentsRequest.setReturnUrl("https://your-company.com/checkout?shopperOrder=12xy..");
paymentsRequest.setShopperInteraction("ContAuth");
paymentsRequest.setRecurringProcessingModel("Subscription");
PaymentsResponse paymentsResponse = checkout.payments(paymentsRequest);
// 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" => "EUR",
"value" => 1000
),
"reference" => "YOUR_ORDER_NUMBER",
"paymentMethod" => array(
"type" => "sepadirectdebit",
"recurringDetailReference" => "7219687191761347"
),
"returnUrl" => "https://your-company.com/checkout?shopperOrder=12xy..",
"shopperReference" => "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
"recurringProcessingModel" => "Subscription",
"shopperInteraction" => "ContAuth",
"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': 'EUR'
},
'reference': 'YOUR_ORDER_NUMBER',
'paymentMethod': {
'type': 'sepadirectdebit',
'recurringDetailReference': '7219687191761347'
},
'returnUrl': 'https://your-company.com/checkout?shopperOrder=12xy..',
'shopperReference': 'YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j'
'merchantAccount': 'YOUR_MERCHANT_ACCOUNT',
'shopperInteraction':'ContAuth',
'recurringProcessingModel': 'Subscription'
})
// Set your X-API-KEY with the API key from the Customer Area.
var client = new Client ("YOUR_X-API-KEY", Environment.Test);
var checkout = new Checkout(client);
var amount = new Model.Checkout.Amount("EUR", 1000);
var details = new Model.Checkout.DefaultPaymentMethodDetails{
Type = "sepadirectdebit",
RecurringDetailReference = "7219687191761347"
};
var paymentsRequest = new Model.Checkout.PaymentRequest
{
Reference = "YOUR_ORDER_NUMBER",
Amount = amount,
ReturnUrl = @"https://your-company.com/checkout?shopperOrder=12xy..",
MerchantAccount = "YOUR_MERCHANT_ACCOUNT",
ShopperReference = "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
RecurringProcessingModel = "Subscription",
ShopperInteraction = "ContAuth",
PaymentMethod = details
};
var paymentResponse = checkout.Payments(paymentsRequest);
// 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: "EUR", value: 1000 },
paymentMethod: {
type: 'sepadirectdebit',
recurringDetailReference: "7219687191761347"
},
reference: "YOUR_ORDER_NUMBER",
merchantAccount: config.merchantAccount,
shopperReference: "YOUR_UNIQUE_SHOPPER_ID_IOfW3k9G2PvXFu2j",
returnUrl: "https://your-company.com/checkout?shopperOrder=12xy..",
shopperInteraction: "ContAuth",
recurringProcessingModel: "Subscription"
}).then(res => res);
Test and go live
Before making live payments:
-
Use the following credentials to test your integration:
You can check the status of test payments in your Customer Area > Transactions > Payments.Test card number Expiry date 6703 4444 4444 4449 10/2020, or 03/2030 6703 0000 0000 0000 003 10/2020, or 03/2030 - Add Bancontact card in your live Customer Area.