#manzano55
1 messages · Page 1 of 1 (latest)
Hello manzano55, 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.
• manzano55, 5 hours ago, 3 messages
• manzano55, 20 hours ago, 24 messages
• manzano55, 1 day ago, 35 messages
unfortunately it's a different question, but no problem, I'm waiting for an answer!
I can help you with how to do this through our own API, but laravel cashier is not a library we own and I'm not even sure if it specifically supports creating coupons with currency_options
It's actually quite simple, the object I need to assemble is the same as the one in the stripe documentation, but it has this parameter to define multiple choices of currencies and I can't define it, could you tell me how it works to define it?
Ah gotcha, you're using the Stripe client directly
The issue here is that you're using currency_options incorrectly
Have you taken a look at our API reference for this? https://stripe.com/docs/api/coupons/create#create_coupon-currency_options
WE're expecting something more like
'currency_options' => [
'usd' => [
'amount_off'=> 100
]
]
(I may have gotten the syntax a bit wrong since I'm just whipping up something real fast)
Yes, I'm following the documentation, but I got stuck on this parameter, I couldn't quite understand how to define it
Hmm okay, I'll try that right now
Will I still need to provide the 'amount_off' parameter outside of the currency_options metadata?
Yes, I believe you'd still need to provide that
$stripe = Cashier::stripe();
return $stripe->coupons->create([
'amount_off' => $discountValue,
'duration' => 'once',
'name' => 'INDIQUE E GANHE OFF',
'currency_options' => [
'brl' => [
'amount_off' => $discountValue,
],
'usd' => [
'amount_off' => $discountValue,
],
],
]);
R: You must pass currency when passing amount_off - 38
$stripe = Cashier::stripe();
return $stripe->coupons->create([
'duration' => 'once',
'name' => 'INDIQUE E GANHE OFF',
'currency_options' => [
'brl' => [
'amount_off' => $discountValue,
],
'usd' => [
'amount_off' => $discountValue,
],
],
]);
R: Must provide percent_off or amount_off. - 38
Yeah you still need to include it
$stripe = Cashier::stripe();
return $stripe->coupons->create([
'amount_off' => $discountValue,
'currency' => 'brl',
'duration' => 'once',
'name' => 'INDIQUE E GANHE OFF',
'currency_options' => [
'usd' => [
'amount_off' => $discountValue,
],
],
]);
Its working, thank you!