php paypal integration IPN - php

I'm trying to understand for a couple of days how is working the PayPal payment through IPN and all this things but I think my PHP level is not that high.
I am just trying to make a script like this.
Registered user on my website wants to download some content wich is allowed only for VIP User group and I need to add the BUY VIP function so… I set up sandbox, created Buy now button added to my website, created success and cancel page, created http://mysite/ipn.php page to recieve notifications the thing is that I'm not sure what should I write in ipn.php for execute next function after purchase:
UPDATE users set user_group='VIP' where id='$buyerid'

Related

Get Paypal's transaction using the REST API with only a receipt number

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.

Auto FIll Virtual Wallet for Users Wordpress

I am trying to integrate Virtual Wallet system for payments into a WordPress Based E-Commerce Website
I am using this plugin for this -
Link To Plugin
Working Process Of This Plugin
In this plugin From Admin Dashboard Admin can select the user from all users on the website and assigns a particular money in the wallet of the user then user can buy from the website within that money
My Problem and Requirement
But for this I need to fill the amount in user's wallet manually . I want that user transfer me money on paypal and it will be automatically added to his wallet
I was unable to find proper information regarding . Is this possible to be done in wordpress and Is there any plugin available to do so
I would recommend using PayPal IPN for that. Every time a transaction hits your PayPal account their server will POST data about the transaction to a URL on your server. That URL can receive the data and update your system accordingly. It happens in real-time, too.
You can get up and running with IPN very quickly using the PayPal IPN for WordPress plugin. Then you could use the hooks provided by the IPN plugin to do whatever you want to do with the PayPal payment data when it receives it.
For example, the paypal_ipn_for_wordpress_payment_status_completed hook would be triggered any time a successful payment occurs, so you could use that within your own plugin or your theme's functions.php file to automatically update the wallet balance of the user based on the data provided in the IPN.

Paypal subscription integration php

I have spent all day on something that should only take a couple of minutes.
I need to add a subscription service onto a website, the user needs to enter their full name and email address as part of the subscription, paypal should then take the payment and redirect back to the site while passing the full name and email so accounts can be created.
I am at a loss here as their documentation is all over the place and conflicts with itself. How do I create a subscription button with the additional fields and get it all working.
And how the hell do I test it? I have attempted creating one with the subscription button on the paypal site but when the checkout is completed it doesn't go back to the site to create the fields unless you press the button and when you do there is nothing no post data no get data nothing!
You could try using PHP-Payment it allows you to redirect to a page upon success. https://github.com/phpfour/php-payment/tree/master/src/php/Rbs

Committing payment on sellers website

I am working on a project which will be able to accept paypal payments. The sequence I am using is as follows:
My current development sites' payment steps:
The user goes to my site,
Chooses to pay for something,
Is redirected to paypal,
The payment is completed on paypal,
Then the user gets redirected back to my sites success url.
This works fine, as I use an IPN listener to update my database in the background when paypal decides to confirm the committed payment and let the user know accordingly.
However, a few days ago, I was doing some online shopping of my own, and paid using paypal. I noticed that when I paid, I was redirected to paypal, where I logged in and saw the paypal invoice. I clicked confirm, and I was redirected back to the sellers website, where I so a summary and was told to commit the purchase!!!
So basically, the sequence was something like this:
My shopping experience from a different sellers site:
I wanted to pay for the items,
I was redirected to paypal,
I was the invoice and confirmed the payment,
I was redirected to the sellers site,
I was was shown a confirmation of the order and was asked to commit the payment,
I committed the payment and was told that the order has been completed.
The difference, my site commits the purchase on the paypal website and I listen for a reponse from paypal using their IPN system, but this second site seems to commit the payment on the sellers actual website.
I thought, wow, that felt so much more reassuring from a user experience point of view.
How is that done?
Sounds like you're currently using Payments Standard and you want Express Checkout.
Express Checkout is very similar to Standard except that it's API based and the user gets returned to your site prior to finalizing the payment.
It consists of 3 API calls...
1) SetExpressCheckout - gets a token back from PayPal that you append to the end of a redirect URL that sends the person over to PayPal to login and review the payment.
2) GetExpressCheckoutDetails - This allows you to pull the payer details (name, phone, shipping address, etc.) back into your app from PayPal. This is an optional step.
3) DoExpressCheckoutPayament - this finalizes the payment. No money is moved until this API call happens, and it doesn't happen, of course, until the user is already back at your site and within your own app flow again.
You can still use IPN the way you are, but you could also things directly within the flow as well since you get instant responses back from the API, and you can setup your own review however you want to.

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.

Categories