I'm trying to find a way of checking if a customer has clicked the final submit button to perform a transaction in PHP.
I need to send a second e-mail to different people when the customer makes a transaction, but as far as I can tell, there's no function or property to retrieve some sort of confirmation value.
I don't need to know if the payment went through or not, just if they clicked the last submit button, but the checkout page is hosted on Microsoft's servers.
All of the payment APIs will return a status immediately. You just have to look for it and handle it in your code. How this is done will vary by API.
You can use Silent Post* which is similar to Paypal's IPN. Basically a script on your server will be notified of all payments.
Use the Transaction Details API and look for the transaction in your unsettled batches.
* I am the author of that article
Related
I'm new here!
I'm trying to let my customers get recuring billing membership on my website based on this tutorial.
The button work, evverything is fine, except one thing. I need to validate that paypal really went successfull, to prevent anyone to go directly on the success page and get free membership. I noticed that it return a token=VALUE data to the success / cancel redirect.
I cannot find any $_POST or any others $_GET than that and I wonder, nor anything that could solve this in the Paypal doc (which changed a lot since last time I used it).
How can I check if the membership really went trought paypal using this token=1RXXXXXXXXH484112Y.
The return of such an integration may never happen. Reliable notification that a subscription has been created can only be done with a separate, server-side integration.
For the old HTML subscription button integration in the tutorial you reference, you can implement the old Instant Payment Notification (IPN) service.
The current solution would be to use a smart subscribe button with server side API calls to create the subscription and activate it -- with this, your server immediately knows it has been activated (because it did so itself and received the response). You can find some details on that solution here: https://stackoverflow.com/a/63908112/2069605
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 working on a subscription service for a test website of mine. I have the infrastructure in place so that when a user registers, they need to subscribe before going to their profile. How can I tell if a user has finished subscribing? I have a flag in my database that will turn to true after they subscribe, but I can't seem to figure out that last handshake.
I tried to set it up when making the button to go to "http://www.example.com/profile.php?completed=true" so that I can simply look for that completed variable, but paypal seems to ignore that. Any thoughts on how to do that?
Upon looking at a similar post on here, I could redirect to a success.php, where it can update the database flag. This is a work around, but is this the only solution? Or is there one similar to what I originally wanted to do? Thanks for your input everyone.
You should make use of Instant Payment Notification
Instant Payment Notification (IPN) is a message service that automatically notifies merchants of events related to PayPal transactions. Merchants can use it to automate back-office and administrative functions, like automatically fulfilling orders and providing customers with order status.
I'm doing a project involving Paypal, more specifically with the NVP API in PHP. But I just can't seem to figure what to use the IPN feature for.
I mean, when the user has been redirected to Paypal to confirm the purchase, he is redirected back to my website's "Paypal-succes-page", when the transaction is complete. And just to be sure that he actually payed i could use the "PaymentDetails" operation.
Now where does IPN fit in this process? and what is the benefit of it?
Thanks
The integrate with PayPal's services you will notice there are three main channels (and IMO it's important to know this so you can decide the benefits for your application):
IPN: Instant Payment Notification
PDT: Payment Data Transfer
PayPal's API
To use PayPal's IPN you need to add a 'listener' script (example) and add the address to your PayPal account. Whenever an event occurs PayPal will send a message directly to your server via your listener and you then update your accounts appropriately. This is especially useful for running subscription services as events will occur in the background without user intervention and you can capture successful/failed recurring payments etc.
PayPal's PDT is a system for accepting data when a user is redirected back to your site from PayPal. For example, a user clicks 'Buy', they are directed to PayPal, enter information etc. Then, once the payment has been taken, they are redirected back to your site. PayPal can pass details about the transaction including whether it was successful or not so you can display the appropriate success/failed page from your site.
PayPal's API allows you to integrate more deeply with PayPal's services, and you would use this if you were managing payments directly from your site.
These services aren't mutually exclusive, so you can use any combination with your application.
I hope this helps
The IPN feature is a very useful feature which you should use to update your database in my opinion. Sure the user is redirected to your success-page after the purchase where you can validate the payment details.
But what if he closes (by accident or not) the browser before reaching your success page? You will never know the result of the transaction and you will never update your database or process his order accordingly.
When using the IPN you can be sure that the transaction result will always reach you because PayPal will keep on making an offline request to your IPN page until it has reached your servers.
Instant Payment Notification
The typical usage of the IPN is to validate the purchase and to let your script or management system know that the transaction is complete so your system can update any records you may have for your service.
But the most important part is that the transaction is validated.
IPN send all data about transaction to your server - price, items, contacts ... so you can check, if someone don't pay you only 1$ instead of 100$ and confirm your order. It prevets thiefs, cheaters, ... USE IT! ;)
I've implemented a paypal transaction before but this one has a twist that I'm not quite sure what's the best way to handle it.
The basic idea is I want to create an account for the user when he provides some details and makes a payment via PayPal. Until BOTH the user details are filled out correctly AND the payment is made correctly, I shouldn't create an account for the user.
The setup I've done before was simply a paypal button that the user clicks, makes a payment, and gets forwarded back to just a generic page "your order will be processed and shipped" so there was no pre-order form involved.
This one is different though because
before PayPal, I need to collect initial user data
after PayPal, I need to create the new user account and use in it the user data collected from the pre-paypal form
I'm sure there's a logical way to implement this, but I'm not quite sure what's the flow I should follow to do it.
I use the Zend framework by the way, which shouldn't matter but just in case Zend has an easier way to help me with what I'm trying to do.
I do the following (though I do this in ASP.NET):
User fills out form
Info is saved in Order table in db with a unique invoice number
Invoice number is passed to PayPal, along with the IPN Notify URL, when you do the redirect
User is sent to Paypal to pay and then comes back to a generic Success page
Behind the scenes, Paypal makes a call to the IPN Notify url once processing is complete. This page receives your invoice number which PP returns with its call, and then does the account creation processing for that order after retrieving the details from the db. [This is a page with no UI, since only PP is hitting it.]
An email is sent from that process which notifies the customer that their account has been created and gives them the details.
This is a simplified version of the process, but hits the highlights. You can check out PayPal's page about IPN, and do a search on google for IPN integration with PHP.