【发布时间】:2018-04-18 03:04:21
【问题描述】:
以下代码正在向卡收费,但它没有创建配置文件....有什么提示吗?我假设我遗漏了什么,或者使用了错误的类型...
var opaqueData = new opaqueDataType { dataDescriptor = "COMMON.ACCEPT.INAPP.PAYMENT", dataValue = paymentNonce };
//standard api call to retrieve response
var paymentType = new paymentType { Item = opaqueData };
var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), // authorize and capture transaction
amount = paymentAmount,
payment = paymentType,
customer = new customerDataType()
{
type = customerTypeEnum.individual,
id = userID.ToString()
},
profile = new customerProfilePaymentType()
{
createProfile = true
}
};
var request = new createTransactionRequest { transactionRequest = transactionRequest };
// instantiate the contoller that will call the service
var controller = new createTransactionController(request);
const SslProtocols _Tls12 = (SslProtocols)0x00000C00;
const SecurityProtocolType Tls12 = (SecurityProtocolType)_Tls12;
ServicePointManager.SecurityProtocol = Tls12;
controller.Execute();
// get the response from the service (errors contained if any)
var response = controller.GetApiResponse();
更新: 由于显然不允许使用 OpaqueData,因此我将其更改为手动创建配置文件。我收到以下错误:“错误:I00001 成功。”
// Add Payment method to Customer.
customerPaymentProfileType opaquePaymentProfile = new customerPaymentProfileType();
opaquePaymentProfile.payment = paymentType;
opaquePaymentProfile.customerType = customerTypeEnum.individual;
var request2 = new createCustomerPaymentProfileRequest
{
paymentProfile = opaquePaymentProfile,
validationMode = validationModeEnum.none,
customerProfileId = userID.ToString()
};
var controller2 = new createCustomerPaymentProfileController(request2);
controller2.Execute();
//Send Request to EndPoint
createCustomerPaymentProfileResponse response2 = controller2.GetApiResponse();
if (response2 != null && response2.messages.resultCode == messageTypeEnum.Ok)
{
if (response2 != null && response2.messages.message != null)
{
//Console.WriteLine("Success, createCustomerPaymentProfileID : " + response.customerPaymentProfileId);
}
}
else
{
Utility.AppendTextToFile("Error: " + response.messages.message[0].code + " " + response.messages.message[0].text, Server.MapPath("/pub/auth.txt"));
}
更新 #2 非常困惑,因为 auth.net 文档说此代码意味着成功......所以为什么我没有看到创建的 CIM 支付方式? RESPONSE CODE DOCS
更新 #3 所以我打印出主要响应消息而不是 CIM 请求消息,呃。实际错误是:“E00114 Invalid OTS Token”。 根据文档,该错误通常来自使用过的密钥,因此我现在生成 2 个密钥(一个用于处理,一个通过 CIM 存储),但现在出现此错误:“E00040 找不到记录。”。 ...有什么想法吗?
【问题讨论】:
-
您从 API 得到什么响应?您如何验证配置文件是否已创建?你调试过代码吗?
-
I️ 正在成功创建交易。我️ 正在检查 auth.net 面板以查看是否创建了任何配置文件。
-
显示您从 Authorize.Net 的回复,否则我们无法为您提供帮助
-
这是在网络服务中,所以花了一点时间,我收到的一条消息是“客户资料创建失败。此付款方式不支持创建资料。”所以我猜我无法从 Accept SDK 编码卡制作客户付款资料?我唯一的选择是将原始信用卡详细信息发送到服务器吗?我认为使用手机应用时需要接受 SDK?
-
我更新了问题,因为从我所看到的情况来看,我必须手动创建此配置文件,因为我使用的是不透明数据。
标签: c# authorize.net