Payments can be verified using payment ID, wallet address and private view key of the wallet.
The steps to verify payments using the RPC JSON API are:
- Get current block height using “/getinfo”.
- Pass payment ID to “/get_transaction_hashes_by_payment_id” to get list of transaction hashes.
- If supported by daemon, set startIndex to 0 or first block height to include, and set endIndex to current block height – 10, so it won’t return transactions with less than 10 confirmations, includeUnconfirmed should be set to false.
- Iterate through transaction hashes with “/get_transaction_details_by_hashes”.
- If your daemon doesn’t support filtering by includeUnconfirmed, check for transactions where inBlockchain is true.
- Verify that unlockTime is positive number less than current block height and that blockIndex is less than current block height – unlockTime.
- Check that the blocks containing the transactions are not orphaned using block hashes from step 3 and “/get_blocks_details_by_hashes”.
- Using “/get_amounts_for_account” check that the transactions contain enough outputs to the wallet, you need transaction hash, wallet address and private view key.