is it possible to maintaining conversation during redirect to external url? I started paypal transaction with CDI conversation bean and next there is faces redirect to paypal page when I log in and doing payment and next paypal returning to my page and I want to have the same instance of my backing bean to remember details which I sent to paypal.
When paypal redirects back to my page, he appends to url transaction token and payer ID but I don't have any information about quantity of products which user bought. So I want to remember the quantity from before redirect. Now, after paypal returns to my site I call method doExpressCheckout and I want to pass quantity and other transaction details because I can set entirely different details than before the transaction and there is possible strange situation when customer accept on paypal page that buying some products for 10$, but I set 100$ after paypal redirects again to my page and customer will have no idea how much he paid. I don't know why that this happens.
I use SOAP api.
Yes, you can resume your conversation from an external redirect. Just include the
cid=nnn in the return URL you pass to PayPal. For example:
returnUrl = "http://myip/myapp/return.seam?cid=" + Conversation.instance().getId(); details.setReturnURL(returnUrl); ...
As the 2 minute default for conversation timeout is rather limited, you will eventually want to increase the conversation timeout before placing the call to PayPal:
Conversation.instance().setTimeout(900000); // 15 minutes
However, doing this is not necessarily a good idea as it keeps data around for potentially a long time, and you need to keep the session cookie as well for this scheme to work (so you must increase the session timeout as well if necessary).
A better strategy would be to keep the transaction data persistently (db or disk), associate a randomly generated ID to the data and retrieve it on return from PayPal. This way you don't need to keep the conversation in memory.