我正在编写一个用 C# - Xamarin Forms 编写的应用程序。
我只是想从 Braintree 的服务器获得响应,以便处理付款。
此响应是处理付款所需的 payment_method_nonce。
这是 Braintree 提供的客户端代码。
<script src="https://js.braintreegateway.com/web/dropin/1.24.0/js/dropin.js"></script>
<div id="dropin-container"></div>
<button id="submit-button" class="button button--small button--green">Purchase</button>
var button = document.querySelector('#submit-button');
braintree.dropin.create({
authorization: 'xxxxx',
selector: '#dropin-container'
}, function (err, instance) {
button.addEventListener('click', function () {
instance.requestPaymentMethod(function (err, payload) {
// Submit payload.nonce to your server
});
})
});
它可以很好地生成信用卡表格,但是如果您单击“购买”按钮,则预期会从 Braintree 服务器返回 payment_method_nonce。
我的问题是,当客户端表单在 webview 中以 Javascript 呈现时,如何在 C# 中捕获这个 payment_method_nonce 变量?