cancel
Showing results for 
Search instead for 
Did you mean: 

Sample PHP for adding order description

  I'm sure it's lack of sleep, but I can't seem to fugure out how to add an order description to "Charge A Card" in PHP.

 

This one didn't throw any errors, but it it didn't add the description to the email receipt either.  The part that is confusing is... Do I need to setup the new Anet part (and did I do it correctly) or would the description just fit into an existing part of the code sample for Charge A Card?  I guess I'm not sure on which ones get their own Anet setup and what keyword to use for each top level section.  I've seen some that show a single word in the API documentation, but then have 2 words in the Anet setup.  It would be nice if there was a key in the samples that shows every option and where it goes under or how it plugs in. Anyway, my code is below and again is not working to add the description to the order.

 

 

  $orderInfo = new AnetAPI\OrderType();
  $orderInfo->setDescription("This is the product description");

 

I realize the API sample code should be enough to build upon, but the naming and plugging in of the additional fields/choices into the API are not easy to do if you have not worked with this type of data before. Any guidance would be appreciated. 

 

Thank you!

altdev
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Hi there,

 

Just updated the sample, I think you were almost there, the order object probably wasn't added to the transaction object before the request.

 

https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/charge-credit-card.p...

 

We're planning to generate some PHP Docs as a supplement to the Sample code.

 

Thanks for the feedback,

 

Brian

View solution in original post

brianmc
Administrator Administrator
Administrator
2 REPLIES 2

Hi there,

 

Just updated the sample, I think you were almost there, the order object probably wasn't added to the transaction object before the request.

 

https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/charge-credit-card.p...

 

We're planning to generate some PHP Docs as a supplement to the Sample code.

 

Thanks for the feedback,

 

Brian

brianmc
Administrator Administrator
Administrator

Thank you very much!  Yeah, I missed the final piece to plug it in.  I had it in the code originally, but for some reason I had that line commented.  :) I really appreciate the clarification.