我正在尝试使用 Braintree 和 PHP 测试订阅。我能够成功发布交易,但我在订阅方面遇到了这个问题。
这是我的步骤:
1.创建附带信用卡的客户
2.为客户创建订阅
问题:
尽管我提供的信用卡的到期日期为 2013 年 1 月,但第 1 步或第 2 步都会成功。
我遵循了 Braintree 上给出的教程,但没有运气或文档帮助。有什么想法吗?
谢谢。
最佳答案
我在布伦特里工作。欢迎调用contact our support team如果您需要更详细的帮助。
我们不会在沙盒环境中检查到期日期。如果我们这样做了,并且您在测试中硬编码了到期日期,那么它们可能会在该日期过后失败。
相反,您 use an amount equal to the desired processor response code模拟故障:
Test Amounts for Unsuccessful Transactions
When working with transactions, you can pass specific amounts to simulate different responses from the gateway.
- Amounts between $0.01 - $1999.99 will simulate a successful authorization
- Amounts between $2000.00 - $2060.99 and $3000.00 - $3000.99 will decline with the > - coordinating Processor Response
- Amounts between $2061.00 - $2999.99 will simulate the generic decline message “Processor Declined.”
- Amounts $3001.00 and greater will also simulate a successful authorization
一张过期的卡是processor response code 2004 :
Code Text 2000 Do Not Honor 2001 Insufficient Funds 2002 Limit Exceeded 2003 Cardholder's Activity Limit Exceeded 2004 Expired Card
因此,将您的订阅金额设置为 $2004.00 将导致订阅失败,就好像该卡已过期一样,无论您使用的到期日期如何。
这样,您只需编写一次测试,即使在任何到期日期过后,它们也能继续工作。
关于php - braintree - 使用过期的信用卡创建订阅不会导致错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15938280/