Paypal API - retry subscription after Paypal timeout

paul's Avatar

paul

21 Sep, 2011 12:58 PM

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.

  1. Support Staff 1 Posted by Marc Guyer on 21 Sep, 2011 01:57 PM

    Marc Guyer's Avatar

    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. 2 Posted by paul on 21 Sep, 2011 01:59 PM

    paul's Avatar

    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.

  3. Support Staff 3 Posted by Marc Guyer on 21 Sep, 2011 02:14 PM

    Marc Guyer's Avatar

    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. 4 Posted by paul on 21 Sep, 2011 02:25 PM

    paul's Avatar

    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,

  5. Support Staff 5 Posted by Marc Guyer on 21 Sep, 2011 02:33 PM

    Marc Guyer's Avatar

    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.

    That's exactly correct.

    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.

    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. 6 Posted by paul on 21 Sep, 2011 02:36 PM

    paul's Avatar

    Excellent. Thanks for your help.

  7. Marc Guyer closed this discussion on 22 Sep, 2011 03:49 PM.

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

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM