#ibgoldbergs

1 messages · Page 1 of 1 (latest)

next trailBOT
red lantern
rugged vale
#

you can see i'm in test mode and the coupon exists

red lantern
#

Hm, do you have a Coupon with the same ID created in livemode?

rugged vale
#

I do

#

is that an issue?

red lantern
#

I think it might be, but if so that seems like a bug on our end. If you're not actively using that Coupon in livemode, could you try deleting it and see if that causes your request to not error?

rugged vale
#

Ill create a new one called test_10OFFLTD and see if it works

#

Similar error, but says it doesnt exist in live mode

#

'Server error': {
"message": "No such coupon: 'test_10OFFLTD'",
"stack": [
"Error: No such coupon: 'test_10OFFLTD'",
" at Function.generate (/Users/ericosoares/Desktop/ov-api/node_modules/stripe/lib/Error.js:40:16)",
" at res.toJSON.then.StripeAPIError.message (/Users/ericosoares/Desktop/ov-api/node_modules/stripe/lib/StripeResource.js:220:35)",
" at processTicksAndRejections (node:internal/process/task_queues:96:5)"
]
}

red lantern
#

Can you share the request ID (req_xxx) for that most recent request?

rugged vale
#

yes let me grab that for you

#

req_Wv5Y38tjwJ7uoT

#

@red lantern there you go

red lantern
#

Thank you, nothing is readily jumping out at me as to why that error was encountered. I'll need to dig further.

rugged vale
#

Sounds good, that would be helpful

red lantern
#

Ah, I think you're passing the name of the Coupon instead of its ID. Running a quick test to confirm.

rugged vale
#

do we need to pass ID instead?

red lantern
#

That's correct, the Subscription creation request is expecting the ID of the Coupon. Coupon's are one of the few objects within our ecosystem where you have control over the ID that is used rather than it being randomly generated:
https://stripe.com/docs/api/coupons/create#create_coupon-id
However, if that field is omitted from the request when a coupon is created, then a random string generated for its ID. The response of the Coupon creation request will contain that id though.
https://dashboard.stripe.com/test/logs/req_3t1UPMn4yTzTjH

rugged vale
#

makes sense

#

i'll make that update, and we should be okay

#

thank you for your help

red lantern
#

Sounds good, always happy to help. Let us know if that doesn't work for you.