#happycappie

1 messages · Page 1 of 1 (latest)

blazing vigilBOT
twin steppe
#

CHECKOUT OBJECT

#<Stripe::Checkout::Session:0x353978 id=cs_test_b11sociOjS6j9roY6FkJK6n0pRziC70Bg2UwbUwLDyp7YFVPht5PIVPMcw> JSON: {
"id": "cs_test_b11sociOjS6j9roY6FkJK6n0pRziC70Bg2UwbUwLDyp7YFVPht5PIVPMcw",
"object": "checkout.session",
"after_expiration": null,
"allow_promotion_codes": true,
"amount_subtotal": 36000,
"amount_total": 26000,
"automatic_tax": {"enabled":false,"status":null},
"billing_address_collection": null,
"cancel_url": "http://localhost:3000",
"client_reference_id": "44",
"consent": null,
"consent_collection": null,
"created": 1666906817,
"currency": "gbp",
"customer": "cus_MWZ7OQq7GlF55m",
"customer_creation": null,
"customer_details": {"address":{"city":null,"country":"CR","line1":null,"line2":null,"postal_code":null,"state":null},"email":"*****prontocx.com","name":"****","phone":null,"tax_exempt":"none","tax_ids":[]},
"customer_email": null,
"expires_at": 1666993217,
"livemode": false,
"locale": null,
"metadata": {},
"mode": "payment",
"payment_intent": "pi_3LxdotIFm1zZINXz1Dgx9hc0",
"payment_link": null,
"payment_method_collection": "always",
"payment_method_options": {},
"payment_method_types": [
"card"
],
"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": [

],
"status": "complete",
"submit_type": "pay",
"subscription": null,
"success_url": "https://872b-201-192-162-3.ngrok.io/payments/checkout/atjzIqQ_gIupDB-rx2yb7kS030ImOzAS/callback?session_id={CHECKOUT_SESSION_ID}",
"total_details": {"amount_discount":10000,"amount_shipping":0,"amount_tax":0},
"url": null
}

#

LINE ITEM

#<Stripe::LineItem:0x35c0f0 id=li_1LxdoDIFm1zZINXzvoScPeRm> JSON: {
"id": "li_1LxdoDIFm1zZINXzvoScPeRm",
"object": "item",
"amount_discount": 10000,
"amount_subtotal": 36000,
"amount_tax": 0,
"amount_total": 26000,
"currency": "gbp",
"description": "Queen Anne Annual Membership",
"price": {"id":"price_1LkggNIFm1zZINXzDrr0oMgV","object":"price","active":true,"billing_scheme":"per_unit","created":1663819599,"currency":"gbp","custom_unit_amount":null,"livemode":false,"lookup_key":null,"metadata":{},"nickname":"Member","product":"prod_MLPJteSBNjYbi1","recurring":null,"tax_behavior":"inclusive","tiers_mode":null,"transform_quantity":null,"type":"one_time","unit_amount":36000,"unit_amount_decimal":"36000"},
"quantity": 1
}

#

we don't see anything that lets us know what promo code was used.

#

also not on the charge object

dull palm
#

Hi, you're looking for confirm where amount_discount": 10000 came from?

twin steppe
#

where do you get that log request id from?

#

also that link is a human readable web page

#

we would like to programmatically know what promotion code was applied to a Checkout session.

gritty fossil
#

👋

#

You want to retrieve the Session and expand the line_items.data.discounts

#

The field isn't returned by default unless you expand it

twin steppe
#

ok thanks we will check it out. please dont close this thread yet.

#

See comment at the top of the pic pls

#

Thanks !