Assigning Fees To An Item On Creation

北战南征 提交于 2019-12-12 00:26:36

问题


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);


来源:https://stackoverflow.com/questions/25693968/assigning-fees-to-an-item-on-creation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!