简体   繁体   English

我想在我的codeigniter代码中实现贝宝集成。但是我需要的是只有一个功能,即付款确认或验证

[英]I want to implement paypal integration in my codeigniter code .But What i need is that only one function i.e payment confirmation or verification

I am working with web services on codeigniter framework .My friend working on android app development is using everything of paypal payment gateway as of its own.he asked me to just build one service of paypal that is , payment confirmation or verification. 我正在使用Codeigniter框架上的Web服务。我从事Android应用程序开发的朋友正在使用Paypal付款网关的所有功能。他要求我只构建Paypal的一项服务,即付款确认或验证。 I have uploaded payment library onto my server but i am not getting exact code of payment verification on net. 我已经将付款库上传到我的服务器上,但是我没有在网上获得确切的付款验证代码。

When you make payment in the paypal you should get the payment_status from the paypal site 当您在Paypal中付款时,您应该从Paypal网站上获得payment_status

Response 响应

SUCCESS
mc_gross=1.00
protection_eligibility=Partially+Eligible+-+INR+Only
address_status=unconfirmed
tax=0.00
payment_date=07%3A40%3A51+Aug+06%2C+2013+PDT
payment_status=Completed
charset=windows-1252
first_name=Sureshkumar
etc.....

If failed you will get 如果失败,你会得到

FAIL 403

This is used for verify process after transaction id is return. 这用于返回事务ID之后的验证过程。

$tx=$_REQUEST['tx'];

$paypal_url='https://www.paypal.com/cgi-bin/webscr?cmd=_notify-synch&tx='.$tx.'&at=token here';
$curl = curl_init($paypal_url);
$data = array(
"cmd" => "_notify-synch",
"tx" => $tx,
"at" => "token here"
);            

$data_string = json_encode($data); 
curl_setopt ($curl, CURLOPT_HEADER, 0);
curl_setopt ($curl, CURLOPT_POST, 1);
curl_setopt ($curl, CURLOPT_POSTFIELDS, $data_string);
curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 1);

$headers = array (
'Content-Type: application/x-www-form-urlencoded',
'Host: www.paypal.com',
'Connection: close'
);

curl_setopt ($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt ($curl, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($curl);
$lines = explode("\n", $response);
$keyarray = array();
if (strcmp ($lines[0], "SUCCESS") == 0) {
    for ($i=1; $i<count($lines);$i++){
        list($key,$val) = explode("=", $lines[$i]);
        $keyarray[urldecode($key)] = urldecode($val);
    }
    $first_name=$keyarray['first_name'];
    $last_name=$keyarray['last_name'];
    $payment_status=$keyarray['payment_status'];
    $business=$keyarray['business'];
    $payer_email=$keyarray['payer_email'];
    $payment_gross=$keyarray['payment_gross'];
    $mc_currency=$keyarray['mc_currency']; 
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我需要得到贝宝确认到PHP - I need to get paypal confirmation to php 如何完全跳过PayPal付款确认页面? - How can I skip the PayPal payment confirmation page altogether? 我如何实现贝宝延迟链式自适应支付集成。 - how i can implement paypal Delayed Chained adaptive payment integration. 如果我们要先执行javascript,然后执行php post方法(即提交),该怎么办 - what to do if we want javascript to be executed first then the php post method i.e submitting 我想刷新我的 html 页面上可用的所有 div,即按标签,我有 2 个代码如何 imerge - i want to refresh my all div available on my html page i.e by tag and i have 2 codes how can imerge 我正在使用 PayPal API,我希望将生成的付款数据保存在我的数据库中 - I'm using the PayPal API and I want the resulting payment data to be saved in my database 我想将贝宝支付网关集成到我的应用程序中,但是我无法传递金额变量 - I want to integrate paypal payment gateway to my application but i am not able to pass the amount variable PHP:函数&#39;count&#39;的复杂性[即O(1),O(n)]是多少? - PHP: What is the complexity [i.e O(1),O(n)] of the function 'count'? 选择一个不同的列,IE Finetuning选择查询 - Selecting one distinct column, I.E Finetuning select query 我想使用CodeIgniter在我的函数中添加slug但我的代码不起作用 - I want to add slug in my function using CodeIgniter but my code is not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM