Paytabs provides you with a collection of API endpoints which used to process all payments, regardless of if they are through either your own payment pages, the managed payment pages, or if you are using the hosted payment pages. 




This article is dedicated to the clarification of the card_filter (card_filter) parameter. "card_filter" is one of the optional parameters that the request may have, which will allow you to accept only cards that start with a specific number/identifier/BIN code you want.


In this article, you will be going to know:



Specifications


  • Card Filter
       

    The Parameter Tag/Namecard_filter
    JSON Example

    { "card_filter": "41111,400000,5200000,549838" } 

    Generic

    Data TypeSTRING (comma separated)
    Required
    Validation Rules
    • Accepts only digits spread by commas.
    • Each card filter prefix can be one digit or more.
    • If an empty value is presented, the filter will not be applied.
    Max Length255 Character 


  • Card Filter Title


    The Parameter Tag/Namecard_filter_title
    JSON Example

    {"card_filter_title": "Only accept cards start with 41111,400000"}

    Generic

    Data TypeSTRING
    Required  ❌  (Required only if the card_filter is present)
    Validation Rules
    • Can't be empty.
    Max Length255 Character 



Usage Workflow

Along with the required parameters mentioned in our Step 3 - PT2 API Endpoints | Initiating the payment solution article, you will need to set the "card_filter" as shown below:

Sample Request Payload

 

JavaScript
{    
"profile_id": "987654",
"tran_type": "sale",
"tran_class": "ecom",
"cart_id": "CART#1001",
"cart_currency": "USD",
"cart_amount": 500,
"cart_description": "Description of the items/services",
"card_filter": "41111,400000",
"card_filter_title": "Only accept cards starting with 41111,400000"
}


Sample Request Payload

   

JavaScript
{ 
"tran_ref": "TST2231301375864",
"tran_type": "Sale",
"cart_id": "CART#1001",
"cart_description": "Description of the items/services",
"cart_currency": "USD", 
"cart_amount": "500.00",
"tran_currency": "",
"tran_total": "0",
"return": "none",
"redirect_url": "https://***.paytabs.com/payment/page/599**D7",
"serviceId": 2,
"profileId": 987654,
"merchantId": 123456,
"trace": "PMNT0404.6368BC3D.000BAF4C"
}

The Expected Parameter Behaviors


After redirecting the customer to the payment page, PayTabs will compare the customer's card number with the card filters. If it matches one of the filter numbers, then the transaction will proceed, and the customer can complete the transaction, if it does not match with any filter number, the validation error message "Card does not meet requirements" will display as shown below: