cancel
Showing results for 
Search instead for 
Did you mean: 

How to lookup customerProfileId and paymentProfileId by merchantCustomerId in PHP SDK?

I am building a tool to grant refunds for our support team. I have the merchantCustomerId, which is our internal user ID, and transactionId in our database.

 

I am able to pull the transaction details using the transactionId. 

 

 

require_once ($_SERVER['DOCUMENT_ROOT'] . DS . 'anet_php_sdk-1_8_5_1' . DS . 'autoload.php');
define("AUTHORIZENET_API_LOGIN_ID", "YOUR LOGIN");
define("AUTHORIZENET_TRANSACTION_KEY", "YOUR KEY");
define("AUTHORIZENET_SANDBOX", false);
$request = new AuthorizeNetTD;
$response = $request->getTransactionDetails($transactionid);
$transactionStatus = $response->xml->transaction->transactionStatus;
$authAmount = $response->xml->transaction->authAmount;

 

 

So then to void the transaction, I found this code:

 

$transaction = new AuthorizeNetTransaction;
$transaction->transId = $transactionid;
$response = $request->createCustomerProfileTransaction("Void", $transaction);
$this->assertTrue($response->isOk());
$transactionResponse = $response->getTransactionResponse();
$this->assertTrue($transactionResponse->approved);

 

Then to refund the transaction, I found this code:

 

 

$transaction = new AuthorizeNetTransaction;
$transaction->amount = $authAmount;
$transaction->customerProfileId = $customerProfileId;
$transaction->customerPaymentProfileId = $paymentProfileId;
$transaction->transId = $transactionid;
$response = $request->createCustomerProfileTransaction("Refund", $transaction);
$transactionResponse = $response->getTransactionResponse();
$transactionId = $transactionResponse->transaction_id;

 

 

So the only pieces of information I'm missing are the customerProfileId and the paymentProfileId. How can I look this up?

 

ericrmr
Member
1 REPLY 1

 

Hi ericrmr,

 

We do not currently provide the ability to search for customerProfiles using the merchantCustomerId through our API. The only way to get this information would be to pull the full list of customer profiles and iterate through them in order to tie them to your merchant customer ID. It is important that you always store the Authorize.Net assigned ID when establishing these profiles.

 

Thanks,

Joy

Joy
Administrator Administrator
Administrator