PayPal Express handles the entire payment process through JavaScript and triggers a callback function which would allow me to redirect to the Payment Complete page once the payment has been authorized and executed.
As everything is handled through JavaScript, TeaCommerce doesn't handle any callbacks from PayPal which means it can't know that the order has been finalized.
Is there a way I can manually finalize the order in TeaCommerce, or is there a better way to go about this?
The best way to make support for a payment gateway in Tea Commerce is to make a Payment Provider. That is where you can do server secure callbacks/finalize and handle all that logic. You would start by making the GenerateHtmlForm method and then work you way through to make a callback and do the security check there and then TC will finalize it.
Not that I know of no. It probably won't be worked on by us to be honest, as it makes things a whole heap more complicated to implement and also puts the security related setup on your shoulders, which due to recent regulatory changes, specifically SCA in EU, is a responsibility we don't want to give people OOTB.
From our perspective, the redirect model of the current provider makes it much simpler to integrate and much less for us to commit to maintaining (which when you consider how many payment providers we are supporting, each with their on way of doing things, is already a big commitment).
Now, all this said, this is not to say it is not possible, so if you did want to go this approach yourself, you most certainly can. The best I could suggest would be to take a look at the Stripe payment provider to see how that one works as that is one of the only providers that works inline (and it's from here that we've learnt all the issues about doing inline payments). Hopefully between that and the PayPal provider itself you should be able to piece something together.
Here are some links to the main things you'll need to look into.
It's a shame that there's no PayPal Express solution especially as Tea Commerce is developed in the UK now (I believe) and PayPal is very common in the UK.
It seems it would be mutually beneficial for both TC & PP.
Hi Matt, we still have a perfectly working PayPal provider it’s just that it’s redirect based rather than inline.
Ultimately I think the redirect approach is more robust, puts less demand on the implementer and is simpler to maintain so will overall suite most people. If anyone wants to go the extra mile to do inline PayPal Express then there is nothing stopping them as payment providers are completely pluggable, it’s just that it will have to be community contributed + maintained.
Ahh, sure, then I understand your concern. Interesting that they are pushing you to Express though as I've been working on a Vendr payment provider recently for PayPal and all their docs seem to push you down their Checkout Smart Button implementation which is another inline solution.
Regardless, they do still have a valid payment's API that work via redirects which is what we will be using in Vendr and should it come time to update the TC payment provider, will be what we back-port.
I don't think they will be getting rid of the redirect approach completely though as it is necessary for specific environments.
PS we get no assistance from payment gateways in creating our providers so whilst it would provide benefit for both parties, all the maintenance falls on us and when you are talking 20+ payment providers that’s a lot of responsibility so choosing the simpler, safer and most widely used implementations just makes most sense for us.
PayPal Express
I have a website which currently has the PayPal payment option, but I'd like to modify this to use PayPal Express instead so that the customer never leaves the website during the checkout flow. https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/
PayPal Express handles the entire payment process through JavaScript and triggers a callback function which would allow me to redirect to the Payment Complete page once the payment has been authorized and executed.
As everything is handled through JavaScript, TeaCommerce doesn't handle any callbacks from PayPal which means it can't know that the order has been finalized.
Is there a way I can manually finalize the order in TeaCommerce, or is there a better way to go about this?
Hi Aaron
The best way to make support for a payment gateway in Tea Commerce is to make a Payment Provider. That is where you can do server secure callbacks/finalize and handle all that logic. You would start by making the GenerateHtmlForm method and then work you way through to make a callback and do the security check there and then TC will finalize it.
https://github.com/TeaCommerce/Payment-providers/tree/master/Source/TeaCommerce.PaymentProviders
Let me know if you hit any walls.
Kind regards
Anders
Has anyone got Tea Commerce working with PayPal Express yet?
Hey Matt,
Not that I know of no. It probably won't be worked on by us to be honest, as it makes things a whole heap more complicated to implement and also puts the security related setup on your shoulders, which due to recent regulatory changes, specifically SCA in EU, is a responsibility we don't want to give people OOTB.
From our perspective, the redirect model of the current provider makes it much simpler to integrate and much less for us to commit to maintaining (which when you consider how many payment providers we are supporting, each with their on way of doing things, is already a big commitment).
Now, all this said, this is not to say it is not possible, so if you did want to go this approach yourself, you most certainly can. The best I could suggest would be to take a look at the Stripe payment provider to see how that one works as that is one of the only providers that works inline (and it's from here that we've learnt all the issues about doing inline payments). Hopefully between that and the PayPal provider itself you should be able to piece something together.
Here are some links to the main things you'll need to look into.
https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/tree/master/Source/TeaCommerce.PaymentProviders.Stripe
https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/blob/master/Source/TeaCommerce.PaymentProviders.UI/Views/Partials/StripePaymentForm.cshtml
https://github.com/TeaCommerce/Tea-Commerce-Payment-Providers/tree/master/Source/TeaCommerce.PaymentProviders.PayPal
Hope this helps
Matt
Thanks for the update Matt.
It's a shame that there's no PayPal Express solution especially as Tea Commerce is developed in the UK now (I believe) and PayPal is very common in the UK.
It seems it would be mutually beneficial for both TC & PP.
Cheers,
Matt
Hi Matt,
I did manage to implement a PayPal Express solution that (looking back) feels fairly hacky, but did and does work!
I'll update later this evening with a link to some of the files in github, and feel free to tear it apart and make it work as you need it to :)
Cheers, Aaron
That's awesome.
Thanks for sharing Aaron 🙌
Hi Matt, we still have a perfectly working PayPal provider it’s just that it’s redirect based rather than inline.
Ultimately I think the redirect approach is more robust, puts less demand on the implementer and is simpler to maintain so will overall suite most people. If anyone wants to go the extra mile to do inline PayPal Express then there is nothing stopping them as payment providers are completely pluggable, it’s just that it will have to be community contributed + maintained.
I agree with what you say Matt regarding PayPal Standard working just fine.
It's just that PayPal have been contacting those using Standard for a few years now and trying to get them to switch to Express.
Perhaps they are trying to phase it out.
Hi Matt,
Ahh, sure, then I understand your concern. Interesting that they are pushing you to Express though as I've been working on a Vendr payment provider recently for PayPal and all their docs seem to push you down their Checkout Smart Button implementation which is another inline solution.
Regardless, they do still have a valid payment's API that work via redirects which is what we will be using in Vendr and should it come time to update the TC payment provider, will be what we back-port.
I don't think they will be getting rid of the redirect approach completely though as it is necessary for specific environments.
Matt
PS we get no assistance from payment gateways in creating our providers so whilst it would provide benefit for both parties, all the maintenance falls on us and when you are talking 20+ payment providers that’s a lot of responsibility so choosing the simpler, safer and most widely used implementations just makes most sense for us.
Hi Matt and Matt,
Here is a link to my github containing my slightly modified implementation of PayPal Express: https://github.com/AzzA-D/TeaCommerce.PayPalExpress
There's a few caveats mentioned in the readme.md but I hope this at least helps get you pointed in the right direction!
Cheers, Aaron
That's great Aaron, thanks.
is working on a reply...