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.
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.
Cases Where the Flow Logic Stops
PGJS may break the flow logic in these situations:
- The
max_operationof the payment order is reached. partial_allowedis true, and a first flow is successful.- The payment order status changes to something other than
pending.
Important Notes
- The amount of a payment flow is
nulluntil the status issuccess. 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
statusmethod).

Updated 4 days ago