Simulates a payment (sandbox)
Simulates a payer transferring to one of your templates or intents, running the provider's real rail: the payin is created, authorized and funded exactly as a production payment would be, and its outcome reaches you over the same webhooks.
Sandbox only. In any other environment the endpoint answers 403.
A payment to a template is unreferenced — the template accepts many, so
the request brings its own method and amount. A payment to an intent is
referenced — the intent was declared for it and already fixes both.
Use error to provoke a failure. Leaving it out simulates a payment that
succeeds, though the payment authorization may still refuse it on its own
validations — an amount outside the template's bounds, a payer it does not
expect. That refusal happens before a payin exists, so the response comes
back with no payin_id and the reason instead. Provoking those rejections
is exactly how you test them.
Authorization
authorization In: header
Request Body
application/json
Payment to simulate
TypeScript Definitions
Use the request body type in TypeScript.
Amount the payer transfers.
The failure to simulate. Omit it to simulate a payment that succeeds — which can still be refused, since the payment authorization runs its own validations on it either way.
"risk_control" | "provider_unavailable" | "breb_timeout" | "unknown""risk_control"Method to pay with. Must be one the template accepts.
"co_breb""co_breb"Method-specific simulation data. For co_breb: payment_id.
Who pays. Generated at random when absent.
Indicates the format for resource's ID
^[A-Za-z]{2,7}_[\w-]{22}$"cpitpl_5tgliBmzjZ6mpQPRbQjfKj"Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.sandbox.cuentamono.com/v1/core/payins/sandbox/payments" \ -H "Content-Type: application/json" \ -d '{ "amount": { "amount": 100000000, "currency": "COP" }, "method": "co_breb", "template_id": "cpitpl_5tgliBmzjZ6mpQPRbQjfKj" }'{
"payin_id": null,
"state_reason": "amount_below_minimum"
}{
"payin_id": "cpin_5tgliBmzjZ6mpQPRbQjfKj",
"state_reason": null
}{
"code": "400 Bad Request",
"errors": [
{
"error_code": "method_not_allowed",
"message": "The payin method is not available for this template",
"path": null,
"url": null
}
],
"id": "log_7MkWaFqvfosB8fzHhb1Eql",
"message": "Malformed request"
}{
"code": "401 Unauthorized",
"errors": [
{
"error_code": "missing_authorization_header",
"message": "`Authorization` header is missing.",
"path": null,
"url": null
}
],
"id": "log_7MkWaFqvfosB8fzHhb1Eql",
"message": "Authorization header is missing or invalid."
}{
"code": "403 Forbidden",
"errors": [
{
"error_code": "feature_not_enabled",
"message": "This feature is not enabled for this account.",
"path": null,
"url": null
}
],
"id": "log_7MkWaFqvfosB8fzHhb1Eql",
"message": "Not authorized to have access to this resource"
}{
"code": "404 Not Found",
"errors": [
{
"error_code": "template_not_found",
"message": "The template doesn't exist.",
"path": null,
"url": null
}
],
"id": "log_7MkWaFqvfosB8fzHhb1Eql",
"message": "Resource not defined"
}{
"code": "422 Unprocessable Content",
"errors": [
{
"error_code": "missing_field",
"message": "The field is missing on the request body or parameters.",
"path": "#/path/to/field",
"url": null
}
],
"id": "log_7MkWaFqvfosB8fzHhb1Eql",
"message": "Validation errors"
}{
"code": "503 Service Unavailable",
"errors": [
{
"error_code": "unavailable",
"message": "The service is unavailable, Please try again later",
"path": null,
"url": null
}
],
"id": "log_7MkWaFqvfosB8fzHhb1Eql",
"message": "Service unavailable"
}