我在使用 Braintree 时是 VB.net 的新手,它工作正常,现在我需要在付款请求中传递运输详细信息。我该怎么做
If Request.Form("payment_method_nonce") <> "" Then
Dim strStatus As String = ""
Dim gateway As New Braintree.BraintreeGateway
With gateway
.Environment = Braintree.Environment.SANDBOX
.PublicKey = "*********"
.PrivateKey = "*************"
.MerchantId = "*************"
End With
Dim transactionRequest As New Braintree.TransactionRequest
With transactionRequest
.Amount = 100
.PaymentMethodNonce = Request.Form("payment_method_nonce")
End With
Dim result As Braintree.Result(Of Braintree.Transaction) = gateway.Transaction.Sale(transactionRequest)
If result.Errors Is Nothing Then
If result.Target.Status.ToString = Braintree.TransactionStatus.AUTHORIZED.ToString Then
strStatus = "Payment is " & result.Target.Status.ToString
Dim result1 As Braintree.Result(Of Braintree.Transaction) = gateway.Transaction.SubmitForSettlement(result.Target.Id)
strStatus = strStatus & " And Now its " & result1.Target.Status.ToString
Label1.Text = "Paid"
Else
strStatus = result.Target.Status.ToString
End If
Else
strStatus = result.Message.ToString
Label1.Text = "Not Paid"
End If
status.Text = strStatus
End If