Wait for a Bitcoin Payment Event
SUBTC can block and wait until a payment arrives to a specific address.<br>This is useful for building checkout systems or automated payment confirmation.
Wait for a payment event:<br>
curl -sS -X POST "https://api.subtc.net/v1/btc?mode=wallet_wait_event" \
-H "X-SUBTC-KEY: $KEY" \
-H "Content-Type: application/json" \
-d "{\"wallet_id\":\"$WID\",\"address\":\"$ADDR\",\"expected_sat\":50000,\"timeout_sec\":300}"<br>Example response:<br>{
"ok": true,
"request_id": "f48a753c2c24debd",
"result": {
"address": "tb1qj3xzdyr6fdhzh37w4avm4l5dnm53cmvf6p27rf",
"coin": "btc",
"expected_sat": 50000,
"net": "test",
"received_sat": 102324,
"status": "confirmed",
"wallet_id": "w_cf21a601a3f461a92699e5b5dac80ad6d9d66de4592d"
}
}
What happened:
The API waited until the address received the expected payment.<br>The wallet detected 102,324 SAT and the transaction reached confirmed status.
This pattern allows developers to build synchronous payment flows using only curl.
API Base:<br>https://subtc.net/api