Надеясь, кто-то может помочь.У меня была страница оплаты для braintree, созданная с помощью asp.net (vb), которая ранее работала с TSL 1.0 / 1.1.С изменением TSL1.2 и обновленным API я больше не могу заставить код работать.Я получаю сообщение об ошибке «Невозможно определить способ оплаты», и кажется, что payment_method_nonce пусто.Код ниже, и любая помощь будет высоко ценится.
<asp:Panel runat="server" ID="pnlPay" Visible =" false">
<div id="braintree-dropin"></div>
<asp:Button runat="server" ID="btnSubmit" Text="Pay now"/>
<asp:Label runat="server" ID="lblResult" Visible="false" Text=""></asp:Label>
<input id="nonce" name="payment_method_nonce" type="hidden" />
</asp:Panel>
<script src="https://js.braintreegateway.com/web/dropin/1.13.0/js/dropin.min.js"></script>
<script>
var client_token = "<%=ProcessorToken %>";
var form = document.querySelector('#form1');
braintree.dropin.create({
authorization: client_token,
container: '#braintree-dropin',
}, function (createErr, instance) {
form.addEventListener('#btnSubmit', function (event) {
event.preventDefault();
instance.requestPaymentMethod(function (err, payload) {
if (err) {
console.log('Error', err);
return;
}
// Add the nonce to the form and submit
document.querySelector('#nonce').value = payload.nonce;
form.submit();
});
});
});
</script>
Private _gateway As BraintreeGateway
Protected ProcessorToken As String
Protected PaymentNonce As String
Public ReadOnly Property Gateway() As BraintreeGateway
Get
If _gateway Is Nothing Then
If ConfigurationManager.AppSettings("braintreeSystem") = "Prod" Then
_gateway = New BraintreeGateway() With {
.Environment = Braintree.Environment.PRODUCTION,
.MerchantId = ConfigurationManager.AppSettings("braintreeMerchantID"),
.PublicKey = ConfigurationManager.AppSettings("braintreePublicKey"),
.PrivateKey = ConfigurationManager.AppSettings("braintreePrivateKey")
}
Else
_gateway = New BraintreeGateway() With {
.Environment = Braintree.Environment.SANDBOX,
.MerchantId = ConfigurationManager.AppSettings("TESTbraintreeMerchantID"),
.PublicKey = ConfigurationManager.AppSettings("TESTbraintreePublicKey"),
.PrivateKey = ConfigurationManager.AppSettings("TESTbraintreePrivateKey")
}
End If
End If
Return _gateway
End Get
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Set up the Braintree processor client token
Try
ProcessorToken = Gateway.ClientToken.Generate()
If Not IsPostBack Then
BindData()
Else
Validate()
Pay()
End If
Catch ex As Exception
MessageBoxShow(ex.Message)
End Try
End Sub
Спасибо,
Стив