Rápido Pagos

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"
}
  • issuedOn is FechaEmision. It defaults to today in Santo Domingo and is never in the future.
  • payment.type is TipoPago, 1 for cash, 2 for credit or 3 for free. A credit e-CF takes payment.dueOn, FechaLimitePago, which is never before issuedOn. Type 47 takes it as optional, and type 43 refuses it.
  • billingIndicator is IndicadorFacturacion, 1 for ITBIS at 18%, 2 for ITBIS at 16%, 3 for ITBIS at 0% or 4 for exempt.
  • quantity takes up to 2 decimals, and an e-CF takes 1 to 1,000 items.
  • discount on an item lowers its amount. With pricesIncludeItbis, each unitPrice includes the ITBIS.
  • totals are in DOP cents. taxable is MontoGravadoTotal, exempt is MontoExento, itbis is TotalITBIS and total is MontoTotal.

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."
}
TypeNameMain rules
31Factura de Crédito Fiscalbuyer.rnc and buyer.name
32Factura de ConsumoThe buyer is optional under RD$250,000
33Nota de Débitoreference to the document that it modifies
34Nota de Créditoreference, and no payment.methods
41Comprasbuyer.rnc, buyer.name, and retention on every item
43Gastos MenoresNo buyer, every item exempt, and payment optional
44Regímenes Especialesbuyer.name, and every item exempt
45Gubernamentalbuyer.rnc and buyer.name
46Exportacionesbuyer.name, and every item at ITBIS 0%
47Pagos al ExteriorNo 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.issuedOn must be the issuedOn of 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 rejected or errored takes no note, and the call answers 422 at reference.ncf.
  • The note waits until the DGII accepts that e-CF, and only then goes to the DGII. When that e-CF ends rejected or errored, or the note has waited 30 days, the note ends errored with the reason reference-not-accepted and 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.

StatuskindMeaning
403ecf-issuer-not-configuredThe organization has no issuer
403ecf-certificate-missingThe issuer has no certificate
403ecf-certificate-expiredThe issuer's certificate has expired
409no-ecf-sequenceNo active range of the type has a number left
409no-positive-exchange-rateA USD e-CF finds no positive exchange rate
422ecf-total-too-largeThe total in DOP cents is too large to compute exactly
422invalid-requestThe request breaks a rule, and error.issues names it

A request that answers an error creates nothing and takes no number.

On this page