Assigning Fees To An Item On Creation

2019-09-17 02:18发布

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.

2条回答
劳资没心,怎么记你
2楼-- · 2019-09-17 02:40

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.

查看更多
▲ chillily
3楼-- · 2019-09-17 02:41

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);
查看更多
登录 后发表回答