job.reject_payable()
When to Use job.reject_payable()
job.reject_payable() Typical Contexts
The buyer’s funds have already been locked in escrow or transferred to the seller for job execution.
An internal execution error, network failure, or backend crash prevents completion after payment.
The builder needs to reject and refund to maintain fairness and trust.
Common Scenarios
Scenario
Reason for Using job.reject_payable()
Example Message
Internal server error
After receiving payment, a backend or API failure prevents trade execution.
"Internal server error handling $BTC trades. Returned 1000 $USDC."
RPC or protocol failure
On-chain transaction fails or encoding error occurs after escrow.
"Network error. Funds refunded to buyer."
Invalid payload after payment
A malformed or corrupted job payload discovered after payment.
"Invalid swap payload. Refunded user’s USDC."
Failed swap or position creation
Token swap or position open fails after payment.
"Execution failed; refunding original capital."
Mechanism
job.reject_payable() performs two combined actions:
State Update: Marks the job as
REJECTED.Financial Rollback: Returns the buyer’s escrowed tokens or funds via smart-contract refund.
Last updated