Listen for these events rather than waiting on a callback from the client. From the client side, on the client, the customer could close the browser window or quit the app before the callback executes, and malicious clients could manipulate the response.
We recommend handling the following events:
| Callback | Description | Payload |
|---|
onSuccess | Triggered when the payment is successful | { event: "success_callback", metadata: { preApproveId: string, externalTrxId: string }} |
onEvent | Triggered for various step events during the process. | { event: EVENT }. Refer to Widget Events |
onReject | Triggered when the user rejects the payment or when there is an error that does not allow the transaction to continue | { event: "error_callback" | "reject_callback", metadata: { preApproveId: string, externalTrxId: string, reason: REASON } } Refer to Reject Reasons |
| Event | Description |
|---|
idNumber_form | Client is ready to enter its identification number. |
loading_conditions | The widget is loading either right after being initialized with pre-evaluation or after the user enters their identification number |
installment_options | The user is shown the available installment options. |
check_condtions | The user is shown the chosen installment option conditions. |
payment_subscription | The user is subscribing PAC. |
auth_factor | The user is verifying their identity. For recurring users, two authentication factors must be validated. |
signature | The user is signing their contract. Only applies for first-time purchases. |
success | The user has successfully signed or authenticated and is shown the success screen with attached documents. |
reject | The user is redirected to an error or rejection screen and cannot proceed with the transaction. |
Reject Reasons​
The onReject callback can be triggered with different event types and reasons:
reject_callback reasons​
| Reason | Description |
|---|
RISK_REJECTED | The transaction was rejected due to risk assessment. |
USER_HAS_ACTIVE_LOAN | The user already has an active BNPL credit associated with their account. |
NOT_ENOUGH_AUTH_FACTORS | The user doesn't have sufficient authentication factors available, likely due to previously blocking them. |
AUTHENTICATION_MAX_ATTEMPTS_REJECTED | Maximum authentication attempts reached during the verification process. |
error_callback reasons​
| Reason | Description |
|---|
DEFAULT_ERROR | A generic error occurred during the process. |
CONTRACT_SIGNATURE_ERROR | An error occurred while signing the contract. |
TOKEN_EXPIRED | The session token expired after 10 minutes. |