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.
| Environment | Credentials | Behavior |
|---|
| Sandbox | pk_sandbox_... / sk_sandbox_... | Simulated payments and fictitious balance |
| Production | pk_production_... / sk_production_... | Real PIX transactions |
API URL: https://api-payment.safefypay.com.br
Creating credentials
- Access the Safefy panel
- Go to Settings API Credentials
- Choose the environment (Sandbox or Production) and click Generate
- 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"}'
| Action | From status | To status |
|---|
pay | Pending | Completed |
expire | Pending | Expired |
fail | Pending | Failed |
refund | Completed | Refunded |
Transaction simulation only works with Sandbox credentials. Using Production credentials will return an error.
Complete test flow
- Create a transaction
POST /v1/transactions with method: "pix" and an amount
- Display the QR Code use the
pix.copyAndPaste field to render a QR Code in your app
- Simulate payment call
POST /v1/transactions/{id}/simulate with action: "pay"
- Receive the webhook your
callbackUrl will receive a payment.completed event
- 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}'
| Action | To status |
|---|
1 | Completed |
2 | Failed |
3 | Rejected |