Defined in the Base Account SDK
The getPaymentStatus function allows you to check the status of a payment transaction after it has been submitted. Use this to track whether a payment has been completed, is still pending, or has failed.
Parameters
Transaction hash from the pay result that you want to check the status of. Pattern: ^0x[0-9a-fA-F]{64}$
Must match the testnet setting used in the original pay call. Default: false
Returns
Payment status information including current state and details. Show PaymentStatus properties
Current status of the payment. Possible values:
"completed": Payment successfully processed and confirmed
"pending": Payment still being processed by the network
"failed": Payment failed to process (funds not transferred)
"not_found": Transaction ID not found or invalid
Original transaction hash that was queried.
Human-readable status message explaining the current state.
Sender address (present for pending, completed, and failed statuses).
Amount that was sent (present for completed transactions).
Address that received the payment (present for completed transactions).
Error details (present for failed status).
Basic Status Check
Complete Payment Flow
import { getPaymentStatus } from '@base-org/account' ;
const status = await getPaymentStatus ({
id: "0xabcd1234..." ,
testnet: false
});
console . log ( "Payment status:" , status . status );
Completed Payment
Pending Payment
Failed Payment
Transaction Not Found
{
status : "completed" ,
id : "0xabcd1234..." ,
message : "Payment completed successfully" ,
sender : "0x742d35Cc4Bf53E0e6C42E5d9F0A8D2F6D8A8B7C9" ,
amount : "10.50" ,
recipient : "0x1234567890123456789012345678901234567890"
}
Error Handling
The getPaymentStatus function can throw errors for:
Invalid transaction ID format
Network connection issues
Transaction not found
Always wrap calls to getPaymentStatus in a try-catch block to handle these errors gracefully.