vanilophp / stripe

Stripe Module for Vanilo Payments
MIT License
1 stars 3 forks source link

Return URL #1

Closed towoju5 closed 2 years ago

towoju5 commented 2 years ago

Please How do i add a return url on a successful payment? Below is how i called the payment endpoint. or better still if i can redirect user to Stripe website for checkout and have a return_url/success_url setup as we have in the regular stripe session integration.

        $paymentMethod = PaymentMethod::find($request->get('paymentMethod'));
        $payment = PaymentFactory::createFromPayable($order, $paymentMethod);
        $gateway = PaymentGateways::make($paymentMethod->gateway);
        $paymentRequest = $gateway->createPaymentRequest($payment);

I was able to implement the Stripe form on the website but after the payment it shows a successful payment notification but won't redirect.

fulopattila122 commented 2 years ago

I need to take a look at it. This module hasn't been finalized yet, but this part (return URL generation) has been generalized already across other Vanilo Payment gateway implementations, so I think we can solve this quickly.

I will come back on this soon.

towoju5 commented 2 years ago

Thanks for the hard work on this. I really enjoyed the framework.

fulopattila122 commented 2 years ago

Sorry for the slow response, here we go:

$gateway->createPaymentRequest($payment, null, ['return_url' => 'https://your.return.url']);

The second, null parameter can be null or a shipping address object.

fulopattila122 commented 1 month ago

With the 2.1 version of the module, you can configure the return URL in the configuration instead of passing it as an option: