Next.js developer in Lille

Next.js for businesses in Lille, delivered remotely by one developer.

Next.js developer

My place in the WordPress community

  • I have had a wordpress.org account since 2006.
  • I contributed to WordPress core for versions 7.0 and 7.1.
  • I maintain 30 plugins on wordpress.org.
  • I organise and speak at WordCamps.
  • I have attended every WordCamp Europe from 2017 to 2026.

My WordPress.org profile

Colonne de la Déesse on the Grand Place of Lille

The column of the goddess on Lille’s Grand Place, photographed by Velvet, licensed CC BY-SA 3.0, from Wikimedia Commons.

A company in Lille that bills a ministry, a state agency or a local authority sends those invoices through Chorus Pro. The platform can be used by hand on its portal, but a supplier with many public customers can submit invoices straight from its own back office through the Chorus Pro API on PISTE. I am Mariusz Szatkowski, a developer in Gdynia who builds Next.js back offices alone, remotely and in writing. This page is based on the Chorus Pro portal, its documentation articles and the PISTE API catalogue, read in French on 4 December 2026. It covers invoices to public buyers only (B2G). I am not a lawyer or an accountant, and invoice content stays your accountant’s call.

#What is Chorus Pro?

The Chorus Pro portal says public administrations adopted the platform to receive their suppliers’ invoices, to simplify life for companies and cut payment times. A news item of 7 January 2026 adds the history: since 1 January 2017 all administrations receive and exchange their invoices electronically through Chorus Pro, operated by the Agence pour l’informatique financière de l’État (AIFE). Administrations must use Chorus Pro to receive and process invoices, including invoice statuses.

The same news item says Chorus Pro keeps its role in the reform as the platform of the public sector, and will also issue electronic invoices from public bodies to VAT-registered businesses. The portal describes several ways in: the portal itself, accounting software that is connected, specialised portals or software, or an accountant or specialised company. A Next.js back office using the API is the software route.

I have not read the legal texts behind the obligation for this page, so it builds only on what the Chorus Pro and PISTE sites say.

#How does the API connection work?

The documentation article on API connection types names three set-ups:

Set-upWho needs a PISTE application and a Chorus Pro connectionTechnical accounts
Directthe supplier’s own structurethe supplier’s own
Software installed at each clientevery client separatelythe vendor collects them to configure the software
Hosted software for many clients (concentrator)only the concentratorone per partner

For a company that builds its own back office in Next.js, the direct route applies: the structure creates its own application on PISTE, a connection on Chorus Pro and a technical account. The article also says AIFE declines all responsibility if a software vendor attaches itself to its clients’ structures, and strongly advises against it for security reasons.

#What is a technical account?

The article on technical accounts defines it as a user account that represents your connected software towards Chorus Pro. It cannot be used to log in to the portal. It has the same rights as the principal manager of the structure, including on the other structures of that manager.

The account is created in the portal under the Raccordements domain, in the “Compte technique” application. Chorus Pro generates a login, a contact email and a password, and the account works 30 minutes after submission. When the password is reset, the new one is shown once and never sent again. A deactivated account can be reactivated within 60 days.

Two build rules follow. The password goes into a secrets store or a server-only environment variable the moment it appears. And because the account carries the principal manager’s rights, the back office should limit which users can trigger which API calls, since Chorus Pro will not.

#How do PISTE and OAuth2 fit in?

PISTE is the AIFE platform that publishes public sector APIs. Its home page says registration is required to consult the APIs, and registered users get keys to test APIs with sample code and test data before requesting keys for their own application. A dashboard shows consumption per API and per application.

The PISTE catalogue lists the Chorus Pro APIs under the cpro prefix: Factures, FacturesTravaux, Structures, Utilisateurs, Transverses, Engagements, EngagementJuridique and the Référentiel des Organisations. On the day I read it, the Factures and Structures entries were marked as not subject to approval.

The AIFE developer guide sets out the call. First the software gets an access token from PISTE with the OAuth2 client credentials grant, the client id and secret of its PISTE application and the scope openid. Then each Chorus Pro call sends that token as a bearer token, plus a header named cpro-account holding the technical account’s login and password, joined by a colon and encoded in base 64. The body is JSON, and the guide says the content must be encoded in UTF-8.

The hosts from the same guide, for access over the internet:

  • token, sandbox: sandbox-oauth.piste.gouv.fr/api/oauth/token
  • token, production: oauth.piste.gouv.fr/api/oauth/token
  • API, sandbox: sandbox-api.piste.gouv.fr
  • API, production: api.piste.gouv.fr

Calls from the French state’s interministerial network (RIE) use separate hosts under aife.finances.rie.gouv.fr. In Next.js the two calls belong on the server:

// lib/chorus.ts
import 'server-only'

const OAUTH = process.env.PISTE_OAUTH_URL!  // sandbox or production token URL
const API = process.env.PISTE_API_URL!      // sandbox or production API host

async function token() {
  const res = await fetch(OAUTH, {
    method: 'POST',
    headers: { 'content-type': 'application/x-www-form-urlencoded' },
    body: new URLSearchParams({
      grant_type: 'client_credentials',
      client_id: process.env.PISTE_CLIENT_ID!,
      client_secret: process.env.PISTE_CLIENT_SECRET!,
      scope: 'openid',
    }),
    cache: 'no-store',
  })
  return (await res.json()).access_token as string
}

export async function chorus(path: string, body: unknown) {
  const account = Buffer.from(
    `${process.env.CPRO_LOGIN}:${process.env.CPRO_PASSWORD}`,
  ).toString('base64')
  const res = await fetch(`${API}${path}`, {
    method: 'POST',
    headers: {
      authorization: `Bearer ${await token()}`,
      'cpro-account': account,
      'content-type': 'application/json; charset=UTF-8',
    },
    body: JSON.stringify(body),
    cache: 'no-store',
  })
  return res.json()
}

The request bodies come from the Swagger 2.0 files PISTE publishes for each API. I have not copied field names here; in a project I would take them from those files. The Next.js environment variables guide says only variables prefixed with NEXT_PUBLIC_ reach the browser, so none of these may carry that prefix. The Next.js data security guide adds that server-only stops server code from being imported into client components, and that an exported Server Action can be reached by a direct POST request, so any action that triggers an invoice needs its own authorisation check.

#How is an invoice submitted?

The Factures API (base path /cpro/factures) describes a nominal flow for a supplier:

  1. Call “Rechercher structure” with the SIRET of the public recipient to get its idStructureCPP.
  2. Call “Consulter structure” with that id to get the structure’s mandatory parameters: a commitment number, a service code, or both.
  3. Call the search for services of the structure to see its active services.
  4. Submit the invoice with /v1/soumettre, filling in all the data needed.

The Structures API (/cpro/structures) carries steps 1 to 3 with /v1/rechercher, /v1/consulter and /v1/rechercher/services. Step 2 matters most for a back office: when a public buyer requires a commitment number or service code, the order record has to hold it before the invoice is created, not after.

The Factures API also offers other routes in:

  • /v1/deposer/pdf uploads a PDF for character recognition; the invoice then has the status INTERPRETEE_OCR and is submitted with soumettreFacture. The PDF may not exceed 10 MB.
  • /v1/deposer/flux uploads an XML or PDF/A-3 file carrying the invoice data.
  • /v1/completer adds attachments or a comment to an invoice in status SUSPENDUE.
  • /v1/consulter/historique returns the event history and current status of an invoice.
  • /v1/telecharger/groupe downloads one or more invoices as XML, PDF or ZIP, up to 120 MB per download, beyond which the API returns error 413.

For a Next.js back office the history call is the backbone of status tracking. A scheduled job can read the status of every open invoice and store it next to the order, so the finance team sees in one screen which invoices a public body has suspended or rejected.

#What changed in Chorus Pro with the reform?

The documentation article on Chorus Pro changes for the e-invoicing reform lists dated changes that touch API code directly:

  • The status “A recycler” goes from 23 September 2026. The article says it is not in the AFNOR XP Z12-012 standard, so from that date an invoice with an error in the legal commitment, the recipient SIRET or the service code cannot be recycled; it is rejected and a new invoice is issued. In the API the status is translated into “rejetée”. Invoices already in that status and still held by the supplier may finish under the old rules. The PISTE page of the Factures API still listed the recycle method on 4 December 2026, so I would confirm the behaviour on qualification. Code that called /v1/recycler needs a new branch: on rejection, create a new invoice.
  • Scheduled for December 2026: credit notes need the original invoice number. Through the API, a credit note without it gets an error in the JSON response and is rejected.
  • Scheduled for February 2027: stricter supplier invoice numbers. The number has at most 20 characters, from digits, letters, space, hyphen, plus sign, underscore and slash. The new check rejects a number made only of spaces, starting or ending with a space, or holding consecutive spaces. It applies to the API call SoumettreFacture.

The article also notes that under the reform an invoice number must be unique per year and per SIREN. The February check is easy to run before the call:

// lib/invoice-number.ts
const ALLOWED = /^[0-9A-Za-z +_\/-]{1,20}$/

export function validChorusNumber(n: string) {
  return ALLOWED.test(n) && n.trim() === n && !n.includes('  ')
}

#Where do approved platforms come in?

The article on connections for approved platforms says that from 1 September 2026 a private company may entrust the transmission of its public-sector invoices to its approved platform, which then connects to Chorus Pro. For approved platforms those exchanges run only by EDI. A supplier therefore chooses between its own API connection and handing B2G invoices to its platform. The choice belongs to the finance team; the back office needs to know which route each public customer uses.

#How do I test before production?

PISTE creates sandbox applications, and the Chorus Pro API pages on PISTE list the prerequisites for using the sandbox with Chorus Pro data: a user account on the Chorus Pro qualification environment, a generated test data set, and an OAuth2 connection on qualification. The AIFE developer guide repeats the three steps for API calls in qualification: a data set, a connection to Chorus Pro and a technical account. The PISTE pages link to the Chorus Pro community site for these guides, and the same articles are in the documentation section of the Chorus Pro portal.

#Checklist for a Chorus Pro API connection

  • Decide between your own API connection and your approved platform for B2G invoices.
  • Create the PISTE application, the Chorus Pro connection and the technical account.
  • Store the client secret and technical account password in server-only variables.
  • Store SIRET, commitment number and service code with every public order.
  • Replace any recycle logic with reject and reissue.
  • Require the original invoice number on credit notes.
  • Validate invoice numbers against the February 2027 rule before submitting.
  • Test the full flow on qualification before switching hosts to production.

#How does a Chorus Pro project run?

  1. You send the back office stack, the number of public customers and whether your approved platform already handles B2G. My written reply comes on the next working day and lists the Chorus Pro accounts your team has to create, because I cannot create them for you.
  2. I write the scope with the submit flow, the status tracking and the reform changes, and the questions for your accountant.
  3. I build against the PISTE sandbox and the Chorus Pro qualification data, and your finance team checks test invoices and statuses.
  4. After written acceptance I switch the hosts to production with you and hand over the repository and a run book for token, password and status errors.

The invoice and status screens I design myself or build from your mock-ups, and the Next.js developer page lists what else I take on.

#Invoicing French public buyers from your own back office?

Send the back office stack, a list of your public customers’ SIRET numbers and how your code handles rejected invoices today through the contact page. The first written estimate is free, and it shows which Chorus Pro steps your team does in the portal and which the code takes over.

WordPress support & development in Lille

Need this service: Next.js developer in Lille?

Describe your project by e-mail. I reply within 24 hours.

Describe your project

Explore other WordPress services and knowledge base