cancel
Showing results for 
Search instead for 
Did you mean: 

Pre-Authorize Transaction ID Not Found

Developing with PHP ...

 

We want to use the following process flow:

 

1) Pre-authorize credit card
2) only if authorized: Create Profile
3) Charge card using pre-authorization Transaction ID

 

We can not test this process flow, because:

 

1) SANDBOX: Creates Transaction ID, but Transaction ID is not valid for charging
2) PRODUCTION (test mode): Does not return a Transaction ID

Thank you , in advance, for any guidance on how we can test this sequence of events.

 

Below is some of our code, in our attempt to use the above process flow.

 

==== TEST CODE ====
$tresponse = $cardAuthorized->getTransactionResponse();


[removed error-checking, for brevity][if (successful)]

 

$transactionid = $tresponse->getTransId();//"invalid" id in sandbox, nothing in production
$authcode = $tresponse->getAuthCode();

 

//then: create customer profile with good card info
$customerProfile = createCustomerProfile($custInfo);

 

//then: charge card using previous auth transaction id
$cardCapture = capturePreviouslyAuthorizedAmount($transactionid);

 

//cardCapture always fails with (something like) "Invalid Transaction Id" or "Missing Transaction Id"

 

==== END TEST CODE ====

hmsauthorize1
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Hello @hmsauthorize1 

 

If I understand your question, your desire is to charge a card and create a customer profile if successful.  Is that correct?

 

If so, the simplest method we be to use createTransactionRequest and set createProfile = True.  If your initial transaction is successful, then a customer profile is created.

 

Another option is to create a customer profile with payment details and set validation mode = liveMode.  This will store the card and attempt a zero dollar transaction to confirm payment details are valid.  You can then use the customer profile for your transaction.

 

Note: our Sandbox and Production systems are completely separate.  While testing in the sandbox, you should be in live mode.  In production, setting the gateway to test mode will only confirm credentials, no actual transactions will be attempted.

 

Richard

View solution in original post

RichardH
Administrator Administrator
Administrator
3 REPLIES 3

Hello @hmsauthorize1 

 

If I understand your question, your desire is to charge a card and create a customer profile if successful.  Is that correct?

 

If so, the simplest method we be to use createTransactionRequest and set createProfile = True.  If your initial transaction is successful, then a customer profile is created.

 

Another option is to create a customer profile with payment details and set validation mode = liveMode.  This will store the card and attempt a zero dollar transaction to confirm payment details are valid.  You can then use the customer profile for your transaction.

 

Note: our Sandbox and Production systems are completely separate.  While testing in the sandbox, you should be in live mode.  In production, setting the gateway to test mode will only confirm credentials, no actual transactions will be attempted.

 

Richard

RichardH
Administrator Administrator
Administrator

Thank you for your response. I am confident your first solution will work, for us.

 

Using the API (link is here) and sdk-php-2.0.0, I added this to the "chargeCreditCard" sample PHP code, just before the $duplicateWindowSetting definitions:

 

// Save customer profile and payment profile
$customerProfile = new AnetAPI\CustomerProfilePaymentType();
$customerProfile->setCreateProfile("true");// or just the boolean with no quotes

 

I am getting back an empty profileResponse, no profile is being created, and no errors thrown.

 

ETA: Here's what's in the response array:

 

[profileResponse:net\authorize\api\contract\v1\CreateTransactionResponse:private] =>

 

What is the correct way/location to setCreateProfile so a new profile is created after a successful transaction, please?

 

Thank you. I appreciate any advice on what is likely something simple of which I am ignorant.

Yep ... something simple, because I'm ignorant ... this problem has been solved.

 

I wasn't adding the new information to the transaction request.

 

To sum up: First, I create the profile object and set "createProfile" to "true":

 

$customerProfile = new AnetAPI\CustomerProfilePaymentType();
$customerProfile->setCreateProfile(true);

Then, I added this line amongst the others that build the transactionRequestType:

 

$transactionRequestType->setProfile($customerProfile);

 

There we go! Profile created when transaction is successful.

Thanks, again. I'm sure I will miss some more stuff, soon. :)