简体   繁体   中英

How to handle dispute event in webhook?

I'm a amateur php developer. I accepts stripe payments in my php website as one-time payments. I've integrated it correctly according to stripe website docs. ( https://stripe.com/docs/payments/checkout/one-time#create-checkout-session ). I'm getting checkout.session.created event from stripe webhook and I store it in my database as a completed payment. ( Advise me if I'm doing wrong ). This is the sample event data that stripe triggers as checkout.session.completed event.

 { "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" }

But I need to handle webhook events for disputes. If a paid user opens dispute, I need to know it. How stripe notifies me it via webhook? If stripe notifies me, How do I find parent payment?. Sorry for my bad English.

webbhook is a url provided by you to stripe, on which stripe will be sending data, just like how you send data from a form to your site.

You should follow stripe docs for it, https://stripe.com/docs/payments/handling-payment-events and https://stripe.com/docs/webhooks

You should ideally edit your original post to include the 'answer' you added yesterday - and remove that answer - as Stackoverflow isn't the same as a forum

The Dispute object contains a Payment Intent ID and you can list / 'retrieve' the Checkout Session for that Payment Intent ID , so that's how you get it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM