4 months ago

Common question

Posted 4 months ago by MarlonV

Morning Guys,

If a have a script like this, is the controller the right place to put it in? Or do i need to place it in the model, and call it in the controller. Anyone an example how to do that?

Thanks in advance.

    public function store(Request $request)
        $payment = Mollie::api()->payments()->create([
            'amount' => [
                'currency' => 'EUR',
                'value' => '10.00', // You must send the correct number of decimals, thus we enforce the use of strings
            'description' => 'My first API payment',
            'webhookUrl' => route('webhooks.mollie'),
            'redirectUrl' => route('payments.success'),
            $payment = Mollie::api()->payments()->get($payment->id);
            // redirect customer to Mollie checkout page
            return redirect($payment->getCheckoutUrl(), 303);

Please sign in or create an account to participate in this conversation.