Perform a PayPal payment automatically using PHP - php

How can I automate a PayPal payment using PHP?
I have the email of my PayPal business account, the PayPal email of the receiver and the amount to transfer.
Is there a way to make the money transfer without my interaction? (the payment originates from my account)
Of course I'll run the PHP script manually

I'm going to answer my own question:
It's possible to make a PayPal payment using PHP only, it's called Implicit approval payments
Implicit approval payments are payments where the sender and the API caller are using the same account. Because PayPal draws the funds for the payment from your own account, there is no approval necessary, and as such there is no visible flow for implicit approval payments.
I tried using the Pay API and the payment is made within the PHP script, no need for a web flow or any other manual approvement.
The Pay API requires an extra field, called senderEmail, set this field to the PayPal email user account

Related

PayPal API Pay Email Address Directly?

One of the features on my site allows users to pay via PayPal for items from other users. I'm using the standard REST API since I had already made the code for another project a while ago, which works fine.
https://developer.paypal.com/docs/api/#create-a-payment
Currently, the page sends a 'v1/payments/payment' request which I execute to receive the money in to my PayPal account which created the access token. Is there a way I can directly get the user to pay another PayPal email address?
If not, I guess the only way is to do another request to pay the owner of the content from my PayPal once I receive the money - although it means PayPal get to charge a fee twice.
Thanks.

Send money to any PayPal account and receive payment notification

We are developing a website where people can use our tools to fundraise for their organization or cause. I was wondering if with paypal IPN I can send money directly to the person's PayPal account doing the fundraising.
For example. User John Doe signs up on our website Website.com. As part of the signup process John Doe enters his PayPal email address he accepts payments with.
He now has the page Website.com/JohnDoe to accept payments/donations from.
Using IPN & PayPal payments pro can I have the payment sent to his account directly and still have our IPN address (Example: Website.com/ipn) receive the payment notification and payment information?
Also does Paypal Payments pro work inside of IFrames. Let's say John Doe embeds his Website.com/JohnDoe into his own website JohnDoe.com. Or the other option is in a Facebook page custom tab.
If PayPal payments pro, or standard will not work for this will Adaptive Payments work? In adaptive payments does each person I'm sending money to have to signup for it?
Thank you!
Yes, collecting payments to various email addresses/accounts is very easy, and you can have a single IPN service to verify these transactions. See the docs at:
https://developer.paypal.com/webapps/developer/docs/classic/ipn/integration-guide/IPNIntro/
.... for how to set the IPN address per-transaction (overriding any setting your merchants may be using account-wide for other transactions.
iFrames are a problem; PayPal has historically not allowed this for security reasons; they didn't want the potential for snooping js in other frames on the page. However as the web frameworks for this have matured PayPal has opened up some in-page checkout options (e.g. lightbox checkouts). You should check the latest docs (or ask someone # PayPal) which, if any, integration models/checkout experiences currently support running inside iFrames.
Adaptive payments is not very likely to be the product you want; you will want either an PayPal Pro/Express Checkout solution or something packaged in the newest Braintree SDKs.
And finally: yes, with a few exceptions that probably don't apply to your use case, PayPal pays out only to PayPal accounts. Thus every business or person would need to sign up for a PayPal account in which to receive PayPal payments. (Note that in some cases users can sign up after the payments arrive... payments to an unsubscribed email address will be held and that email address notified of the pending payment and asked to sign up & complete the transaction(s).)
Using IPN, it's possible to set the recipient's address and the notification_url dynamically (see https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSetup/). So using this method it ought to be possible for a payment to 'John Doe' to be made at your site, and for the payment to be sent to 'John Doe', and for the IPN notification from Paypal to post to a listener script at a URL at your site.

How to transfer money from one PayPal account to another PayPal account?

What I am trying to do is I have a one cron file, which check that the user requested payment if yes then this file transfer payment from admin PayPal account to user's PayPal account (of course only if admin account have money :)).
I check Adaptive Payments, but what I am trying to achieve is transfer money from admin's PayPal account to user's PayPal account. How to achieve this?
It is cron job. So there is no need of the approval of admin to transfer money. It is well handled in the project. Means directly transfer money from one account to another?
Thanks in advance.
If you would like to transfer money between two paypal accounts without approval, then you will need to use Implicit Approval in Adaptive Payments.
Implicit approval payments, in which your application is both the sender of a payment and the caller of the Adaptive Payments Pay API. In this case, PayPal makes the payment from your own account, which eliminates the need for approval.Try here

PHP: PayPal Integration

im building a site where 2 user groups exist: sellers and buyers. The buyers buy stuff and should pay to the sellers via PayPal.
So, its not a kind of a web shop where users are paying directly to me ( as a website owner/online shop), BUT TO THE OTHER USERS (sellers). So i need to forward a PayPal transaction from one user on my site (buyer) to the other one (seller).
I read some PayPal API Descriptions, but its assumed there that i want to process the PayPal Payments to my PayPal account, what's not my case.
An idea would be that sellers pay to me, and i then pay to buyers, but that's not what i want to do.
So , what I want is: the buyer should process the PayPal payment directly to the seller's PayPal account, and i should then receive the payment confirmation and inform the seller about it.
Does anyone have an idea, expirience or suggestion with this stuff? Thanks in advance!
You have a lot of options for how you can handle that.
One, you could use the Express Checkout API to build the checkout system, and you'd use the Permissions API (optional) so that users can easily grant your application permissions to make API calls on their behalf. Note that users could also do this manually through their PayPal profile until you get the Permissions part integrated.
To get your payments, you could have your users create a preapproval profile using the Preapproval API. This will allow you to submit payments on their behalf automatically at any time. As such, you could use the preapproval key within Pay calls directly in the checkout flow or within IPN (which is what I would recommend) to submit payments to yourself from the user's account.
Another option is to use a parallel payment within Express Checkout. This would handle splitting the payment for you automatically between the seller and yourself, but the buyer would see that split during checkout.
Another option would be to use the Pay API for the checkout which would allow you to create a chained payment. This is the same as a parallel payment except that it hides the split from the buyer, and you could actually delay the payment to secondary receivers if you need to for any reason.
Hope that helps.
if you have a buy now button or similar, use the sellers' email address as below
<input type="hidden" name="business" value="sellers#email.com">
and it will pay the user with that email address. If that's not their paypal address, it will prompt them to either sign up for paypal to receive or add it to a current account.
Then use PHP mail() or your CMS/Admin system to notify you when the successful payment page has been loaded after a referral back from Paypal.

Verify PayPal donation between two 3rd parties

I'm working on a project where users will be allowed to send donations among each other.
I'd like to integrate it with Paypal instead of reinventing the wheel and building my own donation system, but due to the nature of the system, I will need to verify that a donation of X dollars was sent from person A to person B.
Is this possible with Paypal, or am I out of luck?
You will need to look at PayPal Instant Payment Notifications (IPN).
Within the call to PayPal to handle the donation/payment, you can specify the URL for a "Listener", which is a script which will be contacted by PayPal with details on the payment, and can then authenticate that payment against PayPal to ensure that it is accurate/confirmed/not faked.
Within the data passed back to the Listener is the email addresses of the Payer and the Payee, along with the amount paid, fees charged, etc.
If you are acting as an intermediary to the two parties, and so long as the payment are made through the form/site you control, then you should be able to use the IPN to get details of those payments and then use that data however you wish to.

Categories