我正在使用 Braintree 作为支付网关。
我有一个要求,我只需要存储信用卡的最后 4 位数字,有效期(根据 PCI Complaince)。
我已经在 javascript 中实现了前端代码,并且在向服务器发送数据时,信用卡信息是加密的。
无论如何我可以在后端获得最后四位数字、到期日期和卡类型,或者我可以解密吗?
<form name="paymentForm" action="/createtransaction" method="post" id="braintree-payment-form">
<p>
<label style="color:white">Card Number</label>
<input type="text" size="20" ng-model="userDetails.number" autocomplete="off" data-encrypted-name="number" />
</p>
<p>
<label style="color:white">CVV</label>
<input type="text" size="4" ng-model="userDetails.cvv" autocomplete="off" data-encrypted-name="cvv" />
</p>
<p>
<label style="color:white">Expiration (MM/YYYY)</label>
<input type="text" size="2" ng-model="userDetails.month" data-encrypted-name="month" /> / <input type="text" size="4" ng-model="userDetails.year" data-encrypted-name="year" />
</p>
<input type="submit" id="submit" />
最佳答案
(披露,我在 Braintree 工作)
由于您使用的是客户端加密,您将无法获取信息,因为它在创建交易之前已加密。但是,一旦您进行了交易,结果对象将包含卡号的前六位/后四位数字和到期日期。然后,您可以将这些值存储在您的数据库中。
它看起来像:
Result<Transaction> result = gateway.transaction().sale(
...
);
Transaction transaction = result.getTarget();
CreditCard creditCart = transaction.getCreditCard();
String last4 = creditCard.getLast4();
String expiration = creditCard.getExpirationDate();
关于java - 我只需要存储信用卡的最后 4 位数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24962863/