curl --request POST \
--url https://api.yuvexpay.com/v1/payments/{paymentId}/simulate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "CANCELLED"
}
'import requests
url = "https://api.yuvexpay.com/v1/payments/{paymentId}/simulate"
payload = { "status": "CANCELLED" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'CANCELLED'})
};
fetch('https://api.yuvexpay.com/v1/payments/{paymentId}/simulate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.yuvexpay.com/v1/payments/{paymentId}/simulate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'CANCELLED'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.yuvexpay.com/v1/payments/{paymentId}/simulate"
payload := strings.NewReader("{\n \"status\": \"CANCELLED\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.yuvexpay.com/v1/payments/{paymentId}/simulate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"CANCELLED\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yuvexpay.com/v1/payments/{paymentId}/simulate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"CANCELLED\"\n}"
response = http.request(request)
puts response.read_body{
"payment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"txId": "<string>",
"amount": 123,
"feeAmount": 123,
"netAmount": 123,
"feePassedToPayer": true,
"payerFeeAmount": 123,
"status": "NEW",
"paymentMethod": "PIX",
"currency": "BRL",
"description": "<string>",
"metadata": {},
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"methodData": {
"type": "PIX"
},
"paidAt": "2023-11-07T05:31:56Z",
"payer": {
"name": "<string>",
"document": "<string>",
"documentType": "CPF",
"institutionName": "<string>",
"institutionIspb": "<string>"
}
}
}Simulate a payment
Drive a sandbox payment to a terminal status immediately, whatever its amount and payment method. Sandbox only: a production API key and a production payment id are both rejected with 403. REFUNDED marks the payment paid if it is not already and then issues a full refund; DISPUTED marks it paid if it is not already and then moves it to CHARGEBACK, which is a chargeback and not a MED.
curl --request POST \
--url https://api.yuvexpay.com/v1/payments/{paymentId}/simulate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "CANCELLED"
}
'import requests
url = "https://api.yuvexpay.com/v1/payments/{paymentId}/simulate"
payload = { "status": "CANCELLED" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'CANCELLED'})
};
fetch('https://api.yuvexpay.com/v1/payments/{paymentId}/simulate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.yuvexpay.com/v1/payments/{paymentId}/simulate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'CANCELLED'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.yuvexpay.com/v1/payments/{paymentId}/simulate"
payload := strings.NewReader("{\n \"status\": \"CANCELLED\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.yuvexpay.com/v1/payments/{paymentId}/simulate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"CANCELLED\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.yuvexpay.com/v1/payments/{paymentId}/simulate")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"CANCELLED\"\n}"
response = http.request(request)
puts response.read_body{
"payment": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"txId": "<string>",
"amount": 123,
"feeAmount": 123,
"netAmount": 123,
"feePassedToPayer": true,
"payerFeeAmount": 123,
"status": "NEW",
"paymentMethod": "PIX",
"currency": "BRL",
"description": "<string>",
"metadata": {},
"expiresAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"methodData": {
"type": "PIX"
},
"paidAt": "2023-11-07T05:31:56Z",
"payer": {
"name": "<string>",
"document": "<string>",
"documentType": "CPF",
"institutionName": "<string>",
"institutionIspb": "<string>"
}
}
}Authorizations
YuvexPay API key. Include as Authorization: Bearer ypk_<env>_<kid>_<secret> where <env> is test (sandbox) or live (production). Create and manage keys in the dashboard under Settings > API Keys.
Headers
Optional for this endpoint. Honoured when sent — replay and payload check apply — but omitting it is not rejected.
100Path Parameters
The sandbox payment ID to simulate.
Body
Terminal outcome to apply. Defaults to PAID when the body is empty or omitted.
PAID, CANCELLED, EXPIRED, REFUNDED, DISPUTED Response
The payment after the simulated transition.
Show child attributes
Show child attributes

