Overview
The Update Earning endpoint allows you to modify earning information after it has been created. Common use cases include:- Updating earning status (e.g., from
pendingtoprocessingtopaid) - Adding payout reference IDs (e.g., Stripe payout ID)
- Updating metadata with transaction information
- Marking earnings as failed if payout fails
- Correcting earning amounts or descriptions
Authentication
This endpoint requires authentication using a Bearer token in the Authorization header:Path Parameters
The unique identifier of the earning you want to update.Example:
earn_123abcRequest Body
All fields in the request body are optional. Only include the fields you want to update.Update the amount in cents. Use this to correct amounts if needed.Example:
1500 (represents $15.00)Update the currency code (ISO 4217 format).Example:
USDUpdate the type of earning.Example:
purchase, subscription, recurringUpdate the description of the earning.Example:
Commission from customer purchase - Order #12345Update the earning status. Valid values are:
pending- Earning created but not yet processedprocessing- Earning is being processed for payoutpaid- Earning has been paid outfailed- Earning payment failed
paidUpdate the external reference ID (e.g., Stripe payout ID, transaction ID). Typically set when status changes to
processing or paid.Example: payout_456defUpdate additional metadata. This will merge with existing metadata or replace it depending on your API configuration.Example:
Request Example
Response
On success, the API returns the updated earning object:Unique identifier for the earning.
ID of the referral that generated this earning.
Updated amount in cents (if provided).
Updated currency code (if provided).
Updated status (if provided).
Updated reference ID (if provided).
ISO 8601 timestamp of when the earning was last updated.
Response Example
Error Responses
Bad Request - Invalid request data
Unauthorized - Invalid or missing API key
Not Found - The earning with the specified ID does not exist
Use Cases
Processing Payouts
When initiating a payout, update the earning status:Marking Earnings as Paid
After successful payout, mark the earning as paid:Handling Failed Payouts
If a payout fails, mark the earning as failed:Correcting Earning Amounts
If an amount needs to be corrected:Best Practices
- Update status carefully - Status changes should reflect actual payout events
- Store payout references - Always include reference_id when processing payouts
- Track status transitions - Use metadata to log when and why status changes
- Handle failures gracefully - Mark earnings as failed and store error messages
- Validate status values - Ensure status values are valid before sending
- Link to external systems - Store payout IDs in reference_id and metadata
Status Workflow
Typical earning status progression:pending→ Earning created, ready for processingprocessing→ Payout initiated, payment being processedpaid→ Payout completed successfullyfailed→ Payout failed (can happen at processing stage)
Rate Limits
This endpoint is subject to rate limiting. Check response headers for rate limit information.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Earning ID
Body
application/json
Response
Earning updated successfully