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

查看:89
本文介绍了通过定制网站接受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)似乎能最好地处理的普通一价产品.我需要一种方法,可以将费用发送给贝宝,让贝宝向客户收费,然后让贝宝将确认发送到网站的确认信息发送回网站,此时预订已完成.

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上完成了此过程,基本上我为付款过程构建了一个Web服务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设置了另一个Web服务,它将捕获所有$ _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天全站免登陆