Skip to main content
Defined in the Base Account SDK
Most developers should use revoke() instead, which handles execution automatically using CDP wallets. This function is for advanced use cases requiring custom transaction handling.
The prepareRevoke function prepares the necessary transaction call to revoke a subscription. It returns call data that you can execute through your own wallet infrastructure using wallet_sendCalls or eth_sendTransaction.

When to Use This

Use prepareRevoke only if you need:
  • Custom wallet infrastructure (not using CDP)
  • Manual transaction control
  • Integration with existing wallet systems
For standard backend subscription management, use revoke() instead.

Parameters

id
string
required
The subscription ID (permission hash) returned from subscribe().Pattern: ^0x[0-9a-fA-F]{64}$
testnet
boolean
Must match the testnet setting used in the original subscribe call. Default: false

Returns

result
PrepareRevokeResult
Single transaction call to execute the revocation.

Error Handling

Comparison with revoke()

Important Notes

Security: You must execute the revoke call from the subscription owner wallet. Executing from any other wallet will fail.
Network Matching: The testnet parameter must match the network used when creating the subscription with subscribe().

Common Errors

Solution: Verify the subscription ID is correct. The subscription may have already been revoked.
If you execute the transaction from a wallet that isn’t the subscription owner, the transaction will revert.Solution: Ensure you’re using the same wallet address that was specified as subscriptionOwner in the subscribe() call.
Using testnet: false for a subscription created on testnet (or vice versa) will cause errors.Solution: Match the testnet parameter to the network where the subscription was created.

Migration to revoke()

If you’re currently using prepareRevoke, consider migrating to revoke():
Before (prepareRevoke)
After (revoke)

Revoke

Automatic revocation with CDP

Check Status

Verify subscription before revoking

Custom Charge

Advanced charge execution