I have setup a PayPal IPN for our website and is working correctly however if someone uses a different email address to their PayPal account email address I am unable to match them to the IPN message and mark them as paid.
How have other people got around this issue? I don't particularly want to use time just in case two people are registering at the same time.
--- Resolution: <input type="hidden" name="custom" value="<?php echo $rand ?>" /> inside the form with the custom button. The POST picked this up and sent through to the IPN message.
Your best bet would be to either (a) add an invoice ID to the transaction, or (b) add a custom value to the transaction. Almost all of the PayPal payments products allow for this. (For example, in PayPal Payments Standard, the parameter name is invnum for the invoice ID, or custom for the custom value. In Express Checkout, it's PAYMENTREQUEST_0_INVNUM and PAYMENTREQUEST_0_CUSTOM.) The data is included in the IPN postback, so you can use it to match up with the payment in your records. The difference between the two is that PayPal will block transactions that use the same invoice ID as a previous transaction (as long as the merchant hasn't turned the setting off for it), whereas the custom value just gets passed through without being checked.
Related
I have a donation form with options to have a user pay with credit card (auth.net) or with PayPal. I also have an option to have the user set up recurring donations.
I need to condition checks to send the payment to Auth.net when the credit card option is selected as well as when the credit card and recurring donation is checked (same for paypal).
Unfortunately, payment processing conditionals only offer one option...so I'm a bit stuck at this point. Any extensions or suggestions to get this to work? Client has requested that they accept both Auth.net and Paypal (even though yes, paypal does accept credit cards...they still want this).
The key here is to have all of your conditions in one field (I normally use a radio button field) so that you can then use this field in your conditional logic for both your credit card field and your payment processing feeds.
Check out this example using PayPal and Stripe — it works the same for any payment processor (there's also an example form there that you can import into your site to see how it works directly in the form editor).
I ran into the same issue and thought it was a showstopper but this is what I did:
I needed 4 feeds:
Pay via CCPay via CC RecurringPay via PayPalPay via PayPal Recurring
BUT, I had a checkbox handling recurring (Yes), and radio buttons handling the payment type (CC/PayPal) and did NOT want to unify them.
So, I assigned my recurring a value of "1"I assigned my "Pay with CC" a value of "3" and PayPal at "0"
I created a new Number field and labeled it "PayPal Conditional Logic"I then enabled calculation to add "recurring+payment type".
So, now the feeds:
Send to PayPal if "PayPal Conditional Logic" is 0
Send to PayPal as Subscription if "PayPal Conditional Logic" is 1
Pay with CC if "PayPal Conditional Logic" is 3
Pay with CC as Subscription if "PayPal Conditional Logic" is 4
worked for me :)
I want to setup paypal sandbox to test sales. what i have done so far is setup seller and buyer account, created form for sanbox, enabled IPN.
What i dont understand is how i know which sale is being processed.
The IPN only send:
buyers desription
item purchased
paid amount.
I want to know, how can i send a cart id to sandbox, and receive it back with IPN, so i can process it.
i didn't found anyinformation about this on google and paypal documents.
Please help me on this, it took me many days and i haven't figured how to verify sales.
There's a variable you can pass in your HTML form called custom (variable reference). This field will be passed back to you in your IPN (IPN Reference). You can populate this with up to 255 characters and the customer won't see any of it.
Use invoice (which you should have to pass to paypal) or pass your own id through custom
edit: note that invoice must be unique, you cannot resuse an invoice to paypal otherwise you will get an error.
I have seen and know how to use IPN for paypal payments but I am having a small issue. With IPN you need to enter an IPN address to your PayPal File so it knows you got sent the payment (Instant Activation of Product). If I have multiple sites, I can't do this as It only allows one.
I have seen the WHMCS system manage to do this using Website Payments Standard (Does not require any IPN Settings) where the user's invoice is marked as paid after the payment is sent. The user does not need to be redirected to another page and as a seller, the only info you need to put in is your paypal email for things to start working.
Does anyone know how this works and where to learn this?
Thank you for your help
You can specify a per-transaction IPN URL by passing in notify_url along with the other data in the form.
E.g. <input type="hidden" name="notify_url" value="http://....">
This will override whatever you have set up within your PayPal Profile.
I have been using paypal in the past for selling stuff through my website ( e.g. memberships ) but I always had to verify through paypal whether the user really bought the membership (for example) before I could assign it to his/her account. Now I was wondering if there's a way that I can put a paypal purchase button onto my webpage to ( for example ) purchase a membership and then once the user paid, he'll automaticly be assigned the membership on my website ( e.g. there's a page purchase_result.php which assigns the membership, but ONLY if the user really bought it through paypal ). How can I make sure the user actually bought the item through paypal on the return page on my website?
Thanks in advance,
Skyfe.
btw, I hope my question can be understood
You would PayPal Instant Payment Notifications to receive a server-to-server notification from PayPal which you can subsequently verify and use to update your database.
IPN works as follows:
You create the PayPal and incude a "notify_url". The value for this parameter will be the full URL to a script on your server, called the 'IPN script' or 'IPN handler'.
You can specify an IPN handler as follows for Website Payments Standard
<input type="hidden" name="notify_url" value="http://blah.com/ipn.php
For Express Checkout or Website Payments Pro, simply include the following in your SetExpressCheckout/DoExpressCheckoutPayment or DoDirectPayment API call respectively.
NOTIFYURL=http://blah.com/ipn.php
A buyer completes a transaction via PayPal
Once the buyer completes the transaction, he/she may close the browser, or return to your website
Once the transaction is accepted and processed by PayPal, PayPal will send out a notification to http://blah.com/ipn.php
You need to take all POST data that was sent to this script, and POST it back to https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate
If the data you send back matches the data PayPal sent you, a 'VERIFIED' response is returned.
If the response is VERIFIED, it's at this point that you would look up the matching transaction/buyer on your end, and update your database appropriately.
Some sample code and documentation for PayPal IPN is available at https://www.paypal.com/ipn/
In addition, some tips on making a secure IPN script are available at https://www.x.com/developers/community/blogs/ppmtsrobertg/securing-your-instant-payment-notification-ipn-script
Note: If you want to include any custom data along with the transaction which you can read out later, use 'custom'.
<input type="hidden" name="custom" value="xxxxx">
This will also be returned in the IPN POST data sent from PayPal.
I have a paypal button on my site in a form. The form has an additional input called ID, where the user must enter a specific value.
After the sale is complete, Paypal returns the user to domain.com/credits?done
How can i receive the original ID value entered by the user in /credits?done ? need it to modify his database record automatically.
Thanks.
You can create a simple cart system that will have a unique invoice to distinguish each transaction. Pass this invoice as parameter when sending payment data to paypal. Any other data can be just stored in your database, no need to sent it to paypal, since you can determine each transaction with the invoice as the unique identifier.
You also need to create a ipn handler page to receive data from paypal when user making the payment there, so you can update the payment status in your database. With this way, the user do not have to click return to your site link after making the payment, but you can still update the related data.
To make integration easier, you can consider using Micah Carrick's Paypal IPN Class. Basically it's the same code with the one provided by paypal, but it's wrapped into a class, so you can just use it in your page.
If the ID you refer to is a unique reference that you use, then pass this back and forth between Paypal and your site using the item_number element.
Set the ID in the HTML form you show to your customer and note you can also specify 3 URLs:
<input type="hidden" name="item_name" value="Box of stuff"></input>
<input type="hidden" name="item_number" value="12345"></input>
<input type="hidden" name="return" value="http://www.blah.com/paypal_thanks.asp"></input>
<input type="hidden" name="notify_url" value="http://www.blah.com/paypal_callback.asp"></input>
<input type="hidden" name="cancel_return" value="http://www.blah.com/paypal_cancel.asp"></input>
Where I have used "paypal_callback.asp" above, this overrides the IPN link which you can set up when you log into Paypal and edit your settings. So this value is optional.
The scrpt paypal_callback.asp (assuming written in ASP) can then just say:
iAdvertId = Request.Form("item_number")
Note that this page is not the one shown to the user! It is hit by Paypals servers behind the scenes. The annoying thing is that paypal_callback.asp will not get called by Paypal immediately. It might be 3 days later...or they might hit it a month later to retract a payment.
The customer will get redirected to either paypal_thanks.asp or paypal_cancel.asp in my example. These pages will not be passed a form or querystring, so the only way to get hold of the number you places in item_number is to also store it in a cookie BEFORE the user submits the form to purchase.
When you get the email from Paypal, the item_number will be mentioned in the subject line, and within the mail body too (on the end of the Description line).
It is also possible to set additional information in custom fields. The Paypal documentation details how to do this, and you can test it with their IPN simulator in the sandbox.
See the documentation for PayPal's Instant Payment Notification and the IPN PHP code sample on the PayPal Integration Center site.