Hello,
We are using the C# driver and Accept.js. The problem that we are having is that we need a payment profile to be associated with our transaction in order to do refunds.
If we try to create the customer profile first (before the payment) using the opaque data, we get error 33.
If we try to create the customer profile with the transaction we get error E00102 (Customer info is missing). We assume that an email and description are missing here, but the c# driver, does not provide any field to specify this info with the customerProfilePaymentType.
If we create the customer profile after the payment is processed using the transaction id that works, but we cannot refund the transaction using the customer payment profile, since they are not linked together. This is where we get the error (The original transaction was not issued for this payment profile)
How should we proceed to have a customer payment profile linked to a transaction using opaque data that can be re-used?
Thanks
07-02-2020 03:49 PM
Anyone has any idea on how to do this?
I am using the C# SDK version 1.9.4
Is this issue solved with later releases?
I am including the code as a reference:
----------------------------------------------
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.PRODUCTION;
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// define the merchant information (authentication / transaction id)
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
{
name = apiLoginId,
ItemElementName = ItemChoiceType.transactionKey,
Item = transactionKey,
};
//set up data based on transaction
var opaqueData = new opaqueDataType { dataDescriptor = dataDescriptor, dataValue = dataValue };
var paymentType = new paymentType { Item = opaqueData };
customerProfilePaymentType profileToCreate = new customerProfilePaymentType();
profileToCreate.createProfile = true;
profileToCreate.createProfileSpecified = true;
string tType = transactionTypeEnum.authCaptureTransaction.ToString();
var transactionRequest = new transactionRequestType
{
transactionType = tType,
amount = amount,
payment = paymentType,
profile = profileToCreate
};
var request = new createTransactionRequest { transactionRequest = transactionRequest };
// instantiate the contoller that will call the service
var controller = new createTransactionController(request);
controller.Execute();
// get the response from the service (errors contained if any)
var response = controller.GetApiResponse();
AuthNetSale result = new AuthNetSale();
//validate
if (response != null)
{
if (response.messages.resultCode == messageTypeEnum.Ok)
{
if (response.transactionResponse.messages != null)
{
result.success = (response.transactionResponse.responseCode == "1");
result.refId = response.transactionResponse.transId;
// The profileResponse is always null
if (response.profileResponse != null && response.profileResponse.customerProfileId != null)
{
result.profileId = response.profileResponse.customerProfileId;
result.paymentProfileId = response.profileResponse.customerPaymentProfileIdList[0];
}
else
{
// Here I am creating the profile after the transaction, but this profile is not linked to the original transaction so I cannot do a refund
CreateCustomerProfileFromTransaction(apiLoginId, transactionKey, email, result);
}
}
}
}
07-08-2020 05:54 PM
In case someone else stumbles on this issue, the solution is to provide the customer field. When doing so, the create profile will work an return a profile Id and paymentProfileListId.
Here are the steps missing to the original code:
var customerProfile = new customerDataType
{
id = "A unique id",
email = email,
type = customerTypeEnum.individual
};
var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
amount = amount,
payment = paymentType,
profile = profileToCreate,
customer = customerProfile
};
08-09-2020 04:51 PM