I'm writing an app written in C# - Xamarin Forms.
I'm simply trying to get a response from Braintree's server so I can process payment.
This response is the payment_method_nonce which is required to process payment.
Here's the client side code provided by 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
});
})
});
It generates the credit card form nicely however if you click on the Purchase button, a payment_method_nonce is expected to return from the Braintree server.
My question is, how do I capture this payment_method_nonce variable in C# when the client form is rendered in Javascript, inside a webview?