加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc – 如何将HTML表单转换为C#以进行PayPal订阅

发布时间:2020-12-16 09:44:07 所属栏目:asp.Net 来源:网络整理
导读:我有以下 HTML,适用于我的测试环境中的订阅付款. form action="paypalWebAddress" method="post" target="_top" input type="hidden" name="cmd" value="_xclick-subscriptions"/ input type="hidden" name="business" value="myPaypalAccountId"/ input typ
我有以下 HTML,适用于我的测试环境中的订阅付款.

<form action="paypalWebAddress" method="post" target="_top">
    <input type="hidden" name="cmd" value="_xclick-subscriptions"/>                        
    <input type="hidden" name="business" value="myPaypalAccountId"/>
    <input type="hidden" name="paymentaction" value="sale"/>
    <input type="hidden" name="item_name" value="Subscription For abc123"/>
    <input type="hidden" name="currency_code" value="GBP"/>
    <input type="hidden" name="no_note" value="1" />
    <input type="hidden" name="a3" value="50"/>
    <input type="hidden" name="p3" value="6"/>
    <input type="hidden" name="t3" value="M"/>
    <input type="hidden" name="src" value="1" />
    <input type="hidden" name="srt" value="0" /><!--needs to be never ending-->
    <input type="hidden" name="return" value="www."/>
    <input type="hidden" name="notify_url" value="www."/>
    <input type="hidden" name="cancel_url" value="www."/>
    <input type="hidden" name="custom" value="abc123"/>
    <input TYPE="hidden" name="charset" value="utf-8">
    <input type="hidden" name="bn" value="Me_Subscribe_WPS_UK" />
    <input type="submit" name="submit" value="Make Payment"/>
</form>

我即将上线并担心有人可能很容易操纵DOM而且我突然发送虚假付款.我觉得以某种方式从后面的代码发布这些值会更安全,因此用户不能篡改值,但用户仍然需要在他们的浏览器中使用PayPal接口登录和订阅.

PayPal-NET-SDK快速入门,展示如何开始.我已完成此操作(复制并粘贴并以调试模式运行)并且执行正常.但是,这不包括订阅,可能是由于上面解释的原因(并且可能会阻止他们在浏览器中访问PayPal gui).

我在PayPal仪表板区域中获得了创建按钮和按钮引用的选项,但是,这对我不起作用,因为我需要能够为每个订阅设置自定义字段,因为用户可以订阅一个或多个服务并且每个服务对于该用户是唯一的.

我无法理解如何实现这一目标

解决方法

如果我理解这一点,那么每个客户在您的情况下每个订阅都是唯一的,并且无法使用静态按钮,因此API似乎是唯一的方法.

PayPal API确实涵盖了订阅,它们被称为Billing Plans.由于每个订阅都不同,您可以为每个唯一服务(或服务组合)创建新的计费计划.这可以在没有任何中间SDK直接使用HttpClient到他们的API的情况下完成.

或者,您提到的PayPal-NET-SDK似乎也涵盖了计费计划.他们的Sample application有很多关于如何创建,枚举和发布计费计划的例子.请务必查看Payment类中的billing_agreement_tokens集合.您可以在那里添加多个“服务”令牌.

无论你发布多么接近,在这里仍然需要进行大量的测试.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读