Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.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
C# Braintree v2通过回发到服务器的帖子获取nonce_C#_Asp.net_Forms_Braintree - Fatal编程技术网

C# Braintree v2通过回发到服务器的帖子获取nonce

C# Braintree v2通过回发到服务器的帖子获取nonce,c#,asp.net,forms,braintree,C#,Asp.net,Forms,Braintree,我试图从“v2/braintree.js”中获取nonce字符串。如何在链接按钮上单击以生成nonce字符串时触发回服务器的post?我希望通过以下方式检索它: Request.Form["payment_method_nonce"].ToString(); 在旧版本“v1/braintree.js”中,我在单击按钮时使用了以下内容 function submit_data() { var braintree = Braintree.create('------key-

我试图从“v2/braintree.js”中获取nonce字符串。如何在链接按钮上单击以生成nonce字符串时触发回服务器的post?我希望通过以下方式检索它:

Request.Form["payment_method_nonce"].ToString();
在旧版本“v1/braintree.js”中,我在单击按钮时使用了以下内容

function submit_data() {
            var braintree = Braintree.create('------key-------');
            braintree.encryptForm('braintree-payment-form');
        }

因为我想访问回发邮件上的nonce字符串并验证回发邮件上的所有字段,所以我使用了以下命令。我遇到的问题是,nonce字符串是异步计算的

我创造

<asp:HiddenField ID="nonce_hidden" ClientIDMode="Static" runat="server" />

所有的验证和处理都在后端完成。

我在Braintree工作。你的问题有点难理解。如果你没有回答你的问题,我很抱歉我的问题令人困惑。我已经找到了我问题的答案。问题也在于我在Braintree上没有看到非MVC示例。
<a href="#!" class="button" onclick="get_nonce_data();">Purchase</a>
<asp:LinkButton ID="cc_payment_next_btn" ClientIDMode="Static" runat="server" OnClick="cc_payment_next_btn_Click"></asp:LinkButton>
function get_nonce_data() {var first_name = document.getElementById("first_name_txt").value;var last_name = document.getElementById("last_name_txt").value;var zip_code = document.getElementById("zip_code_txt").value;var client = new braintree.api.Client({ clientToken: "client-token" });client.tokenizeCard({number: document.getElementById("cc_number_txt").value,cardholderName: first_name + ' ' + last_name,expirationDate: document.getElementById("cc_expiration_txt").value,cvv: document.getElementById("cc_ccv_txt").value,billingAddress: {postalCode: zip_code}}, function (err, nonce) {if (err === null) {document.getElementById("nonce_hidden").value = nonce;$('#cc_payment_next_btn')[0].click();}else {alert('An error has occured');}});}