cancel
Showing results for 
Search instead for 
Did you mean: 

Created customer profile and payment profile but cant charge profile with credit card

Team - Have been able to verify that the customer profile and payment profile are visible in sandbox.authorize.net..  The test credit card is visible in the profile but when I try to charge it I receive error E00040: Customer Profile ID or Customer Payment Profile ID not found.  Below is code:

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;

// define the merchant information (authentication / transaction id)
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
{
name = APILOGINID,
ItemElementName = ItemChoiceType.transactionKey,
Item = APITRANSATIONKEY
};

//create a customer payment profile
//create a customer payment profile
customerProfilePaymentType profileToCharge = new customerProfilePaymentType();
profileToCharge.customerProfileId = customerProfileId;
profileToCharge.paymentProfile = new paymentProfile { paymentProfileId = paymentProfileId };

var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), // refund type
amount = Amount,
profile = profileToCharge
};

var request = new createTransactionRequest { transactionRequest = transactionRequest };

// instantiate the collector 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();

1 REPLY 1

Hello @Codemonkeys2019 

 

If you are creating customer profile and then immediately running a charge, there can be a short delay before the customer profile is available.  Creating a customer profile is done realtime, but follow-on transactions like charging a customer profile use replicated data for performance reasons.

 

If you need to create a transaction AND create a customer profile, you might consider creating transaction request and set createProfile=true.  If the transaction is successful, a customer profile is returned in the transaction response which you can store in your system.

 

Richard

RichardH
Administrator Administrator
Administrator