I'm trying to insert a tax in this example https://github.com/paypal/PayPal-PHP-SDK/blob/master/sample/invoice/CreateInvoice.php using the setTax function and I always get an error. Could you help me? Thank you in advance.
1条回答 默认 最新
doujiaoang69440 2015-02-24 18:24关注I have updated the sample code for create invoice to include tax into each item. You can read more about the specifics on tax in developer docs. As you can see, the tax field is present inside invoice_item. You can follow the sample code as shown below. To checkout the complete sample, visit here.
// #### Tax Item // You could provide Tax information to each item. $tax = new \PayPal\Api\Tax(); $tax->setPercent(1)->setName("Local Tax on Sutures"); $items[0]->setTax($tax);Now, if you run the samples in your local machine, and run SendInvoice, you would see the tax included in the response.

The invoice would look something like this:
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报