Sounds like PayPal isn't fast enough with it's confirmation answer. It happens async. PayPal is slower to answer than other payment providers and you can easily get to the confirmation page without an actual confirmation from PayPal.
The process goes like this:
* user is sent to paypal and completes the payment
* Paypal starts it's checks and sends user back to webshop. At this point Tea Commerce moves the order to finalized in the session. That's why you have can GetCurrentFinalizedOrder
* Paypal calls webshop with a confirmation. NOW the order is actually finalized and gets it's OrderId. This is also when the confirmation e-mail will be triggered.
This means you should show a different message to the user if the payment method i paypal and there's no order id.
No, there will be no order ID before PayPal answers back. In theory other the payment could still be cancelled by Paypal and then there won't be an order at all. Paypal is really bad at that compared to all other payment gateways.
They will get the order id when the confirmation e-mail is sent to them.
So your order may appear to be finalized and your user is shown the confirmation page. Then, a little later (for unknown reasons) Paypal cancels/fails the order.
1) The user has been "mislead". How do we avoid this (not showing the confirmation page until Paypal confirms a successful transaction)?
2) How does Paypal communicate back to our site/and code? On success? On cancel/fail? (asking to understand how things work)
You don't use Paypal. Or you don't promise the user that the order is completely confirmed. It will be when he or she recieves the confirmation e-mail.
You will get an event when the order is finalized, so you could also let the user wait for the confirmation at fetch a status from the server with regular intervals.
It's a real issue with Paypal. Most of the other payment gateways handle this much smarter.
Staying on the payment page and polling the server for updates is probably the way to go. Then when you receive the callback/webhook confirming a successful transaction, you go to the confirmation page (or show a confirmation message on the payment page). Stripe's demo site is doing this.
When paying with iDEAL (Netherlands) you are redirected to the customer's bank for payment. If the customer then cancels, we should not send them to the confirmation page, and instead return to the original page. We won't know what action the customer takes until we receive the webhook after some delay. So the issue is not just with Paypal.
What's the recommended workflow for handling this scenario (staying on payment page/polling) in TeaCommerce? By workflow I mean which url's to use and which TeaCommerce Javascript/server side calls to use?
I think I know how to do this for my code, but it will be with my own ajax calls, etc. combined with using TeaCommerce's API.
Yes. Exacly. If you wan't more information than that you can make your own controller and get information from various sources including from the current finalized order. Then send it all back to the UI in one go.
Cool! Where do I find the server-side source for GetCurrentFinalizedOrder? I'm thinking of the Controller action method or similar. I might want to use the same coding pattern in my own code.
Paypal order Id
We have made a payment via PayPal and order is successfully processed but on thank you page we are not getting OrderID.
var FinalisedOrder = TC.GetCurrentFinalizedOrder(StoreId); @Model.FinalisedOrder.OrderNumber
Please can you suggest how can we get this value to state transaction is completed.
Attached is settings of the PayPal too. Looking forward to it.
Hi Shaishav,
Sounds like PayPal isn't fast enough with it's confirmation answer. It happens async. PayPal is slower to answer than other payment providers and you can easily get to the confirmation page without an actual confirmation from PayPal.
The process goes like this: * user is sent to paypal and completes the payment * Paypal starts it's checks and sends user back to webshop. At this point Tea Commerce moves the order to finalized in the session. That's why you have can GetCurrentFinalizedOrder * Paypal calls webshop with a confirmation. NOW the order is actually finalized and gets it's OrderId. This is also when the confirmation e-mail will be triggered.
This means you should show a different message to the user if the payment method i paypal and there's no order id.
/Rune
Hi Rune,
Many Thanks. I can understand now.
Is their no way to get order ID so that user has something to refer back?
Cheers, Shaishav
No, there will be no order ID before PayPal answers back. In theory other the payment could still be cancelled by Paypal and then there won't be an order at all. Paypal is really bad at that compared to all other payment gateways.
They will get the order id when the confirmation e-mail is sent to them.
So your order may appear to be finalized and your user is shown the confirmation page. Then, a little later (for unknown reasons) Paypal cancels/fails the order.
1) The user has been "mislead". How do we avoid this (not showing the confirmation page until Paypal confirms a successful transaction)?
2) How does Paypal communicate back to our site/and code? On success? On cancel/fail? (asking to understand how things work)
-Tor
Hi Tor,
You don't use Paypal. Or you don't promise the user that the order is completely confirmed. It will be when he or she recieves the confirmation e-mail. You will get an event when the order is finalized, so you could also let the user wait for the confirmation at fetch a status from the server with regular intervals.
It's a real issue with Paypal. Most of the other payment gateways handle this much smarter.
/Rune
Staying on the payment page and polling the server for updates is probably the way to go. Then when you receive the callback/webhook confirming a successful transaction, you go to the confirmation page (or show a confirmation message on the payment page). Stripe's demo site is doing this.
When paying with iDEAL (Netherlands) you are redirected to the customer's bank for payment. If the customer then cancels, we should not send them to the confirmation page, and instead return to the original page. We won't know what action the customer takes until we receive the webhook after some delay. So the issue is not just with Paypal.
What's the recommended workflow for handling this scenario (staying on payment page/polling) in TeaCommerce? By workflow I mean which url's to use and which TeaCommerce Javascript/server side calls to use?
I think I know how to do this for my code, but it will be with my own ajax calls, etc. combined with using TeaCommerce's API.
-Tor
I think GetCurrentFinalizedOrder would be the way to go. You can call it using the JavaScript API and check for the change you need.
/Rune
You mean to make this call in the polling process to get the status of the order?
-Tor
Yes. Exacly. If you wan't more information than that you can make your own controller and get information from various sources including from the current finalized order. Then send it all back to the UI in one go.
/Rune
Cool! Where do I find the server-side source for GetCurrentFinalizedOrder? I'm thinking of the Controller action method or similar. I might want to use the same coding pattern in my own code.
Right here: https://docs.teacommerce.net/v3.0.0/reference#getcurrentfinalizedorder
Make Sense - Thanks!
is working on a reply...