简体   繁体   中英

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:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM