无法指定“金额" PayPal HTMLButton上的每个付款请求 [英] Not able to specify "amount" per payment request on PayPal HTMLButton

查看:43
本文介绍了无法指定“金额" PayPal HTMLButton上的每个付款请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用"HTML按钮"方法与PayPal集成. 结帐流程非常简单, 用户单击立即购买"->转移到PayPal->付款已处理->返回站点.

I am trying to integrate with PayPal using the "HTML Buttons" approach. The checkout flow is rather simple, user clicks "Buy Now" -> transferred to PayPal -> payment processed -> returned to the site.

根据客户要立即购买"的项目,提交的表单中的金额"会有所不同,并且我无法让PayPal接受我发送的值.我总是看到一个文本输入,当重定向到PayPal时该输入为空.

Based on the item that the customer wants to "Buy Now", the "amount" in the submitted form will vary, and I am unable to get PayPal to accept the value I am sending. I always see a text input which is empty when redirected to PayPal.

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

I tried hosted and unhosted buttons but still not able to see the desired effect.

托管按钮的HTML示例:

hosted button HTML example:

<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>

上面的数量"是当前的文本输入,因为这是我的集成测试页,在实际的应用程序中,它将是嵌入在表单中的隐藏/只读输入.

The "amount" above is a text input at the moment because this is my integration testing page, in the actual application it will be a hidden/readonly input embedded in the form.

这是未托管的按钮示例代码:

Here is the unhosted button example code:

<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付款页面上看到的结果.请原谅缺乏对齐方式和样式的人.这本来是概念的证明,然后再变得漂亮.

I have screenshots below for the application page and what I see as a result on the PayPal payment page. Please excuse the lack of alignment and styling. This is meant to be a proof of concept before it is pretty.

  1. 我的应用程序测试页面以进行集成

  1. my application test page for integration

贝宝页面,该页面预计金额将根据我的要求而固定,并且不可编辑.

paypal page where amount is expected to be fixed based on my request and not editable.

不知道我在做什么错.请帮忙.

Not sure what I'm doing wrong here. Please help.

谢谢.

推荐答案

我可以通过使PayPal生成具有以下设置的按钮来实现此目的: 1. Merchant account IDs: Use my primary email address [未使用安全的商家帐户ID] 2.取消选中save button at PayPal复选框.另外,在html按钮生成界面中,我单击了remove code protection链接,该链接将cmd的值从_s-xclick更改为_xclick

I was able to get it going by making PayPal generate the button with the following settings: 1. Merchant account IDs: Use my primary email address [did not use secure merchant account ID] 2. unchecking the save button at PayPal checkbox. Also, in the html button generation interface, I clicked the link remove code protection which made the cmd value from _s-xclick to _xclick

这篇关于无法指定“金额" PayPal HTMLButton上的每个付款请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆