P4 Software / cifraHQ

Withholding Agent Guide

Withholding Agent Guide

This guide is for AP clerks and tax accountants at a tenant designated as an ITBMS withholding agent under DGI Resolución 201-8055.


Prerequisites

Before any certificate can be issued, the administrator must complete the following (one-time):

  1. Go to Accounting → ITBMS Withholdings (Settings)
  2. Enable Designated ITBMS Withholding Agent
  3. Enter the Designation Reference (e.g., "Resolución 201-8055 / 2026-2027")
  4. Set Effective From to the start of your designation period
  5. Confirm Retention Rate is 50% (the DGI default)
  6. Select the ITBMS Withheld Payable Account (a liability account in your CoA - typically a 2-04-xx code)
  7. Optionally enable Automatically Email Certificate to Supplier

See the Administrator Guide for details.


The flow at a glance

You receive a vendor bill with ITBMS  →  You post a payment for that bill
                                              ↓
                                  CifraHQ calculates 50% retention
                                              ↓
                          Certificate issued + GL posted + PDF emailed
                                              ↓
                          End of month: generate Formulario 4331
                                              ↓
                                Upload CSV to DGI e-Tax 2.0

Which Vendors trigger a retention

A retention is generated automatically only when all of these conditions are true at the time you post the payment:

Gate Where to set it What it does
Agent designation is enabled Accounting → ITBMS Withholdings (Settings) Master switch for the entire module
Payment date is inside your effective window Accounting → ITBMS Withholdings (Settings) Honors biennial designation cycles
The vendor is marked Subject to ITBMS withholding Vendor detail → Withholding section Per-vendor opt-in/out
The vendor's Tax Domicile is Panama Vendor detail → Withholding section Automatically excludes foreign Vendors
The source bill has at least one ITBMS-bearing line Bill detail Nothing to withhold from a zero-ITBMS bill

Miami / US / Mexican / Canadian Vendors are excluded by default. When you set Tax Domicile to anything other than Panama, Subject to ITBMS withholding automatically turns off.


Step-by-step: post a payment that triggers a retention

  1. Post the vendor bill normally. Make sure it has correct ITBMS tax lines (7%, 10%, or 15% as applicable).
  2. Create a Bill Payment for that bill. Set the posting date and payment amount.
  3. Post the payment. The retention engine runs in the background within a few seconds and:
    • Creates a RetentionCertificate row with a sequential number (e.g., RT-00000001)
    • Posts a Journal Entry: DR your AP account, CR the ITBMS Withheld Payable account
    • If Automatically Email Certificate to Supplier is enabled and the vendor has an email on file, the PDF is delivered

The payment itself is unaffected - it posts at the gross amount. The retention is a separate document so your AP aging stays clean.


Viewing issued certificates

There are three places you can find an issued certificate:

1. The Bill Payment detail page (most common)

When you open a posted Bill Payment that triggered a retention, you'll see a Withholding Certificate panel on the right sidebar. The panel shows:

Field What it tells you
Certificate Number The sequential number assigned at issue time (e.g., RT-00000007)
Issue Date The retention's trigger date - usually the payment's posting date
Total Withheld The dollar amount retained from the supplier (50% of ITBMS)
Supplier The vendor's legal name and the email the certificate was sent to
Status Issued / Voided
Delivery Email - delivered {timestamp} once the auto-send job finishes, or Not yet delivered if the email is still queued or failed
Storage Azure Blob (PDF uploaded to the tenant's container) or Local fallback (Azure was unavailable; click Resend to retry)

The panel has three action buttons:

  • Reprint PDF - opens a fresh PDF in a new browser tab. The render uses live data from the current template + current supplier details every time, so a brand update or a corrected legal name shows on the reprint without re-issuing the certificate.
  • Resend by email - re-enqueues the delivery job for the same supplier email. Use this when the supplier says the auto-email never arrived. The job re-renders the PDF, re-uploads to Azure if the previous attempt landed only locally, and re-sends.
  • Copy verification URL - copies the public https://verify.CifraHQ.cloud/cert/{token} URL to your clipboard, ready to paste into a chat or follow-up email.

If the payment did not trigger a retention (foreign vendor, no ITBMS on the bill, etc.), the panel simply does not appear. There is no error and no empty card - the right sidebar just shows the regular payment fields.

2. Form 4331 list page

Accounting → Form 4331 rolls up every period's totals: supplier count, certificate count, taxable base, ITBMS invoiced, ITBMS withheld, status, and a per-period CSV export. Drill into a row to see all certificates issued in that month and their state.

3. Direct download URL

For programmatic access, every certificate exposes:

GET /api/RetentionCertificate/Download?id={certificateId}

The response is a fresh PDF stream (application/pdf). This is the same renderer the Reprint PDF button uses - handy for scripts, archival jobs, or supplier portals.


Reprinting and resending - deep dive

Two scenarios drive almost all reprint/resend traffic:

Scenario A: "The supplier says they never got the email"

This is the most common case. The auto-email is sent immediately after the retention posts, but mail can land in spam, bounce on a typo'd address, or be quietly dropped by an over-eager filter at the supplier's MX.

Resolution steps:

  1. Open the Bill Payment detail
  2. In the Withholding Certificate panel, verify the Supplier email column shows the right address. If it's wrong, fix the vendor record (Vendor detail → Email) before clicking Resend - the resend uses the current email on file.
  3. Click Resend by email. The button briefly shows a spinner; on success a toast confirms "Resent to ".
  4. Refresh the page after ~30 seconds. The Delivery row should update to Email - delivered {new timestamp}.
  5. If the supplier still doesn't see it, click Reprint PDF and forward the PDF manually as an attachment.

The certificate row in the database is immutable for compliance - the issue date, number, amount, and verification token never change. But the rendered PDF is always built from live data at request time:

  • The template comes from the current PrintReports row, so a template update (uploaded via the Stimulsoft designer) is picked up instantly.
  • The tenant brand block (logo, RUC, address) comes from the current Settings → Company values.
  • The supplier block (name, RUC, address) comes from the current vendor record.

So if you re-brand the company logo or correct a typo in a supplier's legal name, just click Reprint on each affected certificate. No re-issue, no new sequence number, no new GL entry.

Why Resend re-uploads the PDF to Azure

When the PDF render succeeds but the Azure blob upload fails (network blip, storage account permissions, account key rotation), the system falls back to a local:// storage marker. The certificate row still shows Issued and the email may still send, but the archived PDF is only on the worker that handled the request.

Resend explicitly clears the local:// marker before re-running the job, forcing a fresh PDF render and a fresh Azure upload. After Resend, the Storage row should read Azure Blob - at that point the PDF is durably stored in the tenant's container and survives worker recycles.

What the user does NOT need to do

  • You do not need to void and re-issue a certificate to fix a typo in the supplier's brand block.
  • You do not need to re-trigger the retention engine to refresh the email - Resend handles that.
  • You do not need to manually attach the PDF to an email - let Resend deliver it through the same auto-email path; that way the audit log records the delivery.

What the certificate PDF contains

The PDF (Spanish by default for Panama tenants) includes:

  • Your tenant brand (logo + company name + RUC)
  • Certificate number and issue date
  • Supplier (proveedor retenido) name and RUC
  • Source invoice number and CUFE
  • Per-bucket detail: rate, taxable base, ITBMS invoiced, ITBMS withheld
  • Total withheld in USD (displayed as "B/.")
  • Verification URL and token: https://verify.CifraHQ.cloud/cert/{token}
  • DGI compliance footer

Suppliers can verify any certificate by visiting the URL (public, no login).


When and how to void a certificate

You can void a certificate before the period is closed. Voiding:

  • Flips the certificate status to Voided
  • Posts a reversal Journal Entry (flipped DR/CR with the same amounts)
  • Emits a void notice (the audit log records the reason)

After the period is closed (state Submitted), voiding is blocked. Use the Amendment workflow on the Form 4331 instead.


Generating Formulario 4331 at month-end

  1. Go to Accounting → Form 4331
  2. Click Generate
  3. Pick the Year and Month for the period
  4. Click Validate first - the system checks:
    • No retentions are still in Draft state
    • Every issued retention has a certificate row
    • The GL "ITBMS Withheld Payable" balance equals the sum of certificate amounts
  5. If validation passes, click Generate. The return is created in Draft state.
  6. Click CSV on the row to download the export - provisional column layout per ADR-007, pending DGI's confirmed e-Tax 2.0 spec.
  7. The response includes an X-Form4331-Hash SHA-256 header. The same hash is persisted on the return for audit.

Uploading to DGI e-Tax 2.0

  1. Log into e-Tax 2.0 with the agent's RUC credentials.
  2. Navigate to Formulario 4331 monthly declaration.
  3. Upload the CSV exported from CifraHQ.
  4. On confirmation, return to CifraHQ, open the Form 4331 row, click Submit, and enter the DGI confirmation number.
  5. The return moves to Submitted state and the period is locked.

Filing deadline: the 15th of the month following the filing month. Late filings incur a minimum USD 10 penalty plus interest.


Troubleshooting

Symptom Likely cause What to do
Payment posted but no Withholding Certificate panel Vendor has Subject to ITBMS withholding = false, or Tax Domicile ≠ Panama, or the bill had no ITBMS lines Verify the vendor record. If the vendor is correctly flagged, the bill probably had no ITBMS lines - nothing to withhold from.
Payment posted, vendor is correct, but the panel still shows nothing The retention job is still running, or hit an error mid-issue Refresh after 30 seconds. If the panel still doesn't appear, see "Orphan recovery" in the Administrator Guide.
Panel shows the cert but Storage reads Local fallback Azure blob upload failed (transient network issue, storage account permission rotation, etc.) Click Resend by email - it forces a fresh PDF render plus a fresh Azure upload.
Panel shows the cert but Delivery reads Not yet delivered after a minute Email delivery job failed or is still queued Click Resend by email; verify the supplier email is correct first.
Supplier Reports the email never arrived Spam filter or bounced address Verify and fix the vendor email if needed, then click Resend by email. If the supplier's MX rejects ours, click Reprint PDF and forward manually.
Reprint button Returns an error about template render The Stimulsoft template wasn't seeded into this tenant DB Ask the admin to run POST /api/WithholdingTemplateSeeder/Seed (see Administrator Guide).
"GL/subledger mismatch" during 4331 validation A retention was issued but the GL accounts on the tenant config are not set Open Accounting → ITBMS Withholdings (Settings) and pick the ITBMS Withheld Payable account.
Form 4331 generation refused One of the close-validation rules failed Click Validate first - the dialog lists every reason.
Period close blocked by "uncertified retention" warning A retention row exists with no matching certificate (orphan) See "Orphan recovery" in the Administrator Guide.

Was this page helpful?