---
updatedAt: 2025-12-09T09:43:43.000Z
agentTools:
  projectIndex: https://developers.paygreen.fr/llms.txt
---

# Payment Flow

How PaygreenJS handle payment

PaygreenJS works with a system of PaymentFlow. The purpose of this guide is to explain what is a payment flow and how PGJS handle them.

## What is a Payment Flow?

A payment flow is a PGJS concept that tracks a single payment attempt.
It contains information such as:

* Chosen payment method
* Status
* Amount
* And other details

When a payment flow is created:

* It has no payment method defined (except the first flow if you set it using the paymentMethod option at init).
* No payment form is displayed until a method is set.
* You can change the method using setPaymentMethod().

> Payment flows are mainly used in payment mode.

<br />

## How Are They Used?

PGJS creates a new payment flow each time the buyer attempts a payment until the total amount of the payment order is reached.

* For multiple payment methods (e.g., bank card + meal voucher), each method will have its own payment flow.

<br />

## Cases Where the Flow Logic Stops

PGJS may break the flow logic in these situations:

1. The `max_operation` of the payment order is reached.
2. `partial_allowed` is true, and a first flow is successful.
3. The payment order status changes to something other than `pending`.

<br />

## Important Notes

* The amount of a payment flow is `null` until the status is `success`. The exact authorized/captured amount is only known after the API responds.
* You can get additional flow details by parsing the *payment order operations* (using the `status` method).

<Image align="center" alt="419" border={false} src="https://files.readme.io/ef7bdd382439c9cf5325ca7cdd05fc0c39b69c97d14949cbcf482a9cd4006f9e-flow.png" title="pgjsflowchart.png" />