Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法指定“;“金额”;根据PayPal HTMLButton上的付款请求_Paypal_Paypal Sandbox - Fatal编程技术网

无法指定“;“金额”;根据PayPal HTMLButton上的付款请求

无法指定“;“金额”;根据PayPal HTMLButton上的付款请求,paypal,paypal-sandbox,Paypal,Paypal Sandbox,我正在尝试使用“HTML按钮”方法与PayPal集成。 签出流程相当简单, 用户单击“立即购买”->转移到贝宝->已处理付款->返回站点 根据客户希望“立即购买”的项目,提交表单中的“金额”会有所不同,我无法让PayPal接受我发送的值。我总是看到一个文本输入是空的,当重定向到贝宝 我尝试了托管和非托管按钮,但仍然看不到想要的效果 托管按钮HTML示例: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method=

我正在尝试使用“HTML按钮”方法与PayPal集成。 签出流程相当简单, 用户单击“立即购买”->转移到贝宝->已处理付款->返回站点

根据客户希望“立即购买”的项目,提交表单中的“金额”会有所不同,我无法让PayPal接受我发送的值。我总是看到一个文本输入是空的,当重定向到贝宝

我尝试了托管和非托管按钮,但仍然看不到想要的效果

托管按钮HTML示例:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
  <input type="hidden" name="cmd" value="_s-xclick">
  <input type="hidden" name="hosted_button_id" value="HOSTEDBTNVALUE">
  <input type="image" src="https://www.sandbox.paypal.com/en_GB/SG/i/btn/btn_buynowCC_LG.gif" name="submit" alt="PayPal – The safer, easier way to pay online!" style="border: 0;">
  <img alt="" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" style="border: 0; width: 1; height: 1;">
  <input type="text" readonly="true" name="item_name" value="Test PayPal integration payment">
  <div class="form-group" id="amount_field">
    <label class="control-label col-md-2" for="amount">Amount</label>
    <div class="col-md-5">
      <input type="text" id="amount" name="amount" value="100" aria-describedby="amount_info_0" class="form-control"><span id="amount_info_0" class="help-block">Real</span></div>
  </div>
  <div class="form-group" id="txnRef_field">
    <label class="control-label col-md-2" for="txnRef">Transaction Ref</label>
    <div class="col-md-5">
      <input type="text" id="txnRef" name="txnRef" value="8d724ad470af4d9d91d49f84068c4bab" aria-describedby="txnRef_info_0" class="form-control"><span id="txnRef_info_0" class="help-block">Required</span></div>
  </div>
  <input type="hidden" name="currency_code" value="SGD">
</form>

数量
真实的
事务参考
要求的
上面的“金额”目前是一个文本输入,因为这是我的集成测试页面,在实际应用程序中,它将是嵌入表单中的隐藏/只读输入

以下是未显示的按钮示例代码:

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
  <input type="hidden" name="cmd" value="_s-xclick">
  <input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----ReallyLongKey-----END PKCS7-----">
  <input type="image" src="https://www.sandbox.paypal.com/en_GB/SG/i/btn/btn_buynowCC_LG.gif" name="submit" alt="PayPal – The safer, easier way to pay online!" style="border: 0;"><img alt="" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" style="border: 0; width: 1; height: 1;">
  <input type="hidden" name="notify_url" value="https://myapplication.com/transaction/paypal/status">
  <input type="hidden" name="currency_code" value="SGD">
  <input type="hidden" name="custom" value="ad4a63e2f2f04b908ddb8e7c67f9c67a">
  <input type="text" readonly="true" name="item_name" value="Test PayPal integration payment">
  <div class="form-group" id="amount_field">
    <label class="control-label col-md-2" for="amount">Amount</label>
    <div class="col-md-5">
      <input type="text" id="amount" name="amount" value="100" aria-describedby="amount_info_0" class="form-control"><span id="amount_info_0" class="help-block">Real</span></div>
  </div>
  <div class="form-group" id="txnRef_field">
    <label class="control-label col-md-2" for="txnRef">Transaction Ref</label>
    <div class="col-md-5">
      <input type="text" id="txnRef" name="txnRef" value="ad4a63e2f2f04b908ddb8e7c67f9c67a" aria-describedby="txnRef_info_0" class="form-control"><span id="txnRef_info_0" class="help-block">Required</span></div>
  </div>
</form>

数量
真实的
事务参考
要求的
下面是应用程序页面的截图,以及我在PayPal支付页面上看到的结果。请原谅没有对齐和样式。这是为了在它变得漂亮之前证明概念

  • 我的集成应用程序测试页

  • paypal页面,其中金额预计将根据我的请求固定,不可编辑。

  • 不知道我做错了什么。请帮忙


    谢谢。

    我通过让PayPal生成具有以下设置的按钮来启动它: 1. <代码>商户帐户ID:使用我的主要电子邮件地址[未使用安全商户帐户ID]
    2.取消选中PayPal上的
    保存按钮
    复选框。此外,在html按钮生成界面中,我单击了链接
    remove code protection
    ,该链接将
    cmd
    值从
    \u s-xclick
    设置为
    \u xclick

    ,如果出现问题,我建议您尝试最简单的代码。此外,确保了解每个参数的含义。另外,试试看。如果不适合您,请提供paypal生成的带有默认设置的代码(创建按钮时)。应该没有
    hosted_button_id
    param。正如我在另一个问题中所说的,当使用hosted按钮时,不能在表单中覆盖诸如price之类的内容。价格在贝宝上“托管”。根据我的记忆,@x-yuri感谢您的反馈。我可以通过让PayPal生成带有以下设置的按钮来运行它:1。商户帐户ID:使用我的主要电子邮件地址[未使用安全商户帐户ID]2。取消选中“在贝宝上保存按钮”复选框。此外,在html按钮生成界面中,我单击了“删除代码保护”链接,该链接将“cmd”值从“\u s-xclick”设置为“\u-xclick”。我使用的选项有什么问题吗?我不是paypal的专家,我已经有一段时间没有处理过它了,现在我只能访问paypal个人帐户。话虽如此,我认为您选择的设置没有任何错误。所有这些设置都与隐藏你传递给paypal的内容有关,我无法告诉你。隐藏电子邮件、托管按钮和加密(代码保护)的商户ID就是隐藏要传递给paypal的所有数据……但由于安全问题经常发生,您永远不知道可以对您使用什么。因此,如果很容易做到,为什么不采取一些额外的步骤呢?IIRC,你可以在你这边加密表单数据,不需要使用托管按钮。对于托管按钮,如果只有一个或多个带有静态数据的按钮,那么托管它们是有意义的。如果没有,那么它很可能是一个拖动,如果可能的话,所以切换到非托管按钮是有意义的。但这完全取决于你正在开发的项目。如果出现任何问题,请考虑后果。