【发布时间】:2021-08-01 06:35:24
【问题描述】:
我在标准帐户中使用 Stripe。
我在平台上保存客户和支付方法,因此,在客户端,客户选择支付方法并将其发送到服务器。因此,在服务器端,我将 PaymentMethod 克隆到将接收付款的 Connected Account。我的服务器端代码如下所示
RequestOptions requestOptions = RequestOptions.builder()
.setStripeAccount("{{CONNECTED_STRIPE_ACCOUNT_ID}}")
.build();
PaymentMethodCreateParams paramsClone = PaymentMethodCreateParams.builder()
.setCustomer("cus_1")//Id of the customer in the platform
.setPaymentMethod("payment_method_id")//One of the payment methods of the cus_1
.build();
PaymentMethod newPaymentMethod = PaymentMethod.create(paramsClone, requestOptions);
此时我假设这个新的 newPaymentMethod 在已连接的帐户中,对吧?
那么,我创建一个 PaymentIntent
PaymentIntentCreateParams params = PaymentIntentCreateParams.builder()
.setAmount(100)
.setPaymentMethod(newPaymentMethod.getId())
.setCurrency("usd")
.setApplicationFeeAmount(10)
.build();
PaymentIntent paymentIntent = PaymentIntent.create(params, requestOptions);
此时一切似乎都很好。付款意图返回条纹client secret,如'pi_1Ipfl3Bf0KWukpZWQdbAzoz1_secret_RAKsPMLpyhkDJ7q8N1VvSmaoR',status 是'requires_confirmation'。所以,当我尝试在客户端确认时,它会抛出一个错误:No such payment_intent: 'pi_1Ipfl3Bf0KWukpZWQdbAzoz1'。
我认为这与在我的平台和连接的帐户之间进行切换有关,但我无法弄清楚确切的问题是什么。我正在关注这个https://stripe.com/docs/connect/cloning-customers-across-accounts 和这个https://stripe.com/docs/payments/payment-methods/connect#cloning-payment-methods,但我仍然不知道如何让它工作。
有人能解释一下吗?问候!
【问题讨论】:
标签: java stripe-payments