#pro-pooja

1 messages · Page 1 of 1 (latest)

quiet domeBOT
soft snow
#

Hi there!

#

Note that you'll need to use expand: ["breakdown"] to see this information.

dreamy crow
#

I need discount code also , there is no info of discount code.

soft snow
#

It should contain the discount object used

dreamy crow
#

This is response payload of checkout.session.completed webhook

{ "id": "cs_test_b1fctoYwnhlT4Ks8ds5ejnHuZ2RRdBaZgQXo3ms3FwWHPS1KoD1yas3RfC", "object": "checkout.session", "livemode": false, "payment_intent": "pi_3NKeMVDPAH7QIF0a0Osn1I3w", "status": "complete", "after_expiration": null, "allow_promotion_codes": true, "amount_subtotal": 9900, "amount_total": 8910, "automatic_tax": { "enabled": false, "status": null }, "billing_address_collection": "auto", "cancel_url": "https://stripe.com", "client_reference_id": null, "consent": null, "consent_collection": { "promotions": "none", "terms_of_service": "none" }, "created": 1687160811, "currency": "gbp", "currency_conversion": null, "custom_fields": [ ], "custom_text": { "shipping_address": null, "submit": null }, "customer": null, "customer_creation": "if_required", "customer_details": { "address": { "city": null, "country": "IN", "line1": null, "line2": null, "postal_code": null, "state": null }, "email": "user1@user.com", "name": "Pooja", "phone": null, "tax_exempt": "none", "tax_ids": [ ] }, "customer_email": "user1@user.com", "expires_at": 1687247210, "invoice": null, "invoice_creation": null, "locale": "en", "metadata": { }, "mode": "payment", "payment_link": null, "payment_method_collection": "always", "payment_method_options": { }, "payment_method_types": [ "card", "link" ], "payment_status": "paid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "setup_intent": null, "shipping_address_collection": null, "shipping_cost": null, "shipping_details": null, "shipping_options": [ ], "submit_type": null, "subscription": null, "success_url": "https://stripe.com", "total_details": { "amount_discount": 990, "amount_shipping": 0, "amount_tax": 0 }, "url": null }

soft snow
#

Yes, like I said above, you need to use expand: ["breakdown"] for this to work.

dreamy crow
#

How to use that in webhook?

soft snow
#

So you need to take the Checkout Session ID from the payload, and then make an API call to retrieve the Checkout Session with expand: ["breakdown"]

dreamy crow
#

Is there any way around, other than making an Extra API call, just to check for discount code?