Simulating Webhook events on the Sandbox environment
On Paag's Sandbox environment, you can simulate webhook events to test your integration with our platform. This feature allows you to test the behavior of your application when receiving different types of events.
For example, you can simulate a successful payment, a failed payment, a refund, and other events. This way, you can test your application's behavior in different scenarios without having to wait for real events to occur or spend real BRL money on the tests.
How to simulate a webhook event
When on the Paag Sandbox environment, your test account will generate QRCodes but they will not be valid for payments. Instead, there will be an URL that you can use to simulate a payment by accessing it on your browser. Let's see how to do it:
Simulating a successful payment
-
Make the usual request for deposit:
POST https://gateway.prd.pppay.cloud/api/pix/charge { "amount": 40, "merchant_transaction_id": "paag-dev-team-01", "first_name": "John", "last_name": "Doe", "email": "[email protected]", "document_number": "8989898989", "message": "Test transaction", "ip_address": "123.123.124.123", "phone_number": "+553634182141" }
-
Check the response for the
qrcode
field. It will contain the URL that you can use to simulate the payment, like so:{ "transaction": { "id": "5dd728f4-e3bb-4e58-980a-3fabf33b74f7", "merchant_id": "ea6b792b-ccb4-4d32-ba46-b7076c5acc42", "user_id": "402c797e-25a8-478b-884c-45b52d0c1a9f", "processor_id": "38eab077-c11d-4ffd-bef2-158fd082c8a7", "merchant_transaction_id": "paag-dev-team-01", "transaction_type": "pix", "first_name": "John", "last_name": "Doe", "email": "[email protected]", "updated_at": "2023-11-13T02:35:53+0000", "created_at": "2023-11-13T02:35:53+0000" "events": [ { "id": "19ab7283-cfc3-4353-af24-b646a0502582", "success": true, "event_type": "auth", "amount": "40.00", "ip_address": "123.123.124.123", "processor_transaction_id": "f48003eb-5ea2-491b-9b34-6d1761aa9256", "batch_id": null, "qrcode": "http://gateway.uat.paag.dev/api/transactions/f48003eb-5ea2-491b-9b34-6d1761aa9256/pay", "qrcode_image": "data:image/png;base64,...", "pix_key_type": null, "pix_key_value": null, "pix_message": "Test transaction", "updated_at": "2023-11-13T02:35:53+0000", "created_at": "2023-11-13T02:35:53+0000" } ], "document_number": "08476407602", "status": "pending", "flow_type": "cashin", "error": null, "e2e_id": null, "source": "player" } }
-
Access the URL in the
qrcode
field (http://gateway.uat.paag.dev/api/transactions/f48003eb-5ea2-491b-9b34-6d1761aa9256/pay
) on your browser. This will simulate a successful payment event. -
Find out the webhook event being set to on your application.
Simulating a successful withdrawal
-
Make the usual request for withdrawal:
POST https://gateway.prd.pppay.cloud/api/pix/pay { "merchant_transaction_id": "paag-dev-team-04", "amount": 120.00, "pix_key_type": "email", "pix_key_value": "[email protected]", "pix_message": "This is a test", "first_name": "John", "last_name": "Doe", "document_number": "88377748827281" }
-
Check the
qrcode
field on the response. It will contain the URL that you can use to simulate the withdrawal, like so:{ "transaction": { "id": "23ff136f-afe9-402e-904f-50b8547704d1", "merchant_id": "ea6b792b-ccb4-4d32-ba46-b7076c5acc42", "user_id": "402c797e-25a8-478b-884c-45b52d0c1a9f", "processor_id": "38eab077-c11d-4ffd-bef2-158fd082c8a7", "merchant_transaction_id": "paag-dev-team-04", "transaction_type": "pix", "first_name": "John", "last_name": "Doe", "email": null, "updated_at": "2023-11-13T02:35:53+0000", "created_at": "2023-11-13T02:35:53+0000" "events": [ { "id": "8aec44f1-f538-460e-873b-c82228b65d9b", "success": true, "event_type": "payment", "amount": "120.00", "ip_address": null, "batch_id": null, "qrcode": "http://gateway.uat.paag.dev/api/transactions/63f8c555-6b9e-41e9-97ac-53c6363de373/receive", "qrcode_image": "data:image/png;base64,...", "pix_key_type": "email", "pix_key_value": "[email protected]", "pix_message": "This is a test", "updated_at": "2023-11-13T02:35:53+0000", "created_at": "2023-11-13T02:35:53+0000" } ], "document_number": "08476407602", "status": "pending", "flow_type": "cashout", "error": null, "e2e_id": null, "source": "player" } }
-
Access the URL in the
qrcode
field (http://gateway.uat.paag.dev/api/transactions/63f8c555-6b9e-41e9-97ac-53c6363de373/receive
) on your browser. This will simulate a successful withdrawal event. -
Find out the webhook event being set to on your application.
Simulating a failed withdrawal
-
Make the usual request for withdrawal:
POST https://gateway.prd.pppay.cloud/api/pix/pay { "merchant_transaction_id": "paag-dev-team-04", "amount": 120.00, "pix_key_type": "email", "pix_key_value": "[email protected]", "pix_message": "This is a test", "first_name": "John", "last_name": "Doe", "document_number": "88377748827281" }
-
Check the
qrcode
field for the response:{ "transaction": { "id": "23ff136f-afe9-402e-904f-50b8547704d1", "merchant_id": "ea6b792b-ccb4-4d32-ba46-b7076c5acc42", "user_id": "402c797e-25a8-478b-884c-45b52d0c1a9f", "processor_id": "38eab077-c11d-4ffd-bef2-158fd082c8a7", "merchant_transaction_id": "paag-dev-team-04", "transaction_type": "pix", "first_name": "John", "last_name": "Doe", "email": null, "updated_at": "2023-11-13T02:35:53+0000", "created_at": "2023-11-13T02:35:53+0000" "events": [ { "id": "8aec44f1-f538-460e-873b-c82228b65d9b", "success": true, "event_type": "payment", "amount": "120.00", "ip_address": null, "batch_id": null, "qrcode": "http://gateway.uat.paag.dev/api/transactions/63f8c555-6b9e-41e9-97ac-53c6363de373/receive", "qrcode_image": "data:image/png;base64,...", "pix_key_type": "email", "pix_key_value": "[email protected]", "pix_message": "This is a test", "updated_at": "2023-11-13T02:35:53+0000", "created_at": "2023-11-13T02:35:53+0000" } ], "document_number": "08476407602", "status": "pending", "flow_type": "cashout", "error": null, "e2e_id": null, "source": "player" } }
-
The
qrcode
field will contain the URL for simulating the success of the withdrawal. This is NOT what we want here. Here, we want to test this async failure of the withdrawal. The url might be very similar to the one above, but with a different endpoint, like so:http://gateway.uat.paag.dev/api/transactions/63f8c555-6b9e-41e9-97ac-53c6363de373/refund
-
Find out the webhook event being set to on your application.