如何处理2checkout与curl的购买 [英] How to process purchase for 2checkout with curl

查看:343
本文介绍了如何处理2checkout与curl的购买的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这是否已经在论坛中提出过,但我真的很难搜索答案。有没有api的方式提交购买在2checkout使用curl在PHP?因为目前他们正在宣传的是这个示例:

I'm not sure if this was already asked in the forum but I was really having a hard time searching for answer. Is there an api way to submit a purchase on 2checkout using curl in php? cause currently what they are promoting is this sample:

<form action='https://www.2checkout.com/checkout/purchase' method='post'>
<input type='hidden' name='sid' value='1303908' />
<input type='hidden' name='mode' value='2CO' />
<input type='hidden' name='li_0_name' value='invoice123' />
<input type='hidden' name='li_0_price' value='25.99' />
<input type='hidden' name='card_holder_name' value='Checkout Shopper' />
<input type='hidden' name='street_address' value='123 Test Address' />
<input type='hidden' name='street_address2' value='Suite 200' />
<input type='hidden' name='city' value='Columbus' />
<input type='hidden' name='state' value='OH' />
<input type='hidden' name='zip' value='43228' />
<input type='hidden' name='country' value='USA' />
<input type='hidden' name='email' value='example@2co.com' />
<input type='hidden' name='phone' value='614-921-2450' />
<input name='submit' type='submit' value='Checkout' />
</form>

您将使用javascript提交或只需点击提交按钮提交但我不想使用它,因为这个过程可能会损害在购买或检出过程中的网站的安全性,我已经试图创建一个curl代码,但它不工作

to which you'll use a javascript to submit or just simply click on the submit button to submit it but I don't want to use it cause this procedure might compromise the security of the site during the purchase or checkout process, I have already tried to create a curl code for this but it won't work

$curl = curl_init('https://www.2checkout.com/checkout/purchase');
        $data = array();
        curl_setopt($curl, CURLOPT_HTTPHEADER, array("Accept: application/json"));
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_USERAGENT, "2Checkout PHP/0.1.0");
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$data['sid']='1303908';...
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_exec($curl);
        curl_close($curl);

这是我怎么做的,但它不会添加购买2checkout,谁能够做到这一点?如果不可能使用curl加密数据可能足够,但我不知道如何做,我也可以使用一个秘密词或某事。现在,我真的需要一些启示。这里欢迎任何答案:((

This is how I did it but it won't add the purchase over on 2checkout, is there somebody who was able to do this already? If it's not possible with curl encryption of data maybe enough but I'm not sure how to do it which I can also use a secret word or something. Please I really need some enlightenment right now any answers are welcome here :(((

提前感谢。

推荐答案

我通过电子邮件发送了2checkout关于这个问题,这是他们的回应:

I emailed 2checkout regarding this issue, and this was their response:

不幸的是,由于信息提交通过HTML表单,它确实使它容易受到黑客的影响,你可以从Play参数集创建订单,你可以在2Checkout供应商区域创建订单,并且只在销售时提交产品ID给我们。这样,黑客就不能改变价格。

Unfortunately, due to the fact that the information is submitted through an HTML form, that does make it vulnerable to hackers. You could create the order from the Play Parameter set, where you would create the order in the 2Checkout vendor area, and just submit a product ID to us at the time of sale. that way, the hacker would not be able to alter the price.

此外,我们有一些预构建的服务器端编码库,您可以使用它来创建一个html形式并自动提交给我们,同时调用库,虽然它仍然创建一个HTML表单,将有较少的机会,有人改变它的库位于这里: https://www.2checkout.com/documentation/libraries 如果你想看看。

Also, we do have some pre-built server side coding libraries that you can use to create an html form and automatically submit it to us with a call to the library. While it does still create an HTML form, there would be less chance for someone to alter it. The libraries are located here: https://www.2checkout.com/documentation/libraries if you want to take a look.

这篇关于如何处理2checkout与curl的购买的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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