Simular transacao (Sandbox)
curl --request POST \
--url https://api-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "complete"
}
'import requests
url = "https://api-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate"
payload = { "action": "complete" }
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({action: 'complete'})
};
fetch('https://api-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate"
payload := strings.NewReader("{\n \"action\": \"complete\"\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-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"complete\"\n}")
.asString();{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "Completed",
"simulatedAction": "complete",
"completedAt": "2025-01-15T15:10:00Z",
"refundedAt": null,
"pix": {
"txId": "SAFEFY2025011512345678901234",
"qrCode": null,
"copyAndPaste": null,
"expiresAt": null
}
},
"message": "Transacao simulada com sucesso.",
"error": null
}{
"data": null,
"message": null,
"error": {
"message": "A transacao precisa estar com status Pending para simular complete.",
"code": "invalid_status"
}
}{
"data": null,
"message": null,
"error": {
"message": "Este endpoint esta disponivel apenas em ambiente Sandbox.",
"code": "sandbox_only"
}
}{
"data": null,
"message": null,
"error": {
"message": "Transacao nao encontrada.",
"code": "not_found"
}
}Transações
Simular transação
Simule mudanças de status no Sandbox
POST
/
v1
/
transactions
/
{transactionId}
/
simulate
Simular transacao (Sandbox)
curl --request POST \
--url https://api-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"action": "complete"
}
'import requests
url = "https://api-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate"
payload = { "action": "complete" }
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({action: 'complete'})
};
fetch('https://api-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate"
payload := strings.NewReader("{\n \"action\": \"complete\"\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-payment.safefypay.com.br/v1/transactions/{transactionId}/simulate")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"action\": \"complete\"\n}")
.asString();{
"data": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "Completed",
"simulatedAction": "complete",
"completedAt": "2025-01-15T15:10:00Z",
"refundedAt": null,
"pix": {
"txId": "SAFEFY2025011512345678901234",
"qrCode": null,
"copyAndPaste": null,
"expiresAt": null
}
},
"message": "Transacao simulada com sucesso.",
"error": null
}{
"data": null,
"message": null,
"error": {
"message": "A transacao precisa estar com status Pending para simular complete.",
"code": "invalid_status"
}
}{
"data": null,
"message": null,
"error": {
"message": "Este endpoint esta disponivel apenas em ambiente Sandbox.",
"code": "sandbox_only"
}
}{
"data": null,
"message": null,
"error": {
"message": "Transacao nao encontrada.",
"code": "not_found"
}
}Simula ações em uma transação no ambiente Sandbox. Use para testar fluxos de pagamento sem dinheiro real.
Disponível apenas no ambiente Sandbox.
A simulação dispara webhooks normalmente, permitindo testar seu endpoint de callback.
Autorizações
Token JWT obtido via /v1/auth/token
Parâmetros de caminho
ID da transacao
Exemplo:
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
Corpo
application/json
Acao a simular
Opções disponíveis:
complete, expire, fail, refund Exemplo:
"complete"