无法通过.net使用Braintree API生成客户端令牌
无法使用我的客户端Javascript代码生成客户端令牌。然而,我能够与Braintree服务器进行通信,并能够在服务器端创建事务。但我的返回结果为空/空。我可以有一些Braintree开发者在这方面帮助我吗无法通过.net使用Braintree API生成客户端令牌,.net,braintree,.net,Braintree,无法使用我的客户端Javascript代码生成客户端令牌。然而,我能够与Braintree服务器进行通信,并能够在服务器端创建事务。但我的返回结果为空/空。我可以有一些Braintree开发者在这方面帮助我吗 //-------------------------------------------------------------------------------------------------- //Gateway //This is
//--------------------------------------------------------------------------------------------------
//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);
//--------------------------------------------------------------------------------------------------
//网关
//这是我们用来发布交易的Braintree网关
//对。这在示例中包括,但应提取出来
//进入某个静态类。可能在另一层。
//--------------------------------------------------------------------------------------------------
BraintreeGateway=新的BraintreeGateway
{
环境=Braintree.Environment.SANDBOX,
PublicKey=“我的公钥”,
PrivateKey=“我的私钥”,
MerchantId=“我的商户ID”
};
字符串tokenID=Gateway.ClientToken.generate();
//--------------------------------------------------------------------------------------------------
//交易请求
//这是我们正在过帐到的实际交易请求
//脑树网关。数字、cvv、月份和年份的值已更改
//已在上面使用braintree.js进行加密。如果你把
//实际服务器上的监视控件的“.Text”属性为空
//在这个过程中的这一点上。
//--------------------------------------------------------------------------------------------------
TransactionRequest TransactionRequest=新建TransactionRequest
{
金额=100.00M,
//PaymentMethodNonce=
CreditCard=新交易CreditCardRequest
{
数字=数字,
CVV=CVV,
ExpirationMonth=月,
到期年=年
}
};
//--------------------------------------------------------------------------------------------------
//交易结果
//在这里,我们将发布我们的信息,包括加密的
//将值添加到Braintree。
//--------------------------------------------------------------------------------------------------
结果=Gateway.Transaction.Sale(transactionRequest);
这里的结果返回空事务值,但我的事务是在Braintree端创建的。在我的沙箱帐户中,我可以看到我在那里创建、授权的大量交易。Im无法获取准确的事务ID,并且整个事务属性返回我NULL。。我错过什么了吗 嗨,我在Braintree工作。您在服务器上生成的客户端令牌是您的客户端代码应该使用的,您可以共享您的Javascript以便我们可以看到您如何在客户端上设置Braintree吗?是的,我理解这一点,并且能够成功地做到这一点。谢谢你,谢谢你!很高兴听到这个消息。