检测 2 位客户是否尝试在 braintree 中使用同一张信用卡的最佳实践

Best practice to detect if 2 customers try to use same credit card in braintree

我想知道最佳做法是什么:

条纹指纹之类的东西。

他们的 PaymentMethod.create 调用中似乎有一个选项,如果同一张卡片已添加到您的 Braintree Vault 中,该选项将失败。 Link 到该属性 here

完全披露:我在 Braintree 工作。如果您有任何其他问题,请随时联系 support.

您可以通过 using the credit card unique identifier in a transaction search. This will get you a response containing all transactions that made use of the same card. From there, you can inspect the transaction response object for information about the customer that created it 在您的保险库中搜索使用同一张信用卡的交易。

您不能在验证搜索中使用信用卡唯一标识符。相反,您可以根据 customer ID or payment method token, then pull the credit card unique identifier from the verification response object.

搜索验证

在 Ruby 中,交易搜索看起来像这样:

collection = Braintree::Transaction.search do |search|
  search.credit_card_unique_identifier.is "the_unique_identifier"
end

collection.each do |transaction|
  puts transaction.customer_details.id
end