Cancel Contract
Cancel a contract that hasn't been paid yet.
When a contract can be cancelled
Only contracts in Approved status can be cancelled. After a successful cancellation, the status changes to Cancelled.
When cancellation is rejected
- The contract is in any other status, for example
Escrow,Released,Completed, or alreadyCancelled. - The buyer has started a bank transfer and processed Done (you received
bank_transfer.buyer_acknowledged). The money may already be on its way, so the contract can't be cancelled.
To cancel a contract, call the following endpoint:
Endpoint POST {{BaseUrl}}/apps/api/contracts/cancel
Curl:
curl --location '{{BaseUrl}}/apps/api/contracts/cancel' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
--data '{
"contractId": "CNT-2601-00100002",
"reason": "Wrong order"
}'
| Field | Type | Required | Description |
|---|---|---|---|
contractId | string | Yes | The contract ID returned by Create Contract. |
reason | string | Yes | Why the contract is being cancelled. |
Response
{
"data": {
"contractId": "CNT-2601-00100002",
"status": "Cancelled"
},
"message": "ExternalContractCancelledSuccessfully",
"status": 200,
"validationErrors": []
}
| HTTP | Message | Cause |
|---|---|---|
| 404 | ReasonRequired | No reason is provided in request |
| 404 | ContractNotFound | No contract with this ID |
| 409 | ContractAlreadyCancelled | Contract is already cancelled |
| 409 | CanNotCancelContract | Contract status doesn't allow cancellation |
| 400 | ContractCancelPaymentInProgress | Contract has a payment in progress |
After cancellation
The contract status changes to Cancelled, and WePay sends the contract.cancelled webhook. See Webhook Notifications.