Appearance
Fetching transaction status
Privy supports fetching transaction status by the transaction ID.
To do so, make a GET
request to
bash
https://api.privy.io/v1/transactions/id/<transaction_id>
Response
Privy will send the following in the response body:
Field | Type | Description |
---|---|---|
transaction_id | string | Privy’s unique ID for the transaction. |
status | 'submitted' or 'included' or 'confirmed' or 'error' | Current status of the transaction |
hash | string | A hash for the transaction. Only populated if status is 'included' or 'confirmed'. |
error | {code: string; message: string;} | Error details. Only populated if status is 'error'. |
error.code | string | Error code for discrete error cases. |
error.message | string | Detailed error message. |
'submitted'
refers to when a transaction has been submitted to the network but has not yet been included in a block'included'
refers to when a transaction has been included in a block but the block has not been confirmed'confirmed'
refers to when a transaction has been included in a confirmed block in the blockchain. This is effectively the final success state for a transaction.'error'
refers to when a transaction has encountered an error and has not been successfully included in a block.
Example
For example, you might fetch a transactions status using transaction ID using the cURL request below.
bash
$ curl --request POST https://api.privy.io/v1/transactions/id/transaction_id \
-u "<your-privy-app-id>:<your-privy-app-secret>" \
-H "privy-app-id: <your-privy-app-id>" \
-H "privy-authorization-signature: <authorization-signature-for-request>" \
-H 'Content-Type: application/json' \
-d '{
"transaction_id": "123456789"
}'
The response might look like
json
{
"transaction_id": "123456789",
"status": "confirmed",
"hash": "0x2446f1fd773fbb9f080e674b60c6a033c7ed7427b8b9413cf28a2a4a6da9b56c",
"error": null
}