我想订100欧元以上的价格带条纹。斯特里普要我两次要3DS。
步骤1:我创建了一个新客户
Customer customer = Customer.create(customerCreateParams)
步骤2:我创建了一个序列
SetupIntentCreateParams setupIntentCreateParams =
SetupIntentCreateParams
.builder()
.setCustomer(customer.getId())
.addPaymentMethodType("card")
.build();
SetupIntent.create(setupIntentCreateParams)
第三步:使用条形码JS,我收集卡片并与客户秘密确认序列:
const options = {
clientSecret: 'seti_foo_secret_bar'
const elements = stripe.elements(options);
stripe.confirmSetup({
elements,
步骤4:我使用这张带强制3DS : 4000000000003220的斯蒂普卡
然后,Stripe JS,请求3DS,然后我确认3DS,现在一切正常。
第5步:我将setupintent支付方法作为对客户的默认支付方法。
Customer customer = Customer.retrieve(setupIntent.getCustomer());
Map<String, Object> payCus = new HashMap<>();
payCus.put("default_payment_method", setupIntent.getPaymentMethod());
Map<String, Object> cusParams = new HashMap<>();
cusParams.put("invoice_settings", payCus);
customer.update(cusParams);
步骤6:我使用已经通过条形仪表板创建的价格创建订阅。
List<Object> items = new ArrayList<>();
Map<String, Object> itemParam = new HashMap<>();
itemParam.put(
"price",
"price_foobar"
);
items.add(itemParam);
Map<String, Object> subParams = new HashMap<>();
subParams.put("customer", setupIntent.getCustomer());
subParams.put("items", items);
Subscription.create(subParams);
步骤7:订阅付款不完整,因为再次询问3DS。
有人能帮我吗?诚挚的问候
发布于 2022-08-03 13:01:21
如果您使用的卡总是需要3DS验证,您需要重定向用户确认他的卡总是。
首先,您应该按照本指南创建订阅,而不是使用SetupIntent https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements。
为了进行测试,除非安装https://support.stripe.com/questions/test-card-requiring-3d-secure-authentication-for-every-transaction,否则您应该使用这张需要3DS的卡(4000002500003155)
如果您的用户的卡总是需要3ds (就像您在测试中使用的*3220卡),您需要要求用户完成每次续订的付款。
您可以在相关的next_action
中引用subscription.latest_invoice.payment_intent,它包含3ds重定向确认https://stripe.com/docs/api/payment_intents/object#payment_intent_object-next_action-use_stripe_sdk的钩子
https://stackoverflow.com/questions/73219803
复制相似问题