curl -X POST https://api.playto.so/v1/webhooks/test/ \
-H "X-API-KEY: sk_live_your_api_key_here"
curl -X POST https://sandbox-api.playto.so/v1/webhooks/test/ \
-H "X-API-KEY: sk_test_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"event": "payment.succeeded"}'
{
"id": "evt_0c5e8f2a1d7b4963a4e0b8d6f3c1a927",
"event": "webhook.test",
"livemode": true,
"status": "pending"
}
{
"error": {
"type": "invalid_request_error",
"code": "webhook_url_not_set",
"message": "No webhook URL is set for this account. Add one in the dashboard, then try again."
}
}
{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "One or more fields are invalid.",
"details": {
"event": ["Unsupported event. Allowed here: webhook.test. Other events can be tested in the sandbox."]
}
}
}
{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Request was throttled. Expected available in 42 seconds."
}
}
Webhooks
Send Test Event
Send a signed test event to your webhook URL to check that it is reachable and your signature check works.
POST
/
webhooks
/
test
/
curl -X POST https://api.playto.so/v1/webhooks/test/ \
-H "X-API-KEY: sk_live_your_api_key_here"
curl -X POST https://sandbox-api.playto.so/v1/webhooks/test/ \
-H "X-API-KEY: sk_test_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"event": "payment.succeeded"}'
{
"id": "evt_0c5e8f2a1d7b4963a4e0b8d6f3c1a927",
"event": "webhook.test",
"livemode": true,
"status": "pending"
}
{
"error": {
"type": "invalid_request_error",
"code": "webhook_url_not_set",
"message": "No webhook URL is set for this account. Add one in the dashboard, then try again."
}
}
{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "One or more fields are invalid.",
"details": {
"event": ["Unsupported event. Allowed here: webhook.test. Other events can be tested in the sandbox."]
}
}
}
{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Request was throttled. Expected available in 42 seconds."
}
}
Authentication
RequiresX-API-KEY header.
Details
Sends one signed event to the webhook URL set for the environment your API key belongs to (your test key uses the sandbox URL, your live key uses the live URL). It goes through the same pipeline as a real event, so the eventid, the three X-Playto-* headers, the signature and the retries are the real thing. See Webhooks for how to verify it.
The call queues the event and returns straight away. Check your server’s log for the event id it returns.
- Live (production): only
webhook.testcan be sent. It carries a short message, your merchant id and a timestamp, withlivemode: true. It never looks like a payment. - Sandbox: you can also send a sample
invoice.paid,payment.succeededordispute.created. A sample has the fields of the real event, obviously fake ids (all zeros) andlivemode: false, so you can run your real handler against it.
Body Parameters
The event to send. Defaults to
webhook.test. In the sandbox you can also pass invoice.paid, payment.succeeded or dispute.created. Any other value, or anything but webhook.test in production, returns 400.Response
Returns202 Accepted.
The event id (
evt_...). It is the id in the body your server receives and the X-Playto-Event-Id header.The delivery’s state when this call returned:
pending (queued), delivered, or failed (the first attempt failed and a retry is scheduled).curl -X POST https://api.playto.so/v1/webhooks/test/ \
-H "X-API-KEY: sk_live_your_api_key_here"
curl -X POST https://sandbox-api.playto.so/v1/webhooks/test/ \
-H "X-API-KEY: sk_test_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"event": "payment.succeeded"}'
{
"id": "evt_0c5e8f2a1d7b4963a4e0b8d6f3c1a927",
"event": "webhook.test",
"livemode": true,
"status": "pending"
}
{
"error": {
"type": "invalid_request_error",
"code": "webhook_url_not_set",
"message": "No webhook URL is set for this account. Add one in the dashboard, then try again."
}
}
{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "One or more fields are invalid.",
"details": {
"event": ["Unsupported event. Allowed here: webhook.test. Other events can be tested in the sandbox."]
}
}
}
{
"error": {
"type": "rate_limit_error",
"code": "rate_limited",
"message": "Request was throttled. Expected available in 42 seconds."
}
}
