【问题标题】:How to handle dispute event in webhook?如何处理 webhook 中的争议事件?
【发布时间】:2020-08-09 09:07:38
【问题描述】:

我是一名业余 php 开发人员。我在我的 php 网站中接受条带付款作为一次性付款。我已经根据条纹网站文档正确集成了它。 (https://stripe.com/docs/payments/checkout/one-time#create-checkout-session)。我从 stripe webhook 获得 checkout.session.created 事件,并将其作为已完成的付款存储在我的数据库中。 (如果我做错了,请告诉我)。这是作为 checkout.session.completed 事件触发的示例事件数据。

{
  "id": "evt_123",
  "object": "event",
  "api_version": "2019-03-14",
  "created": 1561420781,
  "data": {
    "object": {
      "id": "cs_test_123",
      "object": "checkout.session",
      "billing_address_collection": null,
      "cancel_url": "https://example.com/cancel",
      "client_reference_id": null,
      "customer": "cus_123",
      "customer_email": null,
      "display_items": [],
      "mode": "setup",
      "setup_intent": "seti_1123",
      "submit_type": null,
      "subscription": null,
      "success_url": "https://example.com/success"
    }
  },
  "livemode": false,
  "pending_webhooks": 1,
  "request": {
    "id": null,
    "idempotency_key": null
  },
  "type": "checkout.session.completed"
}

但我需要处理 webhook 事件以解决争议。如果付费用户提出争议,我需要知道。 stripe 如何通过 webhook 通知我?如果条纹通知我,我如何找到父母付款?对不起我的英语不好。

【问题讨论】:

    标签: javascript php stripe-payments webhooks


    【解决方案1】:

    webbhook 是您提供给 stripe 的 url,stripe 将在该 URL 上发送数据,就像您将数据从表单发送到您的网站一样。

    您应该关注 Stripe 文档,https://stripe.com/docs/payments/handling-payment-eventshttps://stripe.com/docs/webhooks

    【讨论】:

      【解决方案2】:

      理想情况下,您应该编辑您的原始帖子以包含您昨天添加的“答案” - 并删除该答案 - 因为 Stackoverflow 与论坛不同

      Dispute 对象包含一个Payment Intent ID,您可以使用list / 'retrieve' the Checkout Session for that Payment Intent ID,这就是您获取它的方式。

      【讨论】:

        猜你喜欢
        • 2021-06-05
        • 2012-01-26
        • 2017-04-08
        • 1970-01-01
        • 1970-01-01
        • 2019-06-08
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多