How do you connect a Paypal IPN confirmation to a user?
Asked Answered
V

4

9

I wanted to use Paypal's IPN service to verify payments for a recurring subscription charge for my website. How do you tie the IPN confirmations to a user in your site?

The IPN confirmation message has a name, email, paypal ID, recurring payment ID, but it seems to not give a unique identifier since I don't know where the paypal ID or recurring payment id comes from and it may not be trivial to uniquely match up the name/email that a user has on their paypal account (or entered there) with the name/email I have for them on my site (there may be many John Smith's and the person may choose to use a different email.)

1) When I send the initial payment request to Paypal, I can attach a unique UUID in the URL I ask them to send back to me, so if I save that unique ID for that user I can match that payment confirmation to the user who initiated it. Am I making that harder than it is? Is there an easier way?

2) Also, for a recurring/subscription charge, does paypal always use the URL I specified with the initial payment initiation? Does anyone have practical experience using the recurring Paypal payments with IPN's, does it reuse that unique URL? Or do I have to associate the Paypal ID's with the user after the first recurring payment is received?

Vanden answered 19/2, 2009 at 21:35 Comment(0)
R
2

I recently also set up some reoccurring payments with Paypal.

I actually wanted people to register as members after paying for the subscription, if they wanted to. As having to sign up as a member could add some friction to the sale process. So I don't send any user info along with the Subscribe button.

What my IPN script does is generate a unique activation code tied to the Paypal subscriptionID in the Activations table, then it sends this code to whoever paid for the subscription, with instructions on how to activate.

At the point of activation, you need to register or login. At this point the userID is added to the relevant row in the Activations table.

When the EndOfTerm IPN notification comes in the IPN script looks up the userID from the Activations table based on the SubscriberID given in the IPN. Then I can do whatever I need to do to that user to disable their subscription.

At all time the URL of the IPN script remains the same.

Roderich answered 19/2, 2009 at 22:10 Comment(1)
What txn_type status codes do you react to? I'm having a tough time getting this question answered. #13855787Grazier
F
3

Attaching unique data to the payment request is pretty much the accepted way to do it.

I don't have any experience with recurring charges.

Fakir answered 19/2, 2009 at 21:44 Comment(2)
Do you know how to propagate some data along with other PayPal data, in the initial PayPal request, generated from a click of a PayPal "Pay now" button?Baillargeon
@VladimirDespotovic There is an extra field in both the "Pay Now" button and payment request API where you can add custom data. That custom data is sent back to you in every response related to the transaction.Fakir
R
2

I recently also set up some reoccurring payments with Paypal.

I actually wanted people to register as members after paying for the subscription, if they wanted to. As having to sign up as a member could add some friction to the sale process. So I don't send any user info along with the Subscribe button.

What my IPN script does is generate a unique activation code tied to the Paypal subscriptionID in the Activations table, then it sends this code to whoever paid for the subscription, with instructions on how to activate.

At the point of activation, you need to register or login. At this point the userID is added to the relevant row in the Activations table.

When the EndOfTerm IPN notification comes in the IPN script looks up the userID from the Activations table based on the SubscriberID given in the IPN. Then I can do whatever I need to do to that user to disable their subscription.

At all time the URL of the IPN script remains the same.

Roderich answered 19/2, 2009 at 22:10 Comment(1)
What txn_type status codes do you react to? I'm having a tough time getting this question answered. #13855787Grazier
C
0

1) You can send an 'item_number' parameter with the initial subscription setup, which will get passed back to you. I'd suggest embedding an identification token in it.

2) If you mean the 'return' parameter, no, that's for sending the user to at the conclusion of the subscription setup. The renewal is automatic and doesn't 'ping' that page.

Charmain answered 19/2, 2009 at 21:44 Comment(0)
P
0

1) You want to be using the item_number parameter. Set this in your HTML form shown to the customer, and it will be returned to you by the paypal IPN, so you can put a database row ID in here, and use it to match up to the right person later.

Percaline answered 11/2, 2010 at 16:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.