如何防止客户添加相同的信用卡

Vij*_*put 7 stripe-payments

我使用stripe作为我的支付提供商,并在我从db返回的数据库中存储加密的信用卡ID.

我的问题是,从GUI客户可以再次添加相同的卡.我看到条纹不会阻止为同一个客户多次添加同一张卡.由于条带始终为同一张卡生成不同的加密卡ID,因此我无法使用它来验证是否再次添加相同的卡.

如何阻止客户再次添加相同的卡.

Vij*_*put 12

看起来我知道了.我可以使用json响应中返回的指纹.我看到条纹仪表板,发现同一张卡的指纹总是相同的,我再次添加.

这是json请求和响应确认

请求

{
  "source": {
    "number": "378282246310005",
    "cvc": "123",
    "address_line2": "4th Floor",
    "address_line1": "140 2nd Street",
    "address_country": "USA",
    "name": "VIAY KUMAR",
    "address_state": "CA",
    "exp_month": 12,
    "exp_year": 2015,
    "address_zip": "94105",
    "address_city": "San Francisco",
    "object": "card"
  }
}
Run Code Online (Sandbox Code Playgroud)

响应

 {
      "id": "card_166H9rC8Y8JrMFgBh9GVsmNG",
      "object": "card",
      "status": null,
      "exp_month": 12,
      "exp_year": 2015,
      "last4": "0005",
      "country": "US",
      "type": null,
      "name": "VIAY KUMAR",
      "customer": "cus_6IrxhfwXNyD1Uw",
      "recipient": null,
      "address_line1": "140 2nd Street",
      "address_line2": "4th Floor",
      "address_zip": "94105",
      "address_city": "San Francisco",
      "address_state": "CA",
      "address_country": "USA",
      "address_zip_check": "pass",
      "address_line1_check": "pass",
      "cvc_check": "pass",
      "fingerprint": "TwjSA2KqPDhSMUvQ",
      "brand": "American Express",
      "funding": "credit"
    }
Run Code Online (Sandbox Code Playgroud)

再次添加相同的卡并获得不同的卡ID但同样的指纹:-)

请求

{
  "source": {
    "number": "378282246310005",
    "cvc": "123",
    "address_line2": "4th Floor",
    "address_line1": "140 2nd Street",
    "address_country": "USA",
    "name": "VIAY KUMAR",
    "address_state": "CA",
    "exp_month": 12,
    "exp_year": 2015,
    "address_zip": "94105",
    "address_city": "San Francisco",
    "object": "card"
  }
}
Run Code Online (Sandbox Code Playgroud)

响应

{
  "id": "card_166HKVC8Y8JrMFgBfvbHPgk2",
  "object": "card",
  "status": null,
  "exp_month": 12,
  "exp_year": 2015,
  "last4": "0005",
  "country": "US",
  "type": null,
  "name": "VIAY KUMAR",
  "customer": "cus_6IrxhfwXNyD1Uw",
  "recipient": null,
  "address_line1": "140 2nd Street",
  "address_line2": "4th Floor",
  "address_zip": "94105",
  "address_city": "San Francisco",
  "address_state": "CA",
  "address_country": "USA",
  "address_zip_check": "pass",
  "address_line1_check": "pass",
  "cvc_check": "pass",
  "fingerprint": "TwjSA2KqPDhSMUvQ",
  "brand": "American Express",
  "funding": "credit"
}
Run Code Online (Sandbox Code Playgroud)