#ibgoldbergs
1 messages · Page 1 of 1 (latest)
Hi there 👋 that error does seem to indicate that the Coupon was created in livemode so it cannot be used in testmode. If you check in your dashboard here, do you see the coupon listed?
https://dashboard.stripe.com/test/coupons
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hm, do you have a Coupon with the same ID created in livemode?
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?
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)"
]
}
Can you share the request ID (req_xxx) for that most recent request?
Thank you, nothing is readily jumping out at me as to why that error was encountered. I'll need to dig further.
Sounds good, that would be helpful
Ah, I think you're passing the name of the Coupon instead of its ID. Running a quick test to confirm.
do we need to pass ID instead?
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
Sounds good, always happy to help. Let us know if that doesn't work for you.