+ Start a Discussion

Paypal X Adaptive Payments Toolkit Workflow Issue - Delay in Page Redirect

I have completed an application that uses the Paypal Adaptive Payments Toolkit.  

I have two pages: one that posts the payment to Paypal and a second that receives confirmation that the payment was approved by the user via Paypal.


 The problem that I am having is that once the user approves the payment on the Paypal web page. Paypal displays a page indicating that the payment is complete and pauses for several seconds before returning to Salesforce.  If the user closes the window prior to the page redirect the payment is made but not recorded in Salesforce.


Has anyone using the toolkit experienced this problem? Is there a work around? Is there a way to make the redirect from Paypal immediate?


Thank you for your help!








I opened a support issue with Paypal on this particular problem on this was the response.


The concern is valid. Please consider a solution using either IPN (Instant Payment Notification, refer to the Adaptive Payment Developer Guide, Chapter 3 and 16), or PaymentDetails (Adaptive Payment Developer Guide, Chapter 4).


Using IPN defeats the purpose of using the Toolkit.


In Salesforce, it is my understanding that  HTTP Callouts require all database transactions to be committed.  APEX code only commits when the APEX Script is completed (since there is no explicit commit in APEX). 


I did not see any case in Paypal Adaptive Toolkit sample code or tutorial base  where the committed  transaction is stored in the Salesforce Database that does not avoid the problem with the delay in the relay script.


So my question is with the Toolkit what is the best practice for writing completed PayPal transactions back to the Salesforce.com database.


Thank you for your help.