#pooja-checkout-promotioncode

1 messages · Page 1 of 1 (latest)

copper ermineBOT
haughty mountain
#

Can you share an example where this was used that you're trying to retrieve?

#

I'm assuming this was applied during a checkout session?

fervent compass
#

I am using stripe hosted checkout, and I need to get the payment detail of user. For that I am using session.completed.checkout event and then making API calls to get session object and the coupon object.

haughty mountain
#

If you give me a few minutes I can test that to confirm myself

fervent compass
#

I've already applied this param in checkout session API
Yeah, sure.

haughty mountain
#

Ok yea you can use expand[]=total_details.breakdown then find the promo code in the discount object

fervent compass
#

I don't need that, user has not applied that code, user has applied for example TEST10. I need that code

haughty mountain
#

You'd need to separately retrieve the Promotion Code object by ID to get the human-readable code if you need that

#

because it exists at a path too deep for expansion

#

(limit is four levels)

fervent compass
#

It's not event in that API response

{ "id": "promo_1NKcmCDPAH7QIF0ajpVeeDyM", "object": "promotion_code", "active": false, "code": "J4UVIFOC", "coupon": { "id": "w0JyBc1y", "object": "coupon", "amount_off": null, "created": 1687160700, "currency": null, "duration": "forever", "duration_in_months": null, "livemode": false, "max_redemptions": null, "metadata": {}, "name": "10% Off", "percent_off": 100.0, "redeem_by": null, "times_redeemed": 0, "valid": false }, "created": 1687160728, "customer": null, "expires_at": null, "livemode": false, "max_redemptions": null, "metadata": {}, "restrictions": { "first_time_transaction": false, "minimum_amount": null, "minimum_amount_currency": null }, "times_redeemed": 0 }

haughty mountain
#

"code": "J4UVIFOC",

fervent compass
#

No, that is not the code, user is applying

haughty mountain
#

Then it must be a different promo code. Can you share the example session id?

fervent compass
#

cs_test_b1HcTZijTi0yIq7R2A4glgqNAeyPj482kKddVLroq3ry4nLtMtDqvYaOQK

haughty mountain
#

Hmm when/how is the customer applying this?

#

I don't see a request on that session to use a promo code, but I do see the discount being applied

fervent compass
#

Customer is applying the code on checkout flow.

#

I am doing the testing and manually applying the code while checkout

haughty mountain
#

Is there somewhere I can access your test mode pricing table online?

#

To try the TEST10 promo code myself?

fervent compass
#

TSET10 was for example, the actual promo code I applied was DOQIT10.

#

pricing-table-id="prctbl_1NJypzDPAH7QIF0a1WzpjPIr"

haughty mountain
#

oh, ok. i do see that, then

#

And if you expand the total_details.breakdown for cs_test_b1HcTZijTi0yIq7R2A4glgqNAeyPj482kKddVLroq3ry4nLtMtDqvYaOQK what does that look like?

#

(I can't see GET request response body, so please share)

fervent compass
haughty mountain
#

Ok, thank you

#

That looks right

#

And if you retrieve promo_1NKeLiDPAH7QIF0aG15e2cai you will see it has code=doqit10

fervent compass
#

Sorry, But I can't see code= doqit10

haughty mountain
#

Did you retrieve the promo code?

#

I'd also suggest caching this data on your server if you only have a few promo codes, so you can directly look up promo_1NKeLiDPAH7QIF0aG15e2cai without a retrieval

fervent compass
#

This is the response

{ "id": "promo_1NKcmCDPAH7QIF0ajpVeeDyM", "object": "promotion_code", "active": false, "code": "J4UVIFOC", "coupon": { "id": "w0JyBc1y", "object": "coupon", "amount_off": null, "created": 1687160700, "currency": null, "duration": "forever", "duration_in_months": null, "livemode": false, "max_redemptions": null, "metadata": {}, "name": "10% Off", "percent_off": 100.0, "redeem_by": null, "times_redeemed": 0, "valid": false }, "created": 1687160728, "customer": null, "expires_at": null, "livemode": false, "max_redemptions": null, "metadata": {}, "restrictions": { "first_time_transaction": false, "minimum_amount": null, "minimum_amount_currency": null }, "times_redeemed": 0 }

fervent compass
#

Getting It. Thank you so much for your assistance.

haughty mountain
#

That's a different promo code ID that doesnt match the doqit10 example

#

So just check the promo code ID you're retrieving

copper ermineBOT