无法通过.net使用Braintree API生成客户端令牌

时间:2015-06-08 04:59:18

标签: .net braintree

无法使用我的客户端Javascript代码生成客户端令牌。但是,我能够与Braintree服务器进行通信,并能够在最终创建交易。但我的返回结果为空/ null。我可以让Braintree的一些开发人员帮我解决这个问题吗?

        //--------------------------------------------------------------------------------------------------
        //Gateway
        //This is the Braintree Gateway that we will use to post the transaction
        //to.  This is included here in the example but should be extracted out
        //into some static class somewhere.  Possibly in another layer.
        //--------------------------------------------------------------------------------------------------
        BraintreeGateway Gateway = new BraintreeGateway
        {
            Environment = Braintree.Environment.SANDBOX,
            PublicKey = "MY PUBLIC KEY",
            PrivateKey = "MY PRIVATE KEY",
            MerchantId = "MY MERCHANT ID"
        };

        string tokenID = Gateway.ClientToken.generate();

        //--------------------------------------------------------------------------------------------------
        //Transaction Request
        //This is the actual transaction request that we are posting to the 
        //Braintree gateway.  The values for number, cvv, month and year have 
        //been encrypted above using the braintree.js.  If you were to put a 
        //watch on the actual server controls their ".Text" property is blank
        //at this point in the process.
        //--------------------------------------------------------------------------------------------------
        TransactionRequest transactionRequest = new TransactionRequest
        {
            Amount = 100.00M,
            //PaymentMethodNonce = 
            CreditCard = new TransactionCreditCardRequest
            {
                Number = number,
                CVV = cvv,
                ExpirationMonth = month,
                ExpirationYear = year                    
            }                

        };

        //--------------------------------------------------------------------------------------------------
        //Transaction Result
        //Here we are going to post our information, including the encrypted
        //values to Braintree.  
        //--------------------------------------------------------------------------------------------------            
        Result<Transaction> result = Gateway.Transaction.Sale(transactionRequest);

这里结果返回null null事务值,但我的事务是在Braintree结束时创建的。在我的沙箱帐户中,我可以看到我的交易已经创建,AUTHORIZED在那里。我无法获得确切的事务ID,整个事务属性返回NULL ..我错过了一些东西?

0 个答案:

没有答案