#jamie_97274
1 messages · Page 1 of 1 (latest)
Hello jamie_97274, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• jamie_97274, 2 days ago, 7 messages
• jamie_97274, 5 days ago, 4 messages
I think I'd need to know more about the promotion code that you are looking up in each call
coupon is a valid parameter, so I am guessing an invalid value was passed in to it
Can you show me what you are passing in for $code in both instances?
Sorry you're missing some context, I am using this code to validate if a coupon/promo code exists or not, this returns an empty data array:
$promoCodes = $this->stripe->promotionCodes->all(['code' => $code]);
Which is fine because I can then return relevant data in the API to say that the coupon does not exist.
The following behaves different:
$promoCodes = $this->stripe->promotionCodes->all(['coupon' => $code]);
It does not return an empty data array if no coupon has been found, but instead returns an InvalidRequestException error
Have you printed out the error message from the InvalidRequestException?
It should explain why the exception is being thrown.
Yes I am aware, there is no coupon with that code
but as I said
$promoCodes = $this->stripe->promotionCodes->all(['code' => $code]);
Does not return an error saying 'no promotion code with that code', it returns an empty data array
Right, and I would expect that passing a coupon Id would do the same thing if you pass a valid coupon ID