集成 PayPal 快速结账的更简单方法?
我已经为 Wordpress CMS 构建了一个产品生成和显示插件,现在我正在尝试为结帐流程集成某种形式的 PayPal 集成.
I have built a product generation and display plugin for the Wordpress CMS and I am now trying to integrate some form of PayPal integration for the checkout process.
我有购物车、产品、运输、总计,所有这些都是我想出来的,我希望有人能指出我将这些信息发送到 PayPal 的最简单的方向.我知道一些这样做的方法并不那么安全,而另一些方法会让你像某种表演犬一样跳过箍.我一直在尝试学习如何使用 cURL,然后如何让它与 PHP 一起工作——这看起来真的有点混乱.我现在在我的 WAMP 服务器上有 cURL 工作......但是......
I have the cart, the products, the shipping, totals, all that figured out on my end and I was hoping someone could point me in the simplest direction of sending this information to PayPal. I understand some methods of doing this are not that secure and others make you jump through hoops like some sort of show dog. I've been trying to learn how to use cURL and then how to get it to work with PHP - it really seems like a bit of a mess. I do now have cURL working on my WAMP server ... but..
有更好的方法还是应该继续学习cURL?
Is there a better way or should I continue to learn cURL?
我可以格式化数据,但需要将数据发送到 PayPal 并且不介意使用 JavaScript 执行此操作 - 这不是付费墙,每个订单都由人工检查准确性 - 所以有人搞乱了客户端脚本不会打扰我.我也绝对想将它们发送到 PayPal,我不想存储/处理他们的信用卡信息.但是,拥有 IPN 会很好.有人能指出我正确的方向或向我保证我已经朝着那个方向前进了吗?
I can format the data however it needs to be to send off to PayPal and would not mind doing this with JavaScript - this is not a pay-wall and every order is checked for accuracy by a human - so someone messing with the client-side script will not bother me. I also definitely want to send them to PayPal, I want no part of storing/processing their credit card information. It would, however, be nice to have IPN. Can someone point me in the right direction or assure me that I already am headed that way?
非常感谢.
推荐答案
这就是我如何自动重定向到 PayPal 的所有表单详细信息;
This is how i automatically redirect to PayPal with all the form details;
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="paypal">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="cbt" value="Return to example" />
<input type="hidden" name="business" value="email" />
<input type="hidden" name="item_name" value="example Purchase" />
<input type="hidden" name="amount" value="9.99">
<input type="hidden" name="button_subtype" value="services" />
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="URL" />
<input type="hidden" name="notify_url" value="URL"/>
<input type="hidden" name="cancel_return" value="URL" />
<input type="hidden" name="currency_code" value="USD"/>
<input type="hidden" name="image_url" value="" />
<input type="hidden" id="custom" name="custom" value="invoice_id to track"/>
<input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>
</form>
对于多个产品,您可以简单地在表单中添加更多产品,例如;
For multiple products, you can simply add more products to the form, example;
<input type="hidden" name="item_name_1" value="Item #1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2" value="Item #2">
<input type="hidden" name="amount_2" value="2.00">
然而,使用这种方法并不是很好
However, using this method is not all great
所有数据都需要用PHP生成并输入到页面中,您还需要在IPN回调时检查交易以确保其已支付.
All the data would need to be generated with PHP and input into the page, you would also need to check the transaction when the IPN calls back to ensure its been paid.
<script type="text/javascript">
function myfunc () {
var frm = document.getElementById("paypal");
frm.submit();
}
window.onload = myfunc;
</script>
相关文章