#paulh92 - Laravel

1 messages · Page 1 of 1 (latest)

finite steppe
#

Do you have an example request ID (req_123) from a time it didn't work?

lilac crystal
#

i got this one mate

#

do you think its because its not getting the id instead its using the code?

finite steppe
lilac crystal
#

This is all i see in there

finite steppe
#

Ah yes you are right. You should be using its ID instead of the code

lilac crystal
#

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;
}
}

restive stone