V1 Docs



Only the contract owner can issue refunds

Creators can issue refunds to one or more subscribers. Upon refunding a subscriber, the remaining purchased time is revoked, and the token value of that time is returned to the subscriber. Additionally, any granted time is revoked. The token itself it not burned, and can be used to purchase a subscription again.

The source of funds for the refund is the contract's balance. If the contract balance is insufficient, the refund call can be invoked with a value to top up the contract balance. Given that time amounts change in every block, the amount transferred in at time of refund may exceed the amount required. Any excess funds are added to the contract for future withdraws.

import {
} from '@withfabric/protocol-sdks/stpv1';
const accounts: `0x${string}`[] = [
const refund = await prepareRefund({
  contractAddress: '0x...',
  credit: 10_000n, // Optional amount of tokens to credit to the contract to cover the refund
const receipt = await refund();