Closed Jimmylet closed 4 years ago
Hello,
Is there a way to collect the payment URL that redirects to Mollie? I am trying to use your package with vuejs in a SPA.
It seems to work (great job, thanks! Mollie is really better than Stripe for us Europeans).
Here is my controller :
public function __invoke(string $plan) { $user = Auth::user(); $name = ucfirst($plan) . ' membership'; if(!$user->subscribed($name, $plan)) { $result = $user->newSubscriptionViaMollieCheckout($name, $plan)->create(); if(is_a($result, RedirectResponse::class)) { return $result; // Redirect to Mollie checkout } return response()->json([ 'status' => 'Félicitation, vous êtes inscrit au ' . $plan . ' plan' ]); } return response()->json([ 'status' => 'Vous êtes déjà inscrit au ' . $plan . ' plan' ]); }
In chrome, I get a good xhr. When I copy / paste the link into the browser, I'm redirecting to Mollie.
What I need is to send the redirection link in a response json. Thanks to that, I could capture it with vue.js and redirect the user simply.
Thank you !
Hi,
Yes you can. I've decorated the RedirectResponse to return a ~ReturnToRedirectResponse~ ReturnToCheckoutResponse instead.
So you can do:
$response->payment()->getCheckoutUrl();
Hello,
Is there a way to collect the payment URL that redirects to Mollie? I am trying to use your package with vuejs in a SPA.
It seems to work (great job, thanks! Mollie is really better than Stripe for us Europeans).
Here is my controller :
In chrome, I get a good xhr. When I copy / paste the link into the browser, I'm redirecting to Mollie.
What I need is to send the redirection link in a response json. Thanks to that, I could capture it with vue.js and redirect the user simply.
Thank you !