Skip to main content
The Safefy API uses the same base URL for both Sandbox and Production environments. The active environment is determined automatically based on the type of credentials used.
EnvironmentCredentialsBehavior
Sandboxpk_sandbox_... / sk_sandbox_...Simulated payments and fictitious balance
Productionpk_production_... / sk_production_...Real PIX transactions
API URL: https://api-payment.safefypay.com.br

Creating credentials

  1. Access the Safefy panel
  2. Go to Settings API Credentials
  3. Choose the environment (Sandbox or Production) and click Generate
  4. Copy the clientSecret immediately it will not be shown again

Simulating transactions

In Sandbox, you can simulate status changes using the simulate endpoint:
curl -X POST https://api-payment.safefypay.com.br/v1/transactions/{id}/simulate \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{"action": "pay"}'
ActionFrom statusTo status
payPendingCompleted
expirePendingExpired
failPendingFailed
refundCompletedRefunded
Transaction simulation only works with Sandbox credentials. Using Production credentials will return an error.

Complete test flow

  1. Create a transaction POST /v1/transactions with method: "pix" and an amount
  2. Display the QR Code use the pix.copyAndPaste field to render a QR Code in your app
  3. Simulate payment call POST /v1/transactions/{id}/simulate with action: "pay"
  4. Receive the webhook your callbackUrl will receive a payment.completed event
  5. Validate confirm the transaction status is Completed

Simulating cashouts

curl -X POST https://api-payment.safefypay.com.br/v1/cashouts/{id}/simulate \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{"action": 1}'
ActionTo status
1Completed
2Failed
3Rejected