A Bancontact card payment is like a regular card payment, except that there is no security code, and 3D Secure 1 is mandatory.
Our Component renders the Bancontact card in your payment form, and securely collects sensitive card information, so it doesn't touch your server.
When making a Bancontact card payment, you need to use the Redirect Component to handle the 3D Secure authentication.
Before you begin
This page explains how to add Bancontact card to your existing iOS Components integration. The iOS 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 integration:
- Make sure that you have set up your back end implementation for making API requests.
- Add Bancontact card in your test Customer Area.
Show Bancontact card in your payment form
Include Bancontact card in the list of available payment methods.
-
Specify in your /paymentMethods request:
- countryCode: BE.
- amount.currency: EUR.
- channel: Specify iOS.
-
Decode the
/paymentMethods
response with thePaymentMethods
structure.let paymentMethods = try JSONDecoder().decode(PaymentMethods.self, from: paymentMethodsResponse)
Find
paymentMethods.type
bcmc_card and put it into an object. For example,bcmcPaymentMethod
. - Initialize the Bancontact card Component:
let bcmcComponent = BcmcComponent(paymentMethod: bcmcPaymentMethod, clientKey: clientKey) // The client key from your Customer Area. bcmcComponent.clientKey = "YOUR_CLIENT_KEY" bcmcComponent.delegate = self // When you're ready to go live, change this to .live or to other environment values. // Environment values are described in https://adyen.github.io/adyen-ios/Docs/Structs/Environment.html bcmcComponent.environment = .test // In this example, the Pay button will display 10 EUR. // The value is in minor units. Change the currencyCode to the currency for the Bancontact card Component. bcmcComponent.payment = Payment(amount: Payment.Amount(value: 1000, currencyCode: "EUR")) present(bcmcComponent.viewController, animated: true)
Make a payment
When the shopper proceeds to pay, the Component invokes the didSubmit
method containing the data.paymentMethod
from the PaymentComponentDelegate
.
- Pass the
data.paymentMethod
to your server. - From your server, make a /payments request, specifying:
paymentMethod
: Thedata.paymentMethod
from thedidSubmit
event from your client app.paymentMethod
: ThepaymentComponentState.data.paymentMethod
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
To complete the payment, you need to redirect the shopper to perform 3D Secure authentication. After the shopper is redirected back to your app, submit the 3D Secure authentication result by making a /payments/details request.
For more information and detailed instructions, refer to Using the Redirect Component.
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.
- Configure the Component using the Client Key from your live Customer Area.