#Mackan-Checkout

1 messages · Page 1 of 1 (latest)

little agate
#

Hi, sorry this is not straightforward to receive that information. Normally inside a Checkout Session you will have PaymentIntent, from which you can find the Invoice. Inside the Invoice you would have the Discounts object and Promotion Code

deep fiber
#

Do I need to expand the invoice? My current request using stripe-node gives a value of null to session.payment_intent.invoice

const session = await stripe.checkout.sessions.retrieve(sessionId, {
    expand: [ 'line_items', 'line_items.data.discounts', 'payment_intent', 'total_details.breakdown' ],
})
little agate
#

Sorry I think you were correct to use total_details.breakdown. Inside breakdown can you see total_details.breakdown.discounts.discount?

#

It is a discount object

#

From there we can go ahead to get the coupons, then promotion code

deep fiber
#

It is there, yes.

#

Should I get the coupon using discount.coupon.id or the promotion with discount.promotion_code?

How does it work if there's multiple customer-facing codes for a single discount?

little agate
#

Oh there is discount.promotion_code right there!

#

Multiple customer-facing codes applied will results in multiple discount objects, I think

deep fiber
#

I see, but if only one is applied, I'll be getting just that one, even if the promotion has two valid codes?

little agate
#

You should only get the one that applied, I think