With the Square Connect API, is it possible to assign a Sales Tax Fee at Item Creation? I don't see how in the documentation, besides making a second call after the item has been created. Seems kind of weird since it's possible to retrieve item details and fees in one get, but you can't create in one post.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It is not currently possible to assign fees to an item when you create it. As you describe, followup calls to the Apply Fee endpoint are required.
I have reported this limitation to the Connect API engineering team.
回答2:
You need to use two APIs.
1. Create Item API
2. Then pull item id from create item response API.
then you need to use my script:
$squareCred = array( 'Authorization: Bearer your_auth_token', 'Content-Type: application/json' ); $apiUrl = 'https://connect.squareup.com/v1/{{location_id}}/items/{{item_id}}/fees/{{fee_id}}';
$chbig = curl_init($apiUrl);
curl_setopt($chbig, CURLOPT_TIMEOUT, 60);
curl_setopt($chbig, CURLOPT_HTTPHEADER, $squareCred);
curl_setopt($chbig, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($chbig, CURLOPT_SSL_VERIFYPEER, 0 );
curl_setopt( $chbig, CURLOPT_SSL_VERIFYHOST, 0 );
curl_setopt( $chbig, CURLOPT_RETURNTRANSFER, 1 );
$Squresult = curl_exec($chbig);
标签:
square-connect