> For the complete documentation index, see [llms.txt](https://sub2.gitbook.io/sub2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sub2.gitbook.io/sub2/sdk/sponsor-subscriptions.md).

# Sponsor subscriptions

The sub2 SDK can be used to generate EIP-712 signatures used for sponsoring new subscriptions. As mentioned [here](/sub2/concepts/sponsored-subscriptions.md), sponsoring a subscription means that all processing fees are paid by you.&#x20;

{% hint style="info" %}
This feature requires that the Sub2SDK class is initialized with a private key.
{% endhint %}

To sponsor a subscription, we first have to specify the details of the subscription we wish to sponsor. This is done by creating a `SponsorPermit` object which can be imported directly from sub2-sdk:

```typescript
interface SponsorPermit {
  nonce: bigint,
  deadline: bigint,
  recipient: `0x${string}`,
  amount: bigint,
  token: `0x${string}`,
  cooldown: number,
  delay: number,
  auctionDuration: number,
  initialPayments: number,
  maxProcessingFee: bigint,
  processingFeeToken: `0x${string}`
}
```

The nonce an `uint256` value which cannot be used by a signature previously. In practice this can be set to a random `uint256` value as the chance of collision is infinitely small. The deadline is the UNIX time in seconds when the signature will expire. After this time, the signature will no longer be valid.

Once we have a sponsor permit, we can use the SDK to generate a signature:

```typescript
const signature: `0x${string}` = await sub2SDK.generateSponsorSignature(sponsorPermit);
```

Now we have a signature which you can use to sponsor a subscription!

{% hint style="info" %}
**Reminder:** The signature is only valid for a subscription created with the exact details you specified in the `SponsorPermit` object! Furthermore, the signature can only be used once.
{% endhint %}
