我需要使用Braintree进行付款,据我从Braintree的文档了解,请按照以下步骤操作;
创建网关
BraintreeGateway Gateway = new BraintreeGateway
{
Environment = Braintree.Environment.SANDBOX,
MerchantId = "xxxxxxxxxxx",
PublicKey = "yyyyyyyyyyyyyyy",
PrivateKey = "zzzzzzzzzzzzzzz",
};
创建了一个客户
var request = new CustomerRequest
{
FirstName = "firstName",
LastName = "lastName",
Email = "eMail",
Phone = "phone",
};
string CustomerId = Gateway.Customer.Create(request).Target.Id;
使用重新设置的客户ID创建客户的信用卡
var creditCardRequest = new CreditCardRequest
{
CustomerId = CustomerId,
Number = "credit_card_number",
ExpirationDate = "ex_date",
CVV = "cc_cvv"
};
string creditCardToken = Gateway.CreditCard.Create(creditCardRequest).Target.Token;
那又怎样?需要一笔金额的交易,但是我发现的使用与客户或信用卡无关。有人可以帮助我下一步做什么吗?特别是我需要一种没有3d安全的方法。
答案 0 :(得分:1)
支持的答案: 要创建交易,您必须包含金额和payMethodNonce,paymentMethodToken或customerId。传递customerId等同于传递客户的默认付款方式的paymentMethodToken。
TransactionRequest transactionRequest = new TransactionRequest()
{
Amount = amount,
CustomerId = customer.Id,
Options = new TransactionOptionsRequest
{
SubmitForSettlement = true
}
};
Result<Transaction> result = Gateway.Transaction.Sale(transactionRequest);