PayPal Rest API Invoice WebHook - php

I am having a very hard time figuring out whether it is even possible, but here is the task I want to do. Whenever an invoice that is created by my merchant account, I want PayPal to send a webhook to my webserver notifying that the invoice has been paid for. I can find full documentation on how to do that for simple payments, but there is literally nothing documented on how to do that with an invoice.

Instant Payment Notification (IPN) can be used for this.
When a PayPal invoice is paid the PayPal server will POST transaction data including the PayPal invoice ID and any custom invoice ID you supply with the original invoice. That way you can automate procedures based on the transaction data.
IPN works with all payments, refunds, disputes, etc. on your account. It's a very useful tool.

Related

Marketplace using Paypal

Hi we are creating a mobile app for marketplace where we are hoping to get eBay model implemented. Where buyer will pay the seller and we will take our cut from the seller. We actually don't want to get payment ourself for the sale and handle the disputes for order shipping or chargebacks.
When a sale is done on our app, the buyer should send the payment to the sellers paypal and then Paypal will handle all the other stuff regarding that like disputes or chargebacks.
I want seller to link his paypal account to our app and we will take permissions for future payments and maintain a record where we can calculate his fee regarding sales made on our platform. Paypal Mobile SDK support this feature.
But my question here is how can we automate the original purchase process? One option is when a sale is done, we will send invoice from seller side to the buyer (possible using Paypal REST API) and open invoice pay link on the buyer side. Once the buyer pay the invoice and transfer the funds to the seller we will know that sale is approved successfully because as a Paypal facilitator we have access to that invoice (we actually sent that invoice to the buyer as we have permissions of invoicing of seller account).
But what if we don't want invoicing system? Can we implement anything where buyer will send the funds to the seller without generating an invoice from our app. Like when a sale initiated, we will present buyer a page where he will pay directly to the seller (without us involved) and we will track that transaction and make outstanding cut on that sale?
My Research so far
Payapl mobile SDK for iOS don't allow us to take permissions for invoicing, we can take single, future or profile sharing permissions in app
Paypal Rest API allow us to take permissions for invoicing but not for future payments (that is necessary to take our cut from the seller's account)
If we use Paypal Mobile SDK, we can take funds in our account but not directly to our sellers account
Adaptive payments is an option where can take funds from buyers and after deducting our cut send the rest to the buyer but in that case we will be primary recipient and seller will be secondary, being a primary recipient we are responsible for shipping the product which at this stage we don't want. Want want to be seller as primary recipient
Any help regarding our situation would be greatly appreciated. We just want to automate the system somehow with the APIs and SDKs without being the primary recipient. Please give us suggestion to make this a reality. Thanks
Using any other payment gateway like Stripe or Braintree will not help here because in that case we will be taking money as registered merchants. We would really like to work with Paypal for handling all order related stuff
The Express Checkout API supports Parallel Payments, in which case you specify the SELLERPAYPALACCOUNTID in the request. This is where the money for that particular payment would be sent.
You can use this functionality even with a single payment on the order, though. So you can just setup a single payment and include that SELLERPAYPALACCOUNTID parameter, and the money will go directly to that account.
When doing this you can use your own API credentials and no permissions or anything are required from the 3rd party account to send the funds directly to them.
This PayPal PHP SDK will make the Express Checkout API calls very quick and easy for you, so you could just setup some simple PHP services to hit from your mobile app(s).

paypal Preapproval API

we are trying to add a pre-approval paypal process to our website before a user can bid on any of our items for sale. We currently accomplished this using Authorize.net but want to now integrate paypal as well.
I have been doing some research and am trying to find out if paypal even offers such a solution. The main reason for adding this verification is of course to make sure an individual actually has the money to purchase the item, some items can range from $100-$100,000. Does paypal offer a pre approval process for those types of transactions?
https://developer.paypal.com/docs/classic/api/adaptive-payments/Preapproval_API_Operation/
The Preapproval API gives your application permissions to trigger payments on a user's behalf without further approval (no login required to submit payments with a preapproval ID). There is no guarantee funds will be available when you submit this payment. A transaction with a preapproval ID could simply fail like any other transaction.
It sounds like what you're looking is the Authorization and Capture process, which is probably what you're doing with Auth.net, too.
With PayPal you can run Authorizations from credit cards directly (exactly like you do with Auth.net) and you can also do it with Express Checkout, which would be PayPal login payments.

Paypal API for checking status of recurring (subscription) payment

Does anyone know is there any way to check status of recurring (subscription) payment at PayPal.
I just want to submit transaction ID and to see is payment canceled (suspended) or it is still active.
If you're using the Recurring Payments API you can use GetRecurringPaymentsProfileDetails to obtain details including the current status of the profile.
If you're working with Standard Subscriptions, though, then there is no API to obtain the details, unfortunately.
In either case, I'd recommend looking into Instant Payment Notification (IPN). Using it you could automate the process of sending email notifications, updating your own database, etc. when new profiles are created, suspended, re-activated, etc.

Paypal shipping and monthly reoccurring billing

I am going to set up a website that will use paypals reoccuring billing. The question I have is if I have over 3000 customers, for example, how do I make it more simple for me to print out their addresses where to ship the product instead of doing it one by one?
I am not going to use Paypal api for this but instead direct link to paypal as such described in this video
http://www.youtube.com/watch?v=jHC9BoRDEOY&feature=youtube_gdata_player
If I was to set something up like this, I would uses PayPal's IPN feature to record all of the transactions, transaction details and profile details for these recurring profiles in my database. Then I would create my own system for running reports or a query against my Database, and then display the information in what ever format I would want.
Instant Payment Notification (IPN) is a message service that notifies you of events related to PayPal transactions. You can use it to automate back-office and administrative functions, such as fulfilling orders, tracking customers, and providing status and other information related to a transaction.
There is more on IPN here.

How do I get data back from Paypal so I can alter my MySQL database accordingly?

I'm just starting out with Paypal, so this is a newbie question.
I've been going through the instructions for setting up Paypal subscription service, but I think I'm looking at the wrong thing.
What I want to acheive is to get back some kind of response from Paypal so that I can update the database on my web site to mark a registered user as having paid. Basically I have a flag in the database that says if the user is subscribed or not. I want to ensure that the user is marked as paid so long as their Paypal subscription is maintained.
While the instructions linked above do say how to set up a button to receive a payment, there's nothing there about getting any data back from Paypal.
I know there are terms like IPN and sandbox that are related to what I'm trying to do, but I can't find clear instructions for how to get started on this process. I'm just circling around and not getting anywhere.
Where do I start on setting this up? Where is there a clear beginner's tutorial?
Also, I'm using PHP/Javascript/MySQL on my website.
PayPal's IPN service is what you want to use. I've used it myself to do just what you're looking to do.
Instant Payment Notification (IPN) is PayPal's message service that
sends a notification when a transaction is affected. Once IPN is
integrated, sellers can automate their back office so they don’t have
to wait for payments to come in to trigger order fulfillment. IPN can
send notifications for these transactions:
Instant payments, including Express Checkout and direct credit card payments
eCheck payments and pending, completed, or denied status payments
Pending payments
Recurring payments and subscriptions
Authorizations
Disputes, chargebacks, reversals, and refunds
You can also view notifications on PayPal’s IPN History page and
resend them if you need to. As PayPal’s interface for handling
purchase confirmation and server-to-server communications, IPN can
also be used to manage and customize a variety of APIs and
communications, including:
Customize your website's response to customer purchases in seconds
Track customers via IPN "pass-through" variables
Notify sellers who deal mostly in software downloads and other digital, online goods
Track affiliate sales and commissions
Store transaction information in your own database
For more about IPN:
Technical Overview (link to new html version of docs on developer central)
Instant Payment Notification Guide (PDF)
Code Samples
I'm not sure if its the same thing, but I just setup my friends website with Express Checkout, and I wanted to add all paid orders to an orders table in my database.
After I call SetExpressCheckout, and the user is returned to my site after going through the purchase flow on Paypal's side,
I used the information from GetExpressCheckoutDetails.
Then, if DoExpressCheckoutPayment
is successful (also called from the "callback" page) I then do the appropriate work in my database as far as logging the order details. For you in this case, it could be updating a record for the user in the database.
Hope that helps a little.

Categories