Paypal API - retry subscription after Paypal timeout
Hi,
I've started down the road of integrating PayPal via the API. I've just encountered a situation during testing where the user is directed to the PayPal page (after a call to newCusomter) and then lets the session timeout.
In this instance what's the correct workflow? I can check the customer status and it says "paypal-wait". At what point would I want to give the user the option of attempting to subscribe again and what would be the correct API call to make for this? I'm using the "official" PHP client.
Thanks,
Paul.
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Marc Guyer on 21 Sep, 2011 01:57 PM
Hi Paul -- You can give the user the option to subscribe again at any time, no matter the status. If the customer visits your site and you detect that the status is 'paypal-wait', it's possible that they completed the preapproval workflow but we just haven't heard back from PayPal yet. It's also possible that they never completed the workflow. In this case, you could present the customer with the option to resubscribe if you determine that the subscription is "stale", say 10 minutes old, for example.
2 Posted by paul on 21 Sep, 2011 01:59 PM
Thanks Marc,
I know it was an example but would 10 minutes be reasonable time frame? Is there a risk that the user could subscribe twice if actually the first attempt had gone through ok but for whatever reason it wasn't reflected in the CG status yet?
Paul.
Support Staff 3 Posted by Marc Guyer on 21 Sep, 2011 02:14 PM
Well, PayPal usually only takes a few seconds to send the IPN back to us so 10 minutes is probably a bit conservative. In our hosted pages, we explain to the customer that we're waiting for PayPal to respond but also give them the opportunity to resubscribe anyway. If they begin the process again, we auto-cancel the previous preapproval request. To be clear, they're not subscribing again but rather are approving a new preapproval. There's no danger of having two CG subscriptions as long as you don't use the new customer api call again. In the case of a new preapproval on an existing CG subscription, you would use the edit-subscription call, CheddarGetter_Client::editSubscription() in the PHP wrapper. Here's the doc on updating a PayPal subscription.
4 Posted by paul on 21 Sep, 2011 02:25 PM
Great,
So just to repeat what you said and clarify my workflow....for a new user the first call is to newCustomer. I then monitor the state of the subscription. Assuming that after 10 minutes (for arguments sake) the status is still "paypal-wait" I can give the user an option of retrying the subscription but this time I use the editSubscription API to generate the redirect URL.
Just to sneak in a bonus question I keep seeing mention of PayPal simulation. How do I do this? I've searched for "simulation" in the help but there seems to be an assumption that I know how to get started.
As I final note this documentation on the paypal API talks about passing "PayPal" as the method. When I tried that it didn't work, it seems like it needs to be lower case "paypal".
Thanks,
Support Staff 5 Posted by Marc Guyer on 21 Sep, 2011 02:33 PM
That's exactly correct.
All CG accounts are simulation mode by default. You enabled a live PayPal account on one account. Your test account (testdeepdive) is in simulation mode.
6 Posted by paul on 21 Sep, 2011 02:36 PM
Excellent. Thanks for your help.
Marc Guyer closed this discussion on 22 Sep, 2011 03:49 PM.