Skip to main content

Allow selected BINs

Learn how to allow specific card BINs when processing a card payment.

Overview

BIN stands for Bank Identification Number. It is the first six digits of a credit/debit card number and identifies the issuer.

The allow selected BINs feature adjusts the payment intent's behavior when processing card payments. Suppose your use case is to allow selected BINs whenever your customer completes a card payment. In that case, you can specify the list of permitted BINs during your integration.

Allow selected card BINs in your integration

When creating a payment intent, you must add a payload attribute called payment_method_options to specify the allowed card BINs before your customer completes a card payment.

Integrate payments

If you don't know yet how to integrate payments, please refer to this guide

create_payment_intent.js
// Protect your PayRex Secret API key at all costs. One common approach
// to store it in an environment variable.
// Add your PayRex test secret API key.
const payrexSecretApiKey = '';

const payrex = require('payrex-node')(payrexSecretApiKey);

// Create a PaymentIntent with amount and currency
const paymentIntent = await payrex.paymentIntents.create({
// Amount is in cents. The sample below is 100.00.
amount: 10000,
currency: 'PHP',
payment_method_options: {
card: {
allowed_bins: ['424242', '411111']
}
},
payment_methods: ['card'],
});

const output = {
clientSecret: paymentIntent.clientSecret,
}

console.log(JSON.stringify(output));

With the code above, you are instructing that card payment processed by Payment Intent should only allow the 2 card BINs, 424242 and 411111. The payment form will return an error if the customer uses a card with no BIN in the list.