电子发票

优质
小牛编辑
125浏览
2023-12-01
$config = [
    'corp_id' => 'xxxxxxxxxxxxxxxxx',
    'secret'   => 'xxxxxxxxxx',
    //...
];

$app = Factory::work($config);

查询电子发票

https://work.weixin.qq.com/api/doc

API:

mixed get(string $cardId, string $encryptCode)

example:

$app->invoice->get('CARDID', 'ENCRYPTCODE');

批量查询电子发票

https://work.weixin.qq.com/api/doc

API:

mixed select(array $invoices)

{info} $invoices: 发票参数列表

example:

$invoices = [
    ["card_id" => "CARDID1", "encrypt_code" => "ENCRYPTCODE1"],
    ["card_id" => "CARDID2", "encrypt_code" => "ENCRYPTCODE2"]
];

$app->invoice->select($invoices);

更新发票状态

https://work.weixin.qq.com/api/doc

API:

mixed update(string $cardId, string $encryptCode, string $status)

{warning} $status: 发报销状态

  • INVOICE_REIMBURSE_INIT:发票初始状态,未锁定;
  • INVOICE_REIMBURSE_LOCK:发票已锁定,无法重复提交报销;
  • INVOICE_REIMBURSE_CLOSURE:发票已核销,从用户卡包中移除

批量更新发票状态

https://work.weixin.qq.com/api/doc

API:

mixed batchUpdate(array $invoices, string $openid, string $status)

example:

$invoices = [
    ["card_id" => "CARDID1", "encrypt_code" => "ENCRYPTCODE1"],
    ["card_id" => "CARDID2", "encrypt_code" => "ENCRYPTCODE2"]
];
$openid = 'oV-gpwSU3xlMXbq0PqqRp1xHu9O4';

$status = 'INVOICE_REIMBURSE_CLOSURE';

$app->invoice->batchUpdate($invoices, $openid, $status)