Reply
Highlighted
Member
Posts: 7
Registered: ‎10-07-2014
Accepted Solution

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!


Accepted Solutions
Highlighted
Solution
Accepted by topic author altdev
‎05-04-2016 11:45 AM
Administrator
Posts: 149
Registered: ‎03-28-2014

Re: Sample PHP for adding order description

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


All Replies
Highlighted
Solution
Accepted by topic author altdev
‎05-04-2016 11:45 AM
Administrator
Posts: 149
Registered: ‎03-28-2014

Re: Sample PHP for adding order description

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

Highlighted
Member
Posts: 7
Registered: ‎10-07-2014

Re: Sample PHP for adding order description

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.