Send a document in the Sandbox

Use this page to submit a document in Sandbox. Then see what happens to it: where it goes, its delivery and the answer to its report.

This page uses these terms:

  • Sandbox taxpayer: a taxpayer that Wafeq e-invoicing ASP makes in Sandbox. In a Sandbox document, it is the seller.
  • Test buyer: a buyer TIN that makes Sandbox give a chosen answer. Refer to Test buyers.
  • Report: the copy of the document for the FTA. Its status is tdd_status.
  • FTA-only route: Wafeq e-invoicing ASP reports the document to the FTA, but does not deliver it, because the buyer is not on Peppol.

Before you start

Connect a Sandbox taxpayer, and keep its Taxpayer ID and grant ID. Refer to Connect a Sandbox taxpayer.

Call the API

Call the API with your Sandbox API key and the IDs of the Sandbox taxpayer:

curl https://api.wafeq.com/ae/v1/invoices \
  -H "Authorization: Api-Key $SANDBOX_API_KEY" \
  -H "x-ae-taxpayer-id: $TAXPAYER_ID" \
  -H "x-ae-grant-id: $GRANT_ID"
  • Live and Sandbox use the same API address. The pk_test_ key sends the call to Sandbox.
  • Do not add /sandbox in front of API paths. Only the pages of the Wafeq e-invoicing ASP portal use this prefix. The test-buyer calls, GET /sandbox/test-buyers, are API paths of their own. Refer to Test buyers.

Wafeq e-invoicing ASP makes the e-invoice and runs the same checks as in Live. For the fields of the request, refer to Submit a document.

Where the document goes

Wafeq e-invoicing ASP does not look for the buyer on Peppol. The buyer in customer.id decides the route instead:

The buyerWhat Wafeq e-invoicing ASP does
A test buyer: a TIN that starts with 19992 or 19993What the digits of the TIN say. Refer to Test buyers.
A taxpayer in SandboxSimulates the delivery. The taxpayer receives a copy. Refer to Receive a document in the Sandbox.
Any other buyer, for example a TIN that you inventTreats the buyer as not on Peppol, and uses the FTA-only route, as in Live.
No customer.idUses the FTA-only route, with an FTA placeholder address. Refer to Submit a document (stage 3).

The FTA-only route needs an Idempotency-Key header, as in Live. Without it, Wafeq e-invoicing ASP refuses the submission with 422 idempotency_key_required.

Two documents have a route of their own, as in Live:

  • A self-billed document. Wafeq e-invoicing ASP simulates the delivery to the seller. The exception is a seller on an FTA placeholder address (0235:9900000097, 98 or 99). Such a document is never delivered, as in Live: a queued submission (Prefer: respond-async) fails with the code reporting_only_requires_acceptance, a submission without that header and a check answer smp_lookup_failed, and a file import holds it as not_found.
  • A deemed supply. It always goes to 0235:9900000097, whatever the buyer.

The delivery

Wafeq e-invoicing ASP sends nothing on Peppol. It simulates the delivery, also a queued delivery (Prefer: respond-async).

  • The document.status events of a simulated delivery contain simulated: true.
  • For a test buyer on Peppol, the D digit of the TIN sets the answer of the buyer's provider. The provider forwards the document to the buyer, confirms that the document reached the buyer, rejects it, or never answers. Or the handover fails. The L digit can also make the access point of the buyer answer every attempt with HTTP 503, or give a receipt that cannot be verified: a queued delivery then ends attention_required, as in Live. The answer comes as a document.status event, as in Live, and it sets the delivery_status. Refer to Test buyers.
  • For a taxpayer in Sandbox, delivery_status becomes delivered_confirmed when the app of the buyer's organization fetches the document within 2 minutes, and forwarded when it does not. Live works the same way for a buyer on Wafeq e-invoicing ASP. Refer to Receive a document in the Sandbox.

The report to the FTA

Wafeq e-invoicing ASP makes the report of each document, as in Live. It does not send the report to the FTA. Sandbox answers it instead:

  1. When Wafeq e-invoicing ASP accepts the document, tdd_status is reporting.
  2. Approximately 5 seconds later, Sandbox accepts the report. tdd_status changes to reported.
  3. Your organization receives a document.reported event with data.tax_authority_status: REPORTED. An accepted report has no data.detail, as in Live.

This document.reported event is a real event, not a test event:

  • test is false, and environment is sandbox.
  • data has the same fields as in Live, and also simulated: true.

Sandbox answers the reports of all the documents that you submit: invoices, credit notes, voids, documents on the FTA-only route, and documents from file imports. GET /invoices/{document_id}/reports shows the report and its answer.

📘

Other answers

By default, Sandbox accepts the report. Send the document to a test buyer to get another answer:

  • From the FTA: a rejection, a late answer or no answer.
  • From the buyer's provider: a forward, a confirmed delivery, a rejection or no answer. A test buyer also gives a failed handover, retries that run out (retry_exhausted), or a receipt that cannot be verified (invalid_receipt).
  • From Wafeq e-invoicing ASP itself: 503, 429, a failed submission or a slow answer.

Next