Rápido Pagos

Record e-NCF ranges

Record the ranges of e-NCF that the DGII authorizes, follow how many numbers are left and cancel the ones you will not use.

An e-CF takes its number, the e-NCF, from a range that the DGII authorized for its type. Record your ranges before you issue. Every call on this page needs an API key of your organization and an issuer. Without an issuer, the calls answer 403 with kind ecf-issuer-not-configured.

Get your ranges from the DGII

The DGII authorizes e-NCF in ranges, one type per range.

  • In production, request your ranges in the Oficina Virtual, under the Solicitudes menu and its Comprobantes Fiscales option. The answer appears under Consultas, in Solicitudes de Comprobantes (Aviso 25-24).
  • In test, the DGII enables the numbers 1 to 10,000,000 of every type, and 1 to 50,000,000 of type 32 (Preguntas Técnicas e-CF, question 28). Record the part of each range that you test with. The same document dates their expiry at December 31, 2025, so ask the DGII for the current date before you record it.
  • In certification, record a range of each type that the portal asks you to simulate.

A range is valid from its authorization to December 31 of the next year, and no e-CF can use it after that (Informe Técnico e-CF, section 7). An e-CF of type 32 or 34 carries no expiry date of its range (Formato e-CF), so its range takes none.

Record a range

POST /ecf-sequence records a range in the issuer's current environment.

const response = await fetch('https://api.rapidopagos.com/ecf-sequence', {
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    authorization: `Bearer ${process.env.PAYMENTS_API_KEY}`
  },
  body: JSON.stringify({
    type: '31',
    firstNumber: 1,
    lastNumber: 1_000,
    expiresOn: '2027-12-31'
  })
});
const sequence = await response.json();
  • firstNumber and lastNumber are the numbers of the range without the E and the type, from 1 to 9,999,999,999. An e-NCF is E, the type and the number padded to 10 digits, so the first e-CF of this range is E310000000001.
  • expiresOn is FechaVencimientoSecuencia, the last day that the DGII lets the range issue. Types 32 and 34 take no expiresOn, and every other type requires it.
  • A range that holds a number of another range of the same RNC, environment and type answers 409 with kind ecf-sequence-overlaps.

Follow your ranges

GET /ecf-sequence lists the ranges of the current environment, with nextNumber, remaining and a status.

statusMeaning
activeNumbers remain and expiresOn has not passed in Santo Domingo
exhaustedEvery number is taken
expiredexpiresOn has passed
cancelledA cancellation took every number of the range

Each e-CF takes the next number of the active range of its type with the lowest firstNumber. Two e-CF never get the same e-NCF, and a request that fails takes no number. When no active range of the type is left, POST /ecf answers 409 with kind no-ecf-sequence.

Two events warn you in time, each once per range. ecf-sequence.running-low comes when an e-CF takes a number and fewer numbers are left than 10% of the range's size or 100, whichever is larger. ecf-sequence.expiring comes from the daily check, 30 days before the expiresOn of an active range of the current environment.

Cancel numbers that you will not use

The DGII lets you cancel numbers that no e-CF used, and the number of an e-CF that was signed but never sent to the DGII or the buyer (Informe Técnico e-CF, section 4.10). The API sends the Anulación de e-NCF (ANECF) for you.

POST /ecf-sequence/{id}/cancellation cancels the unused end of a range, from fromNumber to its last number. fromNumber defaults to nextNumber.

const response = await fetch(`https://api.rapidopagos.com/ecf-sequence/${sequenceId}/cancellation`, {
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    authorization: `Bearer ${process.env.PAYMENTS_API_KEY}`
  },
  body: JSON.stringify({
    fromNumber: 901
  })
});
  • No e-CF takes a number from fromNumber on, and remaining counts up to it. A range that loses every number reads cancelled.
  • A fromNumber that an e-CF already took answers 409 with kind ecf-sequence-number-used, and a tail that is already cancelled answers 409 with kind ecf-sequence-already-cancelled.
  • A cancellation that the DGII rejected, or that failed before any upload, leaves its numbers open, so you can cancel them again.
  • A cancelled number stays in its range, so a new range that holds it answers 409 with kind ecf-sequence-overlaps.

POST /ecf/{id}/cancellation cancels the e-NCF of an errored e-CF that was never sent, and answers 201 with the cancellation. A second call answers 200 with the same cancellation, unless the DGII rejected it or it failed before any upload, and then the call creates a new one. Any other e-CF answers 409 with kind ecf-not-cancellable.

Both calls answer 409 with kind ecf-issuer-certificate-unusable while the issuer's certificate is missing or expired, since the API signs the ANECF with it.

The DGII's answer sends ecf-cancellation.accepted, ecf-cancellation.partially-accepted when it cancels only some of the numbers, or ecf-cancellation.rejected. A cancellation that ends errored sends no event, and Rápido Pagos is alerted. The DGII has no cancellation service in certification, so both calls answer 409 with kind not-available-in-certification there.

On this page