通过定制网站接受 Paypal 付款 [英] Accepting a Paypal payment through a custom-built website

查看:25
本文介绍了通过定制网站接受 Paypal 付款的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在制作一个酒店预订软件,它可以根据给定的日期和规格计算入住酒店的价格.我想使用 Paypal 接受付款,但浏览了他们的网站后,找不到与此兼容的解决方案.

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 the payment, but having browsed their website, can't find a solution that seems to be compatible with this.

由于价格是动态的,它不像 Paypal 似乎处理得最好的普通单价产品.我需要一种方法,可以将费用发送给 Paypal,让 Paypal 向客户收费,然后让 Paypal 向网站发送确认付款已正确处理,此时预订已完成.

Since the price is dynamic, it's not like a normal one-price product which Paypal seems to handle best. I need a method where I can send the cost to Paypal, have Paypal charge the customer, then have Paypal send a confirmation back to the website that the payment has processed correctly at which point the booking is complete.

我认为 Paypal 能够处理这样的动态定价项目.谁能指出我应该寻找的方向?

I presume Paypal is capable of handling a dynamically priced item like this. Could anyone point me in the direction of where I should be looking?

推荐答案

我刚刚在我当前的网站 bpremium.com 上完成了这个过程,基本上我为支付过程构建了一个 webservice api,它可以通过 javascript 发送命令,直到它进入最后一个阶段,在此阶段您可以构建发送给 paypal 的表单.

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.

为了记录付款,您为通知 url 设置了另一个网络服务,这将捕获所有 $_POST 数据并将其处理到您的数据库中.

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.

<form id="form-payment-paypal" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="bn" value="PP-BuyNowBF" />
<input type="hidden" name="charset" value="utf-8" />
<input type="hidden" name="business" value="YOUR_ACCOUNT_EMAIL_ADDRESS" />
<input type="hidden" name="item_name" value="THE PRODUCT NAME" />
<input type="hidden" name="item_number" value="YOUR_RECOGNISABLE_SALE_ID?>" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="lc" value="THE LANGUAGE CODE: es_ES, en_GB, etc" />
<input type="hidden" name="amount" value="<?=$amount+($amount*0.04)?>" />
<input type="hidden" name="return" value="/payment/complete/" />
<input type="hidden" name="notify_url" value="/webservice/payment/notify/paypal/" />

<p class="ac span300">
    <input  type="submit" class="form-style-bt" value="PAY" />
</p>
</form>

这基本上就是我们使用的,你可以看到我们把 $amount + $amount*0.04 因为你需要在西班牙加上 4% 的附加费,我所在的地方.也许这在您的代码中有所不同.

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.

在/webservice/url 上,您需要将所有内容都记录到您的数据库中,它会向您发送成功或失败的信息,但这不是对您网站的调用,您不会看到此页面,它是一个反向渠道"调用到您的网站,所以它不是您的目标网页,很简单,网址贝宝将所有原始数据发送到,您应该记录它,处理它并可能发送电子邮件等.

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.

然后,如果用户返回到您的网站,您将进入/payment/complete 页面,因此该页面可以显示结果,无论一切正常还是失败.

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.

希望能帮到你.

这篇关于通过定制网站接受 Paypal 付款的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆