简体   繁体   中英

PayPal - after payment with php

I've set up a payment button on my website and users can choose what they want and make payments fine. What I am struggling with is working out how to give them what they paid for. So for example they paid $10 for a book, I want the book to be awarded to their account once the payment has gone through.

What I've found is that you need to use an IPN but for that you need an API, whatever these are. Is this the only way to do it in php? Looks very complicated for such a simple task and I'd rather get them to send payments to me and I will manually add what they paid for.

EDIT

Here's what I'm following: https://developer.paypal.com/webapps/developer/docs/classic/products/instant-payment-notification/

This is how I set up my paypal checkouts in my websites:

<form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr" 
        method="post">
        <input type="hidden" name="cmd" value="_xclick">
        <input type="hidden" name="business" value="YOUR SANDBOX SELLER EMAIL">
        <input type="hidden" name="currency_code" value="USD">
        <input type="hidden" name="item_name" value="Digital Download">
        <input type="hidden" name="amount" value="9.99">
        <input type="hidden" name="return" value="THIS URL">
        <input type="hidden" name="notify_url" value="THE URL TO YOUR ipn.php SCRIPT">
        <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" 
            border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
    </form>

Inside your ipn.php you can add a sql statement to change the user access to the book.

I have found this tutorial very useful when it comes to paypal forms: http://www.micahcarrick.com/paypal-ipn-with-php.html

Paypal form API: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/

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