# Sponsoring Gas (/sdk/v5_3_x/core-api/sponsor-gas)

> For the complete documentation index, see [llms.txt](/llms.txt)



<VersionWarning version="5.3.x" />

With account abstraction, you can pay gas for users so they don't have to acquire native tokens in order to interact with your DApp.

When you sponsor gas through ZeroDev, there are two ways to pay for the gas:

* Put down your credit card.  We front the gas for your users, and then at the end of the billing cycle (once a month) we charge your credit card.

* Buy gas credits from us.

## Setting up gas sponsoring policies [#setting-up-gas-sponsoring-policies]

To avoid over-spending gas on sponsoring, you must set up gas-sponsoring policies.  Sign up on the ZeroDev dashboard if you haven't already, then [set up gas policies](/api-and-toolings/infrastructure/gas-policies).

## API [#api]

<Callout type="info">
  Impatient?  Check out [complete examples here](https://github.com/zerodevapp/zerodev-examples/blob/main/create-account/main.ts).
</Callout>

When [setting up an account](/sdk/v5_3_x/core-api/create-account), you can specify a `sponsorUserOperation` function when you [create the account client](/sdk/v5_3_x/core-api/create-account#create-an-account-client).

The `sponsorUserOperation` function essentially takes a UserOp and then returns a UserOp with the `paymasterAndData` field set.  For example, if you are using the ZeroDev paymaster, use the `createZeroDevPaymasterClient` helper function:

```typescript
import { http } from "viem"
import { ENTRYPOINT_ADDRESS_V07 } from "permissionless"
import { createZeroDevPaymasterClient, createKernelAccountClient } from "@zerodev/sdk"

const entryPoint = ENTRYPOINT_ADDRESS_V07

const kernelClient = createKernelAccountClient({
  // other options...

  middleware: {
    sponsorUserOperation: async ({ userOperation }) => {
      const zerodevPaymaster = createZeroDevPaymasterClient({
        chain,
        entryPoint,
        // Get this RPC from ZeroDev dashboard
        transport: http(PAYMASTER_RPC),
      })
      return zerodevPaymaster.sponsorUserOperation({
        userOperation,
        entryPoint,
      })
    }
  }
})
```

## Using other paymaster providers [#using-other-paymaster-providers]

If you want to use Pimlico paymasters, you can use these helper functions:

```ts
import { createPimlicoPaymasterClient } from "permissionless/clients/pimlico"
```

Then, simply replace `createZeroDevPaymasterClient` with one of these functions, and make sure to use the corresponding paymaster RPC for these infra providers.
