|
|
|
Rank: Starting Member
Groups: Registered
Joined: 1/10/2005 Posts: 7 Location: ,
|
I have an IPN set up for a recurring subscription to my site. The IPN code I am using is straight from PayPal. If I eliminate the check for payment status the IPN works. But if I check for the status is throws an error. The payments still go through and the emails are sent, but the IPN throws an error. I thought the field "payment_status" was a dynamic field sent from PayPal. I can't see where to add it or where to get it from.
Code below:
<!-- read post from PayPal system and add 'cmd' -->
<cfset str="cmd=_notify-validate">
<cfloop index="TheField" list="#Form.FieldNames#">
<cfset str = str & "#LCase(TheField)#=#URLEncodedFormat(Form[TheField])#">
</cfloop>
<cfif IsDefined("FORM.payment_date")>
<cfset str = str & "&payment_date=#URLEncodedFormat(Form.payment_date)#">
</cfif>
<cfif IsDefined("FORM.subscr_date")>
<cfset str = str & "&subscr_date=#URLEncodedFormat(Form.subscr_date)#">
</cfif>
<!-- post back to PayPal system to validate -->
<cfhttp url="https://www.paypal.com/cgi-bin/webscr?#str#" method="GET" resolveurl="false">
</cfhttp>
<!-- assign posted variables to local variables -->
<cfset receiver_email = FORM.receiver_email>
<cfset item_name = FORM.item_name>
<cfset item_number =FORM.item_number>
<cfset payer_email =FORM.payer_email>
<cfset first_name=FORM.first_name>
<cfset last_name=FORM.last_name>
<!-- check notification validation -->
<cfif #CFHTTP.FileContent# is "VERIFIED">
<!-- check that payment_status=Completed -->
<cfif FORM.payment_status eq "Completed">
<!-- check that receiver_email is your email address -->
<cfif #FORM.RECEIVER_EMAIL# eq "myemailaccount@aol.com">
<!-- process payment -->
<!--- send user an email --->
here an email is sent to the user for login directions
Kim
|
|
|
|
|
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 10/17/2002 Posts: 2,139 Location: ,
|
Hello, With a subscription you will get two IPN post with a sign-up, one will have the payment_status (txn_type = subscr_payment) the other will not (txn_type = subscr_signup). Is your script producing the error for the one that does not? If you are offering a free trial, you will not see the payment_status until the trial is over and the first payment is made. Stephen Ivaskevicius PayPal/eBay, Inc. www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 1/10/2005 Posts: 7 Location: ,
|
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"> Originally posted by PayPalStephen[br]Hello, With a subscription you will get two IPN post with a sign-up, one will have the payment_status (txn_type = subscr_payment) the other will not (txn_type = subscr_signup). Is your script producing the error for the one that does not? If you are offering a free trial, you will not see the payment_status until the trial is over and the first payment is made. Stephen Ivaskevicius PayPal/eBay, Inc. www.paypal.com/pdn<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"> Kim
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 1/10/2005 Posts: 7 Location: ,
|
Sorry Stephen,
There was problem with my login (to paypal board) so it bounced and I didn't think to check the message when correcting my login.
Anyway, I am not checking for the txn_type. Should I be testing for that rather than payment_status?
txn_type is being posted as "subscr_signup" with a new subscripton, but I don't know how it gets posted with a payment as I can't seem to test for that.
Kim
Kim
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 1/10/2005 Posts: 7 Location: ,
|
Stephen,
Is your script producing the error for the one that does not?
No it doesn't produce an error if I don't check for payment_status
Kim
Kim
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 10/17/2002 Posts: 2,139 Location: ,
|
Hello, You can match up a sign up with a payment by looking for the subscr_id = S-12G243244N352460K Stephen Ivaskevicius PayPal/eBay, Inc. www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 1/10/2005 Posts: 7 Location: ,
|
Stephen,
I am not sure If I understand, If the subscr_id is being passed and it is do I need to save it in my database so that it can be checked? Right now I am not saving any of that info. I set up my ipn as follows: <!--- send user an email If it's an NEW subscription---> <cfif IsDefined("variables.payment_type") AND variables.payment_type eq "subscr_signup">
all the rest of the code here for emails about loging and such.
<!--- send user an email If it's an NEW subscription---> <cfif IsDefined("variables.payment_type") AND variables.payment_type eq "subscr_payment">
don't send a new email with login info just send one saying thank you for your continued support.
Should this work?
If I set my subscr_id as a varialbe isn't that different every time?
Kim
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 10/17/2002 Posts: 2,139 Location: ,
|
Hello, I see what you are doing now, what are you going to do if a subscriber terminates their subscription? How are you going to restrict their access? Are you using the Perl Password Management Script, then your CF script after? Are you having the Perl script write the user ID and password PP give them to the .htpassword file? If you are using the Perl Password Management script as is, and using your CF script to send out an email based on sign up v payment, then that should be fine. Stephen Ivaskevicius PayPal/eBay, Inc. www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 1/10/2005 Posts: 7 Location: ,
|
[quote]Originally posted by PayPalStephen [br]Hello,
I see what you are doing now, what are you going to do if a subscriber terminates their subscription? How are you going to restrict their access?
Once this is working - and coded correclty I will add additional code that checks the IPN for subscription cancellation and then set the access that way. THe Member Expiration date will be updated in the db to reflect the cancellation date.
Are you using the Perl Password Management Script, then your CF script after? Are you having the Perl script write the user ID and password PP give them to the .htpassword file?
NO, the enail that they receive directs them to a sign up page and then they create their own account. So I have to code the IPN to search for them and update their record accordingly.
If you are using the Perl Password Management script as is, and using your CF script to send out an email based on sign up v payment, then that should be fine.
If I am not using the Perl Password Management script will what I have outlined work anyway?
Kim
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 10/17/2002 Posts: 2,139 Location: ,
|
Hello, How are you setting the cancellation date? do you have the subsriptions set for a specific time, or are you going to extend the subscription to the next payment due date once you have received a payment? Stephen Ivaskevicius PayPal/eBay, Inc. www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 1/10/2005 Posts: 7 Location: ,
|
I am going to extend it once I receive payment.
Kim
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 10/17/2002 Posts: 2,139 Location: ,
|
Hello, Sounds good so far. Keep us posted on how it goes. Stephen Ivaskevicius PayPal/eBay, Inc. www.paypal.com/pdn
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/17/2005 Posts: 2 Location: ,
|
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"> Originally posted by PayPalStephen[br]Hello, With a subscription you will get two IPN post with a sign-up, one will have the payment_status (txn_type = subscr_payment) the other will not (txn_type = subscr_signup). Is your script producing the error for the one that does not? If you are offering a free trial, you will not see the payment_status until the trial is over and the first payment is made. Stephen Ivaskevicius PayPal/eBay, Inc. www.paypal.com/pdn<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote"> So, are you saying that IPN sends TWO separate POSTS to my IPN script? I was seeing this exact situation but couldn't understand why the signups were occurring correctly (so it seemed). Bob Hendren ListingWare, Inc.
|
|
|
|
Rank: Starting Member
Groups: Registered
Joined: 9/26/2007 Posts: 2 Location: ,
|
I'm having a similar problem as the one described above. The problem is, the script I'm maintaining requires the payment_status parameter be returned from the PayPal IPN in order to successfully store the transaction. What I'm missing is how to indicate that the transaction is a subscription renewal rather than a new signup. Any ideas? Also, I'm testing using two sandbox accounts. Does that make a difference? Thanks.
|
|
|
|
Guest
|