Passing a custom variable from a PayPal button after a user subscribes - php

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.

Related

Simple Paypal Button Subscription Membership

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

Way to check if customer has made a payment?

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

How to intergrate paypal into an application?

Im planning to allow people to create premium accounts on a site. There is a simple registration form, at the end of which I want to direct people to paypal where they will make a payment, and then be sent back to my site with their newly created account now activated (if transaction went thru).
I dont want a fully hosted solution ("Website Payments Pro"), but something where you leave the site, and then come back to it after payment.
Everything you need to get started
View sample code
View all tech docs
Download SDKs
API Reference
Using the PayPal API, you'll be able to send users to PayPal to handle payments. Once the transaction has been completed it will then send a response to a script on your site, which you can then act on accordingly. For example, update a particular user's status as 'Paid' or 'Unpaid' in your members database table.
You want to look at PayPal IPN. With that, you can send these pages URLs as hidden fields and PayPal will then return the user to the page you submitted for success, failed, IPN handler etc.
Yes that's possible, look into the "Buy now"-method on PayPal, they have an off-site payment possibility and they have on-site payment. It's up to you how much you want to spend on both time and percentage on each sale.

how can i use Paypal for premium section of my site and deal with premium vs normal users?

I want to achieve something like this
http://depositfiles.com/en/gold/payment.php
I have normal users signed up. I want them to upgrade to premium user. Once a person pays, how do I know which user he was signed in ? How do i force the user to login first before being able to click the paypal button and make payment ? Otherwise, I would receive money, but wouldn't know which user to mark as "PAID" in my database.
when you click on the paypal button, it redirects you to the paypal page where you can login and pay.
I also want to accept Visa and Mastercards, is it doable through paypal using the same method ?
Paypal's information can be found here:
Part 1
You can create a subscribe button for each type of subscription you want and use the HTML variables in Part 2 to enable you to know what type of product and what user is included in the invoice.
This needs a lot more details than you currently provide. What language have you written your website in? Static HTML? Ruby? PHP? How does PayPal's payment system work?
normally the way it will work is that your site will pass information to paypal (http://paypal.sourceforge.net/ is one toolkit that seems to be made for php, thought I've never used it so I can't really promise its not abandonware).
once the paypal transaction is completed successfully, control is passed back to your site. you can then set the user's flag in your database as a premium user.
as far as I can tell, you tell paypal to handle payments for you, and the user picks a funding source in paypal. if you want to have visa/mastercard separately handled from paypal you'll need another payment gateway to handle it, like mirapay or something else.

How can I automatically alert my php/mysql web app that a PayPal transaction has gone through?

I have a client who will be selling access to an online service on their website. They would like to integrate a PayPal Buy Now button into the site... no problems there. However, they want their customers to have instant access to the online service that they are selling as soon as the payment is processed. That seems reasonable to me... the problem is that I can't seem to find a way to automate that. So my question is really this:
How can I automatically alert my php/mysql web app that a PayPal transaction has gone through?
All I would really need is like a callback process that triggers a php script to updates the customer's record in the database... right? Seems simple to me. But I can't seem to find a way to do it! Anyway, if you've accomplished anything similar with PayPal, I'd be grateful for your advice!
See Instant Payment Notification.
I think you want to send in a variable to paypal (item_number) that they will return to a page that you specify in your post to them (return - success and cancel_return - cancel). They will send you back whether the transaction was successful or not and then with your variable you can make a call to your db to update the record in your database based upon the result of the transaction. In the return page you can also send some sort of notification to the client of the success or failure of the payment process and clean up after a canceled transaction.
PayPal maintains an extensive knowledge base on how to integrate their services with your web app. In think that is a good first starting point. See www.x.com

Categories