braintree / credit-card-type

A library for determining credit card type
MIT License
985 stars 154 forks source link

Adding support for RuPay card #144

Closed kapilraghuwanshi closed 2 years ago

kapilraghuwanshi commented 2 years ago

General information

jplukarski crookedneighbor I see that this library does not support "RuPay" card type. It has been used by millions of customers in India, promoted by Indian Govt. We can find about it on wiki, official website I would like to add RuPay card support to this library so that it can help detect rupay types of cards as well. Should I open an PR ?

jplukarski commented 2 years ago

Hey @kapilraghuwanshi , thanks for using Braintree.

In order for us to add RuPay to this module we'll need official documentation from RuPay detailing their BIN ranges. I'm not seeing that on their official website you linked.

If you're able to find official documentation then you can open a PR for us to review. If not, this module does give you the ability to add new card types for your use case => https://github.com/braintree/credit-card-type#adding-card-types

I'm going to close this issue out, but please feel free to re-open if you have any additional questions, and like I mentioned before, if you find official RuPay documentation detailing their BIN ranges feel free to open a PR.

rajatkantinandi commented 11 months ago

I think Rupay debit cards start with 60. The example on this site also starts with 60: https://www.rupay.co.in/know-you-rupay. I have a few Rupay debit cards that start with 60.

But Rupay credit cards I have seen start with 65, 81, 82, 43 & 35.

So, we can use this for Rupay cards:

creditCardType.addCard({
  niceType: "RuPay",
  type: "rupay",
  patterns: [60, 65, 81, 82, 43, 35],
  gaps: [4, 8, 12],
  lengths: [16],
  code: {
    name: "CVV",
    size: 3,
  },
});