#pro-pooja

1 messages · Page 1 of 1 (latest)

royal hamletBOT
rustic yarrow
#

Hi there!

#

Note that you'll have to use expand: ["total_details.breakdown"] in order to view that field

stray estuary
#

let me try, thanks

royal hamletBOT
stray estuary
#

How to get an applied promo code name?

still moon
stray estuary
#

I am listening to checkout.session.completed event , Just to get promotion code, I've to call two APIs, First get checkout session and then prmotion code?

still moon
#

yep it can be several API calls to get this information

#

note you can pass expand=>["total_details.breakdown.discounts.discount"] to skip at least one call for retrieving the Discount

stray estuary
#

Thanks, let me try

stray estuary
#

Hey, I passed the parameter expand=>["total_details.breakdown.discounts.discount"] in get checkout session api, but still it's not returning applied promo code.

still moon
#

what does it return instead?

stray estuary
#

Only the promo code id is there.

still moon
#

yep, which is normal

stray estuary
#

Does that mean I've to make 2 API calls?

still moon
#

yep it can be several API calls to get this information

stray estuary
#

I am using stripe-hosted checkout to complete the payment flow. Also, using couple of stripe webhooks. Is there any workaround to get the payment details with applied promo code with minimum API calls?

still moon
#

what we're talking about in this thread is the way with minimum API calls, we're already answering your question

#

you have to make some extra API calls when handling the checkout.session.completed event to get every single detail about the payment especially when it has some extra complexity like applied discounts; it's just how this is designed. It's no big deal to make some API calls.

stray estuary
#

Okay, got it.