Cancel a settlement¶
Cancels a quoted settlement that has not been confirmed.
Request body¶
| Field | Type | Required | Description |
|---|---|---|---|
tx_id |
string | Yes | Bitlipa transaction ID to cancel. |
Response¶
| Field | Type | Description |
|---|---|---|
tx_id |
string | Bitlipa transaction ID. |
status |
string | cancelled. |
cancelled_at |
string | Cancellation timestamp (ISO 8601). |
Only quoted settlements can be cancelled
Attempting to cancel a processing, executed, or failed settlement returns an error.
Example¶
import hashlib, hmac, json, time, uuid
import requests
API_KEY = "pk_live_xxx"
API_SECRET = b"sk_live_xxx"
path = "/api/v1/settlements/cancel"
body = json.dumps({"tx_id": "tx_abc123def456"}, separators=(",", ":"))
ts, nonce = str(int(time.time())), str(uuid.uuid4())
sig = hmac.new(
API_SECRET,
f"{ts}\nPOST\n{path}\n\n{body}".encode(),
hashlib.sha256,
).hexdigest()
resp = requests.post(
f"https://api.bitlipa.com{path}",
data=body,
headers={
"Authorization": API_KEY,
"Content-Type": "application/json",
"X-Bitlipa-Timestamp": ts,
"X-Bitlipa-Nonce": nonce,
"X-Bitlipa-Signature": sig,
},
timeout=10,
)
print(resp.json())
TS=$(date +%s); NONCE=$(uuidgen)
BODY='{"tx_id":"tx_abc123def456"}'
SIG=$(printf '%s\nPOST\n/api/v1/settlements/cancel\n\n%s' "$TS" "$BODY" \
| openssl dgst -sha256 -hmac "$API_SECRET" | awk '{print $2}')
curl -X POST https://api.bitlipa.com/api/v1/settlements/cancel \
-H "Authorization: $API_KEY" \
-H "Content-Type: application/json" \
-H "X-Bitlipa-Timestamp: $TS" \
-H "X-Bitlipa-Nonce: $NONCE" \
-H "X-Bitlipa-Signature: $SIG" \
-d "$BODY"