douzheren3349 2019-07-30 13:43
浏览 165

购买后获取first_name,last_name和发送电子邮件至paypal(woocommerce)

Immediately after buying (in the woocommerce_thankyou action) I need to get the customer data from paypal (email, first_name and last_name) This is because I need the real user data to generate a license with his name.

Is it possible to obtain this data from paypal in the woocommerce_thankyou page?

I use "PayPal Checkout" plugin from woocommerce.

  • 写回答

1条回答 默认 最新

  • duanchi4184 2019-07-30 13:55
    关注

    In PayPal's reply to your post, the first line is SUCCESS or FAIL.

    If the response contains the word FAIL, make sure that the transaction ID token and identity token on your post are correct.

    function FetchOrder()
       {
       $transactionID=$_POST["txn_id"];
       $item=$_POST["item_name"];
       $amount=$_POST["mc_gross"];
       $currency=$_POST["mc_currency"];
       $datefields=explode(" ",$_POST["payment_date"]);
       $time=$datefields[0];
       $date=str_replace(",","",$datefields[2])." ".$datefields[1]." ".$datefields[3];
       $timestamp=strtotime($date." ".$time);
       $status=$_POST["payment_status"];
       $firstname=$_POST["first_name"];
       $lastname=$_POST["last_name"];
       $email=$_POST["payer_email"];
       $custom=$_POST["option_selection1"];
       if ($transactionID AND $amount)
          {
          // query to save data
          return $this->insertID;
          }
       else
          {
          return 0;
          }
       }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器