Refunds
Create Refund
This endpoint creates a partial or full refund for a specific sale.
POST
The Bearer authentication token is required to access this endpoint.
Invoice (sale) ID for which the refund will be requested.
Specific refund amount. If not provided, a full refund for the received sale
amount will be processed.
Refund reason. Optional field for internal tracking.
Response
Unique identifier of the created refund.
Sale data related to the refund.
Data for the user who requested the refund.
Gateway used to process the refund (e.g., PIX, IUGU).
ID of the original transaction being refunded.
Requested refund amount.
Refund reason provided in the request.
Current refund status. Possible values: -
REFUND_IN_PROGRESS: Refund in
progress - REFUND_COMPLETED: Refund completed - REFUND_FAILED: Refund
failed - REFUND_CANCELLED: Refund canceledExternal refund ID provided by the gateway.
Refund creation date and time.
Refund last update date and time.
Important Notes
Partial vs Full Refund
- Partial Refund: When
valueis provided, the system processes a refund for the specified amount - Full Refund: When
valueis not provided, the system automatically calculates the total available amount for refund (received amount + MED amount)
Validations
- Available Balance: The system checks whether there is enough balance to process the refund
- Invoice Status: The invoice must be in a valid status for refund (cannot already be refunded)
- Maximum Amount: The refund amount cannot exceed the total amount received in the sale
Processing Flow
- Creation: The refund is created with status
REFUND_IN_PROGRESS - Processing: The system sends the request to the payment gateway
- Completion: Once processed by the gateway, the status is updated via internal webhook
- Settlement: The amount is debited from the user’s available balance
HTTP Status Codes
- 201: Refund created successfully
- 400: Invalid data or business restrictions
- 401: Invalid authentication token
- 404: Invoice not found
- 500: Internal server error