# Callbacks

Callback functions passed in the `options` object to [Finix.PaymentForm()](/js/payment-form). Each callback fires in response to a specific form lifecycle event.

Fires once when the Payment Form iframe finishes loading. Takes no parameters.


```text
onLoad: function () { ... }
```

Use `onLoad` to show UI that depends on the form being ready — for example, enabling a custom submit button or hiding a loading spinner.

Fires every time the form state changes — field values, validation errors, focus and blur events, card brand detection, and payment method switching.


```text
onUpdate: function (state, binInformation, hasErrors) { ... }
```

| Parameter | Type | Description |
|  --- | --- | --- |
| `state` | `object` | Form state including metadata about which inputs are valid, dirty, or focused — does not expose payment data |
| `binInformation` | `object` | High-level BIN data such as BIN number and card brand |
| `hasErrors` | `boolean` | `true` if the form currently has validation errors — useful for enabling or disabling a custom submit button |


Fires when the form is submitted. Providing `onSubmit` in the options automatically renders a submit button inside the form.


```text
onSubmit: function (error, response) { ... }
```

| Parameter | Type | Description |
|  --- | --- | --- |
| `error` | `object | null` | Error object if submission failed; `null` on success |
| `response` | `object | null` | Response object containing the token data on success; `null` on error |


Use `onSubmit` when you want the form to render and manage its own submit button. For a custom button outside the form, use `form.submit()` [method](/js/form-instance) instead.

See [Token Response](/js/token-response) for the full response shape.