同样基于.net core webapi ,对外暴露支付接口
1.nuget添加引用:AuthorizeNet
里面的方法大家不妨都了解下,方便自己功能调用。
核心代码直接贴出,仅供参考
var transactionRequestType = new transactionRequestType
{
poNumber= $"{Config.Prefix}{tradeNbr}",
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
amount = Convert.ToDecimal(model.Amount),
payment = new paymentType
{
Item = new creditCardType
{
cardNumber = model.CardNbr,
expirationDate = model.Expiredate,
cardCode = model.Cvv
}
},
lineItems = new[] { new lineItemType { itemId = "1", name = "ABC", quantity = 1, unitPrice = Convert.ToDecimal(model.Amount) } }
};
var transactionRequest = new createTransactionRequest { transactionRequest = transactionRequestType };
var controller = new createTransactionController(transactionRequest);
controller.Execute();
var response = controller.GetApiResponse();
信用卡支付不同于微信,没有支付回调方法,所以支付成功后直接处理支付业务流程,支付记录入库等。
表示银行卡支付文档大家自行网上查看,最好有点英文基础,因为都是英文文档。