[英]Testing - set declined card to a customer
我想用拒絕的卡更新客戶以進行測試。
但是如果我這樣做:
Stripe.customers.update(stripeCustomer.id, {
source: 'tok_chargeDeclined', // Token provided by stripe of a declined card
});
我有一個例外:
調用方法'stripe.test'時發生異常{錯誤:您的卡被拒。
我缺少什么?
當您將卡連接到客戶時(例如,通過該更新呼叫),Stripe會對卡臨時收取$ 0的費用,以進行驗證並確保以后可以成功向客戶收費。 在https://stripe.com/docs/saving-cards#saving-credit-card-details-for-later中提到了這一點。
當您附加tok_chargeDeclined
,此費用將被拒絕,並且不會將卡添加到客戶。 要測試卡可以成功添加到客戶但又被拒絕的情況(即,如果它以后過期或沒有資金),可以使用https://stripe.com/docs/testing#cards上的tok_chargeCustomerFail
卡-responses
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.