#paulh92 - Laravel
1 messages · Page 1 of 1 (latest)
i got this one mate
"error": {
"code": "resource_missing",
"doc_url": "https://stripe.com/docs/error-codes/resource-missing",
"message": "No such coupon: 'Test205'",
"param": "coupon",
"type": "invalid_request_error"
do you think its because its not getting the id instead its using the code?
Hard to say from that error. Can you find the call that got that error in your logs and send me your request ID? https://dashboard.stripe.com/test/logs
Ah yes you are right. You should be using its ID instead of the code
is there a way to convert a users code input to the id?
i noticed this online
private function validatePromocode($promo)
{
try {
$promoCodes = Cache::remember('stripe-cache-promocodes', 600, function () {
$promos = PromotionCode::all(["active" => true]);
return $promos;
});
foreach ($promoCodes->data as $promoCode) {
if($promo==$promoCode->code) {
// valid
return $promoCode->id;
}
}
} catch (\Exception $e) {
return false;
}
}