Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Member
Posts: 4
Registered: ‎04-14-2011

PHP SDK - How to add order tax amount

I cannot find any documentation on how to add the amount of tax for an order.

 

https://developer.authorize.net/api/reference/index.html#payment-transactions - Nothing here shows an example with tax being passed.

 

I need to be able to populate this data here: https://share.getcloudapp.com/6quxBj1G

Highlighted
Member
Posts: 3
Registered: ‎12-16-2020

Re: PHP SDK - How to add order tax amount

Same issue. Throws an error if I don't set tax in production mode, but there's no way to set tax according to the php docs.

Member
Posts: 3
Registered: ‎12-16-2020

Re: PHP SDK - How to add order tax amount

Figured it out, their documentation is terrible and Authorize.net basically has zero support.

Here's what I had to update from their example, by digging through the libraries code. The first 3 lines and the last line are whats needed. Insane that tax only needs to be set when not using sandbox mode.

 

$tax = new AnetAPI\ExtendedAmountType();
$tax->setName('tax');
$tax->setAmount('0.00');

$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType("authCaptureTransaction");
$transactionRequestType->setAmount(request('amt'));
$transactionRequestType->setTax($tax);

 

Member
Posts: 1
Registered: ‎09-06-2021

Re: PHP SDK - How to add order tax amount

I've been struggling with the same thing for the past four hours or so. The code doesn't seem to work, and I'm kinda lost. I will give it another go tomorrow, but if the issue is still there, could anybody please help me out? Speaking of taxes, I got to file my tax return for the year, and I'm looking for a trusted paystub I could use. I reflected upon a few options, and this one seemed like a good one https://www.thepaystubs.com/. What do you guys think? I'm also willing to consider other alternatives, so please feel free to share them with me. Thanks in advance!