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
/sandboxin 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 buyer | What Wafeq e-invoicing ASP does |
|---|---|
A test buyer: a TIN that starts with 19992 or 19993 | What the digits of the TIN say. Refer to Test buyers. |
| A taxpayer in Sandbox | Simulates the delivery. The taxpayer receives a copy. Refer to Receive a document in the Sandbox. |
| Any other buyer, for example a TIN that you invent | Treats the buyer as not on Peppol, and uses the FTA-only route, as in Live. |
No customer.id | Uses 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,98or99). Such a document is never delivered, as in Live: a queued submission (Prefer: respond-async) fails with the codereporting_only_requires_acceptance, a submission without that header and a check answersmp_lookup_failed, and a file import holds it asnot_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.statusevents of a simulated delivery containsimulated: 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 endsattention_required, as in Live. The answer comes as adocument.statusevent, as in Live, and it sets thedelivery_status. Refer to Test buyers. - For a taxpayer in Sandbox,
delivery_statusbecomesdelivered_confirmedwhen the app of the buyer's organization fetches the document within 2 minutes, andforwardedwhen 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:
- When Wafeq e-invoicing ASP accepts the document,
tdd_statusisreporting. - Approximately 5 seconds later, Sandbox accepts the report.
tdd_statuschanges toreported. - Your organization receives a
document.reportedevent withdata.tax_authority_status: REPORTED. An accepted report has nodata.detail, as in Live.
This document.reported event is a real event, not a test event:
testisfalse, andenvironmentissandbox.datahas the same fields as in Live, and alsosimulated: 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 answersBy 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
- For the side of the buyer, refer to Receive a document in the Sandbox.
- To test each answer of the FTA, use the test buyers.
Updated 4 days ago