> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# getPaymentInstruction

> Creates a payment instruction to append to a transaction for fee payment to the Kora paymaster.

<Info>
  **SDK-Only Method**: `getPaymentInstruction` is not a JSON-RPC method on the
  server (a raw JSON-RPC request for it returns HTTP 405). The TypeScript SDK
  calls the server's
  [`estimateTransactionFee`](/developers/docs/tools/kora/json-rpc-api/estimate-transaction-fee)
  method, uses the returned `payment_address` and `signer_pubkey`, and builds
  the token transfer instruction locally. The `estimateTransactionFee` method
  must be enabled on the Kora server.
</Info>

## TypeScript SDK Usage

```typescript
const paymentInfo = await client.getPaymentInstruction({
  transaction: "base64EncodedTransaction",
  fee_token: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  source_wallet: "sourceWalletPublicKey",
});
// Append paymentInfo.payment_instruction to your transaction
```

### Parameters

| Parameter          | Type                          | Required | Description |
| ------------------ | ----------------------------- | -------- | ----------- |
| `transaction`      | string                        | Yes      | Base64-encoded transaction to price |
| `fee_token`        | string                        | Yes      | Mint of the token the user pays the fee in |
| `source_wallet`    | string or `TransactionSigner` | Yes      | Wallet that makes the token payment. Pass the `TransactionSigner` to keep its signer identity on the payment instruction |
| `token_program_id` | string                        | No       | Token program of `fee_token`. Defaults to the Token Program; use the Token-2022 program address for Token-2022 mints |
| `signer_key`       | string                        | No       | Public key of the Kora signer to use, passed to `estimateTransactionFee`. Use the same value for `signTransaction` |
| `sig_verify`       | boolean                       | No       | Passed to `estimateTransactionFee`. Defaults to `false` |

## Response Structure

The method returns a payment instruction object with the following structure:

```jsonc
{
  "original_transaction": "base64EncodedTransaction",
  "payment_address": "3Z1Ef7YaxK8oUMoi6exf7wYZjZKWJJsrzJXSt1c3qrDE",
  "payment_amount": 11055,
  "payment_instruction": {
    "programAddress": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
    "accounts": [/* source token account, destination token account, owner */],
    "data": {/* SPL Token transfer instruction data */}
  },
  "payment_token": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "signer_address": "3Z1Ef7YaxK8oUMoi6exf7wYZjZKWJJsrzJXSt1c3qrDE"
}
```
