AI Agent Hub
Back to skills
Enterprise Invoice Collection and Download icon

Enterprise Invoice Collection and Download

Business Operations Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @user_bbae3f97/qixaingyun-tax-collection-skill following the guide at https://skillhub.cn/install/skillhub.md.

About this skill

Problem

Finance and Agent workflows often need to query input/output invoice data, but real calls depend on tax bureau or Qixiangyun sessions, enterprise account identity, nsrsbh, accountId, and short-lived Agent Grant values. Hand-rolled HTTP, saved browser state, or asking users to relay internal identifiers can cause cross-tenant session mixing, credential leakage, and concurrency bugs.

How the skill works

The skill routes four invoice tools through scripts/invoice_collection_workflow.py collect: query_input_output_invoice_info_auto, query_invoice_basic_info_auto, query_invoice_detail_aggregation_auto, and query_taxable_voucher_input_tax_transfer_out_auto. The first call creates a one-time login session instead of calling the invoice MCP directly. The Agent exposes only login_url to the user, runs internal waitArgv, waits for qxy.agent_login.completed, then restores nsrsbh, accountId, and a valid grant from the private flow before adding X-QXY-Agent-Grant and resuming. Multi-tenant agents should pass a stable private --login-context-id; --switch-account invalidates the old grant before a new login link is returned.

Boundaries and notes

  • Use a complete QXY_API_KEY; do not concatenate values across environment variables or .env files, and never print it.
  • Do not bypass the workflow with curl, manual HTTP, browser automation, or user-provided grants; mcp_client.py is mainly for service and schema inspection.
  • Login links default to 1 hour and grants to 24 hours, but tax bureau sessions may expire earlier.
  • A code=505069 authorization-expiry response is a non-retryable failed terminal state; do not re-login, retry, or store it as a successful call.

Use Cases

  • A finance Agent needs to query input/output invoices for an enterprise account and produce a checkable result.
  • When paginating basic invoice info, the skill resumes the flow and calls the basic-info tool.
  • When checking one invoice detail aggregation where detail and transfer tools also bind aggOrgId.
  • When verifying input-tax transfers for taxable vouchers, it calls the tool with a valid grant.

Best For

  • Backend engineers integrating invoice queries into finance Agents
  • Business developers debugging enterprise invoice aggregation pipelines
  • Architects isolating enterprise sessions in multi-tenant Agent platforms
  • Finance-system developers avoiding manual login state and grant handling