> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://www.openfort.io/api/mcp` to find what you need.
>
> **Have feedback?** Use `submit_feedback` on the same MCP server.

# Paymaster Endpoints

All paymaster endpoints follow the JSON-RPC 2.0 specification and are available at:

```text
https://api.openfort.io/rpc/{chainId}
```

Include your Openfort publishable key in the `Authorization` header:

```http
Authorization: Bearer YOUR_OPENFORT_PUBLISHABLE_KEY
```

The paymaster implements the [ERC-7677](https://eips.ethereum.org/EIPS/eip-7677) paymaster web service methods, so any ERC-7677 compatible client (for example, viem's `createPaymasterClient`) can use it.

You can optionally pass a `policyId` in the context object to use a specific [gas sponsorship policy](https://www.openfort.io/docs/configuration/gas-sponsorship) with **transaction** scope. When omitted, the system automatically discovers matching **project**-scoped policies in priority order. The policy's rules and conditions are configured via the [Policy Engine](https://www.openfort.io/docs/configuration/policies).

:::warning[EntryPoint v0.8 & v0.9]
The EntryPoint v0.8 & v0.9 API expects an `UnpackedUserOperation` instead of a `PackedUserOperation`. Ensure you're sending the unpacked format.
:::

## Parameters

Both methods take the same parameters:

| Parameter | Required | Description |
|-----------|----------|-------------|
| `userOperation` | Yes | The UserOperation to sponsor. Gas fields and `signature` can be placeholder values. |
| `entryPoint` | Yes | The EntryPoint contract address |
| `chainId` | No | Hex chain ID. Must match the chain ID in the URL. |
| `context` | No | Object containing an optional `policyId` (format `pol_<uuid>`) for transaction-scoped policies. When omitted, project-scoped policies are auto-discovered. It can also include `feeSponsorshipToken`, the ERC-20 token address the user pays the fee in, for policies that accept several tokens. |

## pm\_getPaymasterStubData

Returns stub paymaster values to use while estimating gas, before the UserOperation is signed.

### Request (EntryPoint v0.8 & v0.9)

```json
{
  "jsonrpc": "2.0",
  "method": "pm_getPaymasterStubData",
  "params": [
    {
      "sender": "0x5a6b47F4131bf1feAFA56A05573314BcF44C9149",
      "nonce": "0x845adb2c711129d4f3966735ed98a9f09fc4ce5700000000000000000000",
      "factory": "0xd703aaE79538628d27099B8c4f621bE4CCd142d5",
      "factoryData": "0xc5265d5d...",
      "callData": "0xe9ae5c53...",
      "callGasLimit": "0x0",
      "verificationGasLimit": "0x0",
      "preVerificationGas": "0x0",
      "maxFeePerGas": "0x7a5cf70d5",
      "maxPriorityFeePerGas": "0x3b9aca00",
      "signature": "0xffff..."
    },
    "0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108",
    "0xaa36a7",
    { "policyId": "pol_545ccf66-c7e7-4926-9fcf-a24b073aa9b6" }
  ],
  "id": 1
}
```

### Response (EntryPoint v0.8 & v0.9)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "sponsor": { "name": "Openfort", "icon": "https://www.openfort.io/favicon.ico" },
    "paymaster": "0xDFF7FA1077Bce740a6a212b3995990682c0Ba66d",
    "paymasterData": "0xbcd12340a2109876543210987654301098765432...",
    "paymasterVerificationGasLimit": "0x...",
    "paymasterPostOpGasLimit": "0x..."
  }
}
```

### Request (EntryPoint v0.6)

```json
{
  "jsonrpc": "2.0",
  "method": "pm_getPaymasterStubData",
  "params": [
    {
      "sender": "0xb341FEAFaF71b09089d03B7D114599f8F491EE45",
      "nonce": "0x0",
      "initCode": "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3...",
      "callData": "0x51945447...",
      "callGasLimit": "0x0",
      "verificationGasLimit": "0x0",
      "preVerificationGas": "0x0",
      "maxPriorityFeePerGas": "0x3b9aca00",
      "maxFeePerGas": "0x7a5cf70d5",
      "paymasterAndData": "0x",
      "signature": "0x00000000ffff..."
    },
    "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
    "0xaa36a7",
    { "policyId": "pol_545ccf66-c7e7-4926-9fcf-a24b073aa9b6" }
  ],
  "id": 1
}
```

### Response (EntryPoint v0.6)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "sponsor": { "name": "Openfort", "icon": "https://www.openfort.io/favicon.ico" },
    "paymasterAndData": "0xbcd12340a2109876543210987654301098765432..."
  }
}
```

***

## pm\_getPaymasterData

Returns the final paymaster values for the UserOperation. Call it after gas estimation, with the same parameters as `pm_getPaymasterStubData`, and include the returned values in the UserOperation you sign and send with [`eth_sendUserOperation`](https://www.openfort.io/docs/products/infrastructure/bundler/endpoints#eth_senduseroperation).

### Response (EntryPoint v0.8 & v0.9)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "paymaster": "0xDFF7FA1077Bce740a6a212b3995990682c0Ba66d",
    "paymasterData": "0xbcd12340a2109876543210987654301098765432..."
  }
}
```

### Response (EntryPoint v0.6)

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "paymasterAndData": "0xbcd12340a2109876543210987654301098765432..."
  }
}
```

To check which EntryPoint versions are supported, call the bundler's [`eth_supportedEntryPoints`](https://www.openfort.io/docs/products/infrastructure/bundler/endpoints#eth_supportedentrypoints).
