cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

PHP SDK - how to set Invoice Number

Hello,

I'm using PHP SDK to charge already created "Customer Porifle" in Authorize. My question is: "How to attach Invoice Number to a 

TransactionRequest"?

 

$profileToCharge = new AnetAPI\CustomerProfilePaymentType();
$profileToCharge->setCustomerProfileId($profileId);
$paymentProfile = new AnetAPI\PaymentProfileType();
$paymentProfile->setPaymentProfileId($paymentProfileId);
$paymentProfile->setCardCode($cvv);
$profileToCharge->setPaymentProfile($paymentProfile);

$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType("authCaptureTransaction"); 
$transactionRequestType->setAmount($amount);
$transactionRequestType->setProfile($profileToCharge);

$request = new AnetAPI\CreateTransactionRequest();
$request->setMerchantAuthentication($this->merchantAuthentication);
$request->setRefId($this->refId);
$request->setTransactionRequest($transactionRequestType);
$controller = new AnetController\CreateTransactionController($request);

$response = $this->executeRequest($controller);

 

boyandev
Member
1 ACCEPTED SOLUTION

Accepted Solutions

@boyandev 

 

 

 $orderType = new AnetAPI\OrderType();
 $orderType->setInvoiceNumber($invoiceNumber);
 $orderType->setDescription($description);
 $transactionRequestType->setOrder($orderType);
//I think you can omit the description. Try it and see.

 

If you find this post helpful, please mark it as the solution and hit the kudos button.

 

View solution in original post

Renaissance
All Star
4 REPLIES 4

@boyandev 

 

 

 $orderType = new AnetAPI\OrderType();
 $orderType->setInvoiceNumber($invoiceNumber);
 $orderType->setDescription($description);
 $transactionRequestType->setOrder($orderType);
//I think you can omit the description. Try it and see.

 

If you find this post helpful, please mark it as the solution and hit the kudos button.

 

Renaissance
All Star

Thanks you so much! It works!
Is it description required property for OrderType?

I don't think so. For the client that I wrote that script for, they used it.

 $orderType = new AnetAPI\OrderType();
 $orderType->setInvoiceNumber($invoiceNumber);
 $orderType->setDescription($description);
 $transactionRequestType->setOrder($orderType);
//I think you can omit the description. Try it and see.

 

If you find this post helpful, please mark it as the solution and hit the kudos button.

 

janetwilson
Member