Accepting a Paypal payment through a custom-built website

后端 未结 2 1130
予麋鹿
予麋鹿 2020-12-18 16:20

I have been making a hotel booking software that calculates, for given dates and specifications, a price for staying at a hotel. I\'m looking to use Paypal for accepting th

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-18 17:11

    I just completed this process in my current website: bpremium.com, basically I built a webservice api for the payment process where it can send commands over javascript until it gets to the last stage, which is where you build the form you send to paypal.

    in order to record the payment, you setup another webservice for the notify url and this will catch all the $_POST data and process it into your database.

    that is basically what we use, you can see we put the $amount + $amount*0.04 because you needed to add a 4% surcharge in spain, where I am. perhaps thats different in your code.

    I think the rest of it is pretty self explanatory.

    on the /webservice/ url, you need to record everything into your database, it sends you the information whether it succeeded or failed, but it's not a call to your website, you won't see this page, it's a "back channel" call to your website, so it's not your landing page, it's simple the url paypal sends all the raw data to, you're supposed to record it, process it and perhaps send out emails, etc.

    then if the user returns to your website, you land on the /payment/complete page, so this page could show the result, whether everything is ok, or something failed.

    hope it helps.

提交回复
热议问题