#manzano55

1 messages · Page 1 of 1 (latest)

visual tartanBOT
#

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

dim zenith
#

unfortunately it's a different question, but no problem, I'm waiting for an answer!

fathom bronze
#

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

dim zenith
#

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?

fathom bronze
#

Ah gotcha, you're using the Stripe client directly

#

The issue here is that you're using currency_options incorrectly

#

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)

dim zenith
#

Yes, I'm following the documentation, but I got stuck on this parameter, I couldn't quite understand how to define it

dim zenith
#

Will I still need to provide the 'amount_off' parameter outside of the currency_options metadata?

fathom bronze
#

Yes, I believe you'd still need to provide that

dim zenith
#
            $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

fathom bronze
#

Yeah you still need to include it

dim zenith
#
            $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!