Issue an e-CF
Send the items of a sale, and the API computes the e-CF, numbers it and sends it to the DGII.
Every call on this page needs an API key of your organization, an issuer with a certificate and an active range of the type that you issue.
Send the e-CF
POST /ecf takes the type, the buyer, the payment and the items. The API computes every amount from the items, takes the next e-NCF and answers 201 with the e-CF pending. A workflow then signs it and sends it to the DGII (see Follow an e-CF).
const response = await fetch('https://api.rapidopagos.com/ecf', {
method: 'POST',
headers: {
'content-type': 'application/json',
authorization: `Bearer ${process.env.PAYMENTS_API_KEY}`
},
body: JSON.stringify({
type: '31',
externalId: 'order-12345',
payment: {
type: '1',
methods: [
{
method: '3',
amount: {
amount: 5_900_00,
currency: 'DOP'
}
}
]
},
buyer: {
rnc: '131880681',
name: 'Ferretería Pérez & Hijos, S.R.L.'
},
items: [
{
name: 'Cemento gris 42.5 kg',
goodOrService: '1',
billingIndicator: '1',
quantity: 10,
unitPrice: {
amount: 500_00,
currency: 'DOP'
}
}
]
})
});
const ecf = await response.json();{
"id": "5f2c8e1a-9b4d-4a7e-8c3f-2d6b0e9a1c47",
"externalId": "order-12345",
"type": "31",
"encf": "E310000000001",
"environment": "test",
"status": "pending",
"statusReason": null,
"issuedOn": "2026-10-19",
"buyer": {
"rnc": "131880681",
"name": "Ferretería Pérez & Hijos, S.R.L."
},
"currency": "DOP",
"totals": {
"taxable": { "amount": 500000, "currency": "DOP" },
"exempt": { "amount": 0, "currency": "DOP" },
"itbis": { "amount": 90000, "currency": "DOP" },
"total": { "amount": 590000, "currency": "DOP" }
},
"securityCode": null,
"signedAt": null,
"stampUrl": null,
"dgii": {
"trackId": null,
"messages": [],
"sequenceUsed": null
},
"buyerDelivery": {
"status": "pending",
"reason": null
},
"commercialApproval": {
"decision": null,
"reason": null,
"receivedAt": null
},
"createdAt": "2026-10-19T16:45:18.000Z",
"updatedAt": "2026-10-19T16:45:18.000Z"
}issuedOnisFechaEmision. It defaults to today in Santo Domingo and is never in the future.payment.typeisTipoPago,1for cash,2for credit or3for free. A credit e-CF takespayment.dueOn,FechaLimitePago, which is never beforeissuedOn. Type 47 takes it as optional, and type 43 refuses it.billingIndicatorisIndicadorFacturacion,1for ITBIS at 18%,2for ITBIS at 16%,3for ITBIS at 0% or4for exempt.quantitytakes up to 2 decimals, and an e-CF takes 1 to 1,000 items.discounton an item lowers its amount. WithpricesIncludeItbis, eachunitPriceincludes the ITBIS.totalsare in DOP cents.taxableisMontoGravadoTotal,exemptisMontoExento,itbisisTotalITBISandtotalisMontoTotal.
The rules of each type
Each type takes the fields that the Formato e-CF makes required for it, and refuses the fields that it forbids. A request that breaks a rule answers 422 with kind invalid-request, and each issue of error.issues names the field in its path. A type 31 without buyer.rnc gets this answer.
{
"success": false,
"error": {
"name": "ZodError",
"issues": [
{
"code": "custom",
"path": ["buyer", "rnc"],
"message": "buyer.rnc is required for a type 31"
}
]
},
"kind": "invalid-request",
"message": "The request failed validation. error.issues lists each problem."
}| Type | Name | Main rules |
|---|---|---|
31 | Factura de Crédito Fiscal | buyer.rnc and buyer.name |
32 | Factura de Consumo | The buyer is optional under RD$250,000 |
33 | Nota de Débito | reference to the document that it modifies |
34 | Nota de Crédito | reference, and no payment.methods |
41 | Compras | buyer.rnc, buyer.name, and retention on every item |
43 | Gastos Menores | No buyer, every item exempt, and payment optional |
44 | Regímenes Especiales | buyer.name, and every item exempt |
45 | Gubernamental | buyer.rnc and buyer.name |
46 | Exportaciones | buyer.name, and every item at ITBIS 0% |
47 | Pagos al Exterior | No buyer.rnc, every item an exempt service with retention.isr, and payment optional |
A type 32 whose total reaches RD$250,000 requires buyer.name and either buyer.rnc or buyer.foreignId. The field descriptions of POST /ecf list the other rules.
Debit and credit notes
A type 33 or 34 takes reference, the document that it modifies. reference.ncf is an e-NCF, or a paper NCF of series B or A, and reference.issuedOn is the date of that document.
{
"type": "34",
"externalId": "refund-12345-1",
"payment": { "type": "1" },
"buyer": {
"rnc": "131880681",
"name": "Ferretería Pérez & Hijos, S.R.L."
},
"items": [
{
"name": "Cemento gris 42.5 kg",
"goodOrService": "1",
"billingIndicator": "1",
"quantity": 2,
"unitPrice": { "amount": 50000, "currency": "DOP" }
}
],
"reference": {
"ncf": "E310000000001",
"issuedOn": "2026-10-19",
"modificationCode": "3",
"reason": "Devolución parcial"
}
}modificationCode is CodigoModificacion. 1 cancels the document, 2 corrects its text and 3 corrects its amounts. When reference.ncf names an e-CF of your issuer, these rules apply.
reference.issuedOnmust be theissuedOnof that e-CF.- The credit notes of an e-CF cannot add up to more than its total, and a note that would exceed it answers
422. - An e-CF that ended
rejectedorerroredtakes no note, and the call answers422atreference.ncf. - The note waits until the DGII accepts that e-CF, and only then goes to the DGII. When that e-CF ends
rejectedorerrored, or the note has waited 30 days, the note endserroredwith the reasonreference-not-acceptedand is never sent.
An e-CF in dollars
With currency USD, every amount of the request is in US cents, and each one carries currency USD. The API converts the e-CF at the latest USD exchange rate in effect, as POST /checkout does. totals are in DOP, and the e-CF carries the dollar amounts in its OtraMoneda section. Without a positive exchange rate, the call answers 409 with kind no-positive-exchange-rate.
Retries and errors
externalId is your ID of the e-CF, unique in your organization across every environment. A valid request with the externalId of an existing e-CF answers 200 with that e-CF and takes no number, whatever the rest of its body. Send an externalId with every e-CF, so that a retry after a lost answer never issues a second one. Use new IDs in production, since an ID that you used in test returns the e-CF of test.
| Status | kind | Meaning |
|---|---|---|
403 | ecf-issuer-not-configured | The organization has no issuer |
403 | ecf-certificate-missing | The issuer has no certificate |
403 | ecf-certificate-expired | The issuer's certificate has expired |
409 | no-ecf-sequence | No active range of the type has a number left |
409 | no-positive-exchange-rate | A USD e-CF finds no positive exchange rate |
422 | ecf-total-too-large | The total in DOP cents is too large to compute exactly |
422 | invalid-request | The request breaks a rule, and error.issues names it |
A request that answers an error creates nothing and takes no number.