I have a website that use can buy points. I use paypal for payment. My method is this.
- After paypal sucess redirect to a success?point=100
- In success page I will add point to user base on the point variable.
- But like this user can type direct in url or refresh the page. It also add point.
My question is how to prevent user type direct in url or refresh
Server language: PHP, Nodejs
Use the redirect page to notify the user that their payment has been completed, but do not take any action from that page.
Instead, set up a PayPal IPN (Instant Payment Notification) endpoint. PayPal will make a request to this endpoint with specific parameters to securely notify you that a payment has been received; use that to update the user's balance. Note that this notification may arrive either before or after the user views the redirect page, depending on how quickly their browser redirects and how long it takes PayPal to verify the payment and call your endpoint.
Related
Okay so I've setup a website with a basic paid subscription using Paypal. Here's the general flow of things:
1) A person fills up a basic subscription form and click subscribe
2) They get forwarded to Paypal who handles the payment
3) User clicks on "back to website" button
4) Account gets activated and user is forwarded to splash page
The thing is that if the user decides to close the window instead of clicking "Back to website", then his account will remain locked even though he paid (and yes, I'm aware you can skip the "back to website" button, but my client wants to keep it).
So, what I'd like to do is basically implement a form that will query Paypal's REST api to check if the user's receipt number actually exists and if so, complete his subscription. The problem is that most of the users pay through credit card, not Paypal... so all they have is a receipt number.
I've searched through the documentation and I can't seem to find how to query Paypal's REST API using the receipt number. Can anyone point me in the right direction?
I use the IPN service provided by PayPal. With this, I pass a custom field along with the transaction containing the user's account number (you could use receipt number as long as you have it stored). I have an IPN Handler script that receives the verification from PayPal that the transaction completed successfully. This script receives the custom field, which can then be used to locate the user's account and update their subscription status.
I am using Paypal Sandbox account. I want to automatic page redirect my own website after payment successful order authorized.
Your transaction ID for this payment is: 8E7045675M462235P.
We'll send a confirmation email to ramesh#cognizsoft.com.
return to aman#cognizsoft.com
Go to PayPal account overview
Add funds from your bank
it's go to back on store when click on return to aman#cognizsoft.com
With Payments Standard there is no guarantee the user will make it back to your site. You can help things by enabling Auto-Return in your PayPal account profile, but even then the user could close the browser before the redirect happens and they would never make it there.
If you need to automate post-payment-processing tasks you can do that using IPN which will be triggered regardless of whether or not the user makes it back to your site.
If you would rather ensure that you will indeed end up on your site to finalize every checkout then you could switch to the Express Checkout API.
I am hoping someone can help me with the following. I have a Buy Now button. The Buy Now button displays PayPal page correctly in a separate window. Now what I am trying to do I cannot find info on it. I would like PayPal to return to the child dialog with a variable that will indicate success (payment made) or failure (payment cancelled by buyer). Is this possible?
I would like flow to work like this:
1.Member logs in to my site
2.Member clicks on BuyNow
3.PayPal opened in new window
4. Member proceeds/ cancels payment
5. PayPal returns to the web page that invoked it.
5a. If payment made the page is refreshed
5b. If payment not made nothing occurs
Bruno
Like it was suggested, you can use Auto-Return to have buyers who pay with a PayPal automatically returned to your site. Set the Auto-Return URL in your account to be the page you want buyers taken to or define the return_url value.
If you're using buttons created through your PayPal account there is a place to set a cancel and return URL for buyers to be redirected to.
Not every buyer is guaranteed to return to your site though. They'll still be able to close the browser or navigate elsewhere before the redirect completes.
I have site with a members area that I've set up and want to make it so when people register, they need to subscribe to paypal, and only then the user is created in the database.
I don't know much how paypal works. Does anyone have any pointers? How or where do I start?
Basically I need to somehow redirect the visitor to paypal after he presses the "Register" button, make the payment, and then make Paypal return to my site and tell it that the payment was processed, so the user can be created...
Paypal IPN is the Paypal deployment for this kind of requirement.
IPN (Instant Payment Notification) allows you to delegate an endpoint URL that the payment gateway will send postdata to when a payment is completed successfully.
Most of the time this requires utilizing some kind of database to save the registration state while the user is forwarded over to Paypal for the payment process, making use of their SSL encryption and payment logic. When the process is completed, your application is notified with post data containing a unique identitfier generated by your app and passed with the original redirect in order to identify the user's session that has completed payment.
You will want to generate a unique id either using PHP uniqueid() function or by hashing a timestamp. This will be passed along to paypal in your redirect, and paypal will send it along with success/fail flags when the payment is processed. When the user fills out their form and is redirected to Paypal, save a boolean value for IsPaid in your database associated with their ID (i'd recommend using both a primary key as well as this unique transaction id mentioned earlier.) Your IPN script can then listen for the post data, parse it out and change the false IsPaid boolean for that id to true.
There are numerous good tutorials available. I've only used this in MVC deployments, so if you're doing procedural, googling around will help a great deal. Paypal's documentation has the most up to date parameter guides but there are other great, if a bit old, tutorials available independent of them.
http://www.web-development-blog.com/archives/easy-payments-using-paypal-ipn/
http://net.tutsplus.com/tutorials/php/using-paypals-instant-payment-notification-with-php/
Look at the Paypal IPN API, this is used in most paid membership scripts:
https://cms.paypal.com/uk/cgi-bin/?cmd=_render-content&content_ID=developer/library_code
I am using sandbox mode.
I click buy item on my shop, and after i pay with sanndbox account it takes me to "Thank you for your payment - Paypal" but doesn't redirect back to my site! I already have IPN setup!
I dont understand, do I need to contact paypal first ? or is there some section on paypal where you can enter your shopping site URL to get it authorized ?
IPN sends the notification to your server behind the scenes, whether the end user is redirected or not.
PDT, is a different (though somewhat similar) technology offered by PayPal, which sends the data when it redirects. Are you sure you are not receiving IPN notifications?
good comparison of the various methods here: https://www.x.com/message/108223#108223
when using IPN, the transaction information will be posted to your ipn handler url directly from paypal in the background. the ipn url can be specified with the "notify_url" parameter or in your profile.
the customer will be redirected back to your site. the target url can be set in your profile or specified in the transaction using the "return" parameter.