> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://mpp.dev/api/mcp` to find what you need.

# Solana charge \[One-time payments on Solana]

The Solana implementation of the [charge](/intents/charge) intent.

The server issues a charge Challenge describing the expected amount, currency, recipient, and Solana-specific `methodDetails`. The client either presents a signed transaction for server broadcast or presents a confirmed transaction signature. The server verifies the transfer on-chain and returns the resource with a Receipt.

This method is best for fixed-price API calls, digital goods, and payments that settle directly on Solana.

## Server

Use `solana.charge` to gate endpoints behind native SOL or SPL token payments.

```ts
import { Mppx } from 'mppx/server'
import { solana } from '@solana/mpp/server'

const mppx = Mppx.create({
  methods: [solana.charge({
    recipient: '9xAXssX9j7vuK99c7cFwqbixzL3bFrzPy9PUhCtDPAYJ',
    network: 'localnet',
  })],
  secretKey: process.env.MPP_SECRET_KEY!,
})
```

## Client

Use `solana.charge` with `Mppx.create` to automatically handle Solana charge Challenges.

```ts
import { Mppx } from 'mppx/client'
import { solana } from '@solana/mpp/client'

const mppx = Mppx.create({
  methods: [solana.charge()],
})
```

## Payment links

Enable `html: true` on `solana.charge()` to turn any endpoint into a shareable payment link. Browsers see a payment page with a "Continue with Solana" button; programmatic clients get the standard `402` flow.

```ts
import { Mppx } from 'mppx/server'
import { solana } from '@solana/mpp/server'

const mppx = Mppx.create({
  methods: [solana.charge({
    recipient: '9xAXssX9j7vuK99c7cFwqbixzL3bFrzPy9PUhCtDPAYJ',
    currency: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
    decimals: 6,
    network: 'localnet',
    html: true, // [!code hl]
  })],
  secretKey: process.env.MPP_SECRET_KEY!,
})
```

The `html` option accepts:

| Type | Behavior |
| --- | --- |
| `true` | Default Solana-branded payment page with "Continue with Solana" button |
| `false` / omitted | No payment page — standard JSON `402` only |

On devnet and localnet, the payment page shows a network badge on the button and uses [Surfpool](https://surfpool.run) cheatcodes to fund test accounts automatically.

See the [Payment links guide](/guides/payment-links) for framework-specific setup.

## Solana-specific request fields

The Solana charge request extends the base charge schema with `methodDetails` fields such as:

* `network`
* `decimals`
* `tokenProgram`
* `feePayer`
* `feePayerKey`
* `splits`

These fields let the server describe whether payment is in SOL or an SPL asset, whether fee sponsorship is available, and whether the payment is split across multiple recipients.

## Specification

[IETF Specification](https://paymentauth.org/draft-solana-charge-00) — Read the full specification
