dongyanpai2701 2013-09-24 02:02
浏览 27
已采纳

如何获得paypal自适应支付IPN帖子?

So I have my PHP IPN script working, now I am just not sure how to get the post values? Paypal returns the post as an array like this.

transaction[0].is_primary_receiver=false
&transaction[0].id_for_sender_txn=50E02759CC687801U
&log_default_shipping_address_in_transaction=false
&transaction[0].receiver=xxxxxxxxxx@gmail.com
&action_type=PAY
&transaction[1].status=Completed

There is obviously more but you get the idea, I tried accessing the post for status like this.

$payment_status = $_POST['transaction'][1]['status']

but this doesn't work, it returns the first letter which is C. So how do I access the values for all of them.

  • 写回答

1条回答 默认 最新

  • doude1917 2013-09-24 02:11
    关注

    With a little search I've found this link to be helpfull: https://developer.paypal.com/webapps/developer/docs/classic/ipn/ht_ipn/

    The most relevant part of the page:

    // Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.
    // Instead, read raw POST data from the input stream. 
    $raw_post_data = file_get_contents('php://input');
    $raw_post_array = explode('&', $raw_post_data);
    $myPost = array();
    foreach ($raw_post_array as $keyval) {
        $keyval = explode ('=', $keyval);
        if (count($keyval) == 2)
            $myPost[$keyval[0]] = urldecode($keyval[1]);
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数