【问题标题】:Android Can't get Stripe charge id after confirming PaymentIntent [3DS2]确认 PaymentIntent [3DS2] 后,Android 无法获取 Stripe 费用 ID
【发布时间】:2020-04-23 12:47:12
【问题描述】:

我正在实施new version of Stripe (SCA-READY), version 12.8.2.
一切正常。
但我需要在确认PaymentIntent 后获得charge ID。
在确认PaymentIntent 后我从server(转发stripe response)收到的ID。
但是,当进程需要 3ds2(或 3ds)时,我没有收到此 ID。

(以下sn-ps仅代表收费部分,如果要完整的JSON,请在评论中问我)

Here is the response's snippet 没有 3ds​​2 身份验证

然后就是需要3ds2认证的时候response的sn-p:

"charges": {
    "object": "list",
    "data": [],
    "has_more": false,
    "total_count": 0,
    "url": "/v1/charges?payment_intent=pi_1FxfoiHk0bG3YRQo1hU4c6f1"
  },  

没有这一条的id我无法取回扣款documentation

然后我也没有任何与PaymentIntent中的费用相对应的属性在处理3ds2之后我可以在activityResult中得到callback中的stripe sdk(在3ds2之后触发认证处理结果):

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (requestCode == PaymentMethodsActivityStarter.REQUEST_CODE && data != null) {
            val result = PaymentMethodsActivityStarter.Result.fromIntent(data)
            val paymentMethod = result?.paymentMethod
            adapter.renderCard(paymentMethod)
        }
        val isPaymentIntentResult = paymentServiceProvider.stripe.onPaymentResult(
                requestCode, data,
                object : ApiResultCallback<PaymentIntentResult> {
                    override fun onSuccess(result: PaymentIntentResult) {
                        adapter.processStripeIntent(result.intent)//The intent accessed here hasn't any charges (stuff like amount paymentMethod, but nothing about charges)
                    }

                    override fun onError(e: Exception) {
                        Toast.makeText(this@ClientMainActivity, e.message, Toast.LENGTH_LONG).show()
                    }
                })
    }

编辑: 有一个状态为success的响应体:

{
  "id": "pi_1FxzypHk0bG3YRQop47ZATBv",
  "object": "payment_intent",
  "amount": 500,
  "canceled_at": null,
  "cancellation_reason": null,
  "capture_method": "automatic",
  "client_secret": "secret",
  "confirmation_method": "automatic",
  "created": 1578334027,
  "currency": "eur",
  "description": null,
  "last_payment_error": null,
  "livemode": false,
  "next_action": null,
  "payment_method": "pm_1Fv1nxHk0bG3YRQoqldFvopb",
  "payment_method_types": [
    "card"
  ],
  "receipt_email": null,
  "setup_future_usage": null,
  "shipping": null,
  "source": null,
  "status": "succeeded"
}

【问题讨论】:

    标签: android kotlin stripe-payments


    【解决方案1】:

    在您作为 3D Secure 的一部分完成对用户的身份验证并且支付意图处于 succeeded 或 requires_payment_method 状态之前,不会产生任何费用:https://stripe.com/docs/payments/intents

    此时,您的 Stripe 仪表板中的付款意图是什么样的?

    【讨论】:

    • 即使状态成功,我也不会收到任何费用。我用它的 json 编辑了我的帖子
    猜你喜欢
    • 2020-04-17
    • 1970-01-01
    • 2021-01-22
    • 2021-02-27
    • 2020-10-31
    • 2021-02-04
    • 2013-08-22
    • 1970-01-01
    • 2019-05-08
    相关资源
    最近更新 更多