电子发票

  1. $config = [
  2. 'corp_id' => 'xxxxxxxxxxxxxxxxx',
  3. 'secret' => 'xxxxxxxxxx',
  4. //...
  5. ];
  6. $app = Factory::work($config);

查询电子发票

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

API:

  1. mixed get(string $cardId, string $encryptCode)

example:

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

批量查询电子发票

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

API:

  1. mixed select(array $invoices)

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

example:

  1. $invoices = [
  2. ["card_id" => "CARDID1", "encrypt_code" => "ENCRYPTCODE1"],
  3. ["card_id" => "CARDID2", "encrypt_code" => "ENCRYPTCODE2"]
  4. ];
  5. $app->invoice->select($invoices);

更新发票状态

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

API:

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

{warning} $status: 发报销状态

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

批量更新发票状态

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

API:

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

example:

  1. $invoices = [
  2. ["card_id" => "CARDID1", "encrypt_code" => "ENCRYPTCODE1"],
  3. ["card_id" => "CARDID2", "encrypt_code" => "ENCRYPTCODE2"]
  4. ];
  5. $openid = 'oV-gpwSU3xlMXbq0PqqRp1xHu9O4';
  6. $status = 'INVOICE_REIMBURSE_CLOSURE';
  7. $app->invoice->batchUpdate($invoices, $openid, $status)