简体   繁体   English

Braintree 集成 - 自定义表单不发送随机数

[英]Braintree Integration - custom form doesn't send nonce

The nonce wont show up at server side if I use the code in the documentation and I don't see any nonce hidden input being submitted.如果我使用文档中的代码并且我没有看到任何提交的 nonce 隐藏输入,则 nonce 不会出现在服务器端。 I've only got it working with the dropin for and could see the nonce on server side.我只让它与 dropin 一起工作,并且可以在服务器端看到 nonce。

<form id="checkout" action="/checkout" method="post">
<input data-braintree-name="number" value="4111111111111111">
<input data-braintree-name="cvv" value="100">

<input data-braintree-name="expiration_date" value="10/20">

<!-- you can also split expiration date into two fields -->
<input data-braintree-name="expiration_month" value="10">
<input data-braintree-name="expiration_year" value="2020">

<input data-braintree-name="postal_code" value="94107">
<input data-braintree-name="cardholder_name" value="John Smith">

<input type="submit" id="submit" value="Pay">

  <script src="https://js.braintreegateway.com/js/braintree-2.24.0.min.js"></script>
  <script>
        var clientToken = null;

$.get( "/csgosupply/generateToken", function( data ) {
    clientToken = data;

    braintree.setup(clientToken, "custom", {
        container: "checkout"
    });
});

I got it working with this guy's code Braintree - Custom - Manual form submission onPaymentMethodReceived我得到了这个人的代码Braintree - 自定义 - 手动提交表单 onPaymentMethodReceived

I get "gateway_rejected" if I use same card number in a short period of time with tokinzeCard though.如果我在短时间内使用与 tokinzeCard 相同的卡号,我会收到“gateway_rejected”。

Braintree recently released new sample code here that includes a full php example . Braintree 最近在这里发布了新的示例代码,其中包括一个完整的 php 示例

You should be able to use that instead and get it working.你应该能够使用它并让它工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM