zoukankan      html  css  js  c++  java
  • Paypal IPN

    网上已经有很多paypay ipn的文章了,只不过他们都是用paypal的购物车。因为我只是用来作为一个付款渠道,因此,我得先生成订单,然后引导客户去paypal付款。

    1.转去付款页面

    代码
        <form id="payForm" method="post" action="<%Response.Write(URL);%>">
            
    <input type="hidden" name="cmd" value="<%Response.Write(cmd);%>" />
            
    <input type="hidden" name="business" value="<%Response.Write(business);%>" />
            
    <input type="hidden" name="item_name" value="<%Response.Write(item_name);%>" /> 
            
    <input type="hidden" name="amount" value="<%Response.Write(amount);%>" />
            
    <input type="hidden" name="no_shipping" value="<%Response.Write(no_shipping);%>" />
            
    <input type="hidden" name="return" value="<%Response.Write(return_url);%>" />
            
    <input type="hidden" name="rm" value="<%Response.Write(rm);%>" />
            
    <input type="hidden" name="notify_url" value="<%Response.Write(notify_url);%>" />
            
    <input type="hidden" name="cancel_return" value="<%Response.Write(cancel_url);%>" />
            
    <input type="hidden" name="currency_code" value="<%Response.Write(currency_code);%>" />
            
    <input type="hidden" name="custom" value="<%Response.Write(request_id);%>" />
        
    </form>

        
    <script  type="text/javascript" language="javascript">
        document.forms[
    "payForm"].submit();
        
    </script>

    url 就是付款的网址

    notify_url用于paypal更新状态的网址,最好使用https,当然了http也行

    return 用于返回的网址,个人觉得没啥太大用处,还不如指回到订单页面

    custom用于传递特殊的值,paypal回调notify_url的时候会传递,可以验证请求有效性,是隐藏传递的。

    2.付款确认的页面

     将参数加上"&cmd=_notify-validate"回传回付款网址

    如果response的值是VERIFIED的时候,表示请求是从paypal出来的

    然后用他的request里面的变量判断数据是否正确,比如金额,产品价格、收款人等等

    如果这些都对的话,那么就放心的更新订单的付款状态了。

    3.paypal只有在确认付款后, payment_status才会等于Completed

  • 相关阅读:
    机器学习进度09(逻辑回归)
    机器学习进度08(过欠拟合、岭回归)
    机器学习进度07(线性模型、损失函数、优化方法)
    Python绘制心形图(动态)
    Python发送QQ消息
    Python免费发送手机短信,推送消息
    Anaconda的安装与环境配置以及jupyter的使用
    第一章 概念部分
    k8s简介
    安装k8s遇到的问题
  • 原文地址:https://www.cnblogs.com/wildfish/p/1750014.html
Copyright © 2011-2022 走看看