When a wallet makes a POST request to my server in transaction request and suppose any error occurred (e.g. insufficient funds). How can I send this error as a response so that the wallet trying to fetching the transaction gets this error message?

2 Answers 2


I don't think Wallets react to any error messages sent as a response to it. The Wallets just sign and send the transaction. A solution to this could be that you can show the error in the UI where the user is scanning the QR.

  • So the post method, which is called by the wallet and where the error might occur. Is there any special way to handle this kind of error because my fe(client)is unaware of this server and post method. Jan 26, 2023 at 14:42
  • Do I need to add events from server so that client is aware of any event in server Jan 26, 2023 at 14:44
  • Ya the frontend and the wallet and the backend server are kind of disjoint so yes adding a event in the server and catching it in the frontend should help
    – Pratik.js
    Jan 26, 2023 at 15:00

Currently the specification doesn't have a way for the server to return an error message, only the HTTP status. So generally if you respond with a 4xx or 5xx then the wallet will show a generic error message. We have an alpha 1.1 version of the Solana Pay specification which proposes a fix for this, see https://github.com/solana-labs/solana-pay/blob/master/SPEC1.1.md#error-handling. This is not currently implemented by wallets though.

For your other question of making the frontend aware, you'll need to do that off-chain, since there will be nothing on-chain to listen to when there's no transaction. For example you might want to use websockets, you could pass an identifier to the API in the QR code so that it can send a message to the websocket the frontend is listening to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.