Usage
Returns
Parameters
id (required)
- Type:
string
name
- Type:
string
payment_requirements
- Type:
PaymentRequirement[]
PaymentRequirement Properties
description
- Type:
string
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Pinata SDK x402.paymentInstructions.update changes the price, wallet, or network on an existing x402 payment instruction for private IPFS files.
import { PinataSDK } from "pinata";
const pinata = new PinataSDK({
pinataJwt: process.env.PINATA_JWT!,
pinataGateway: "example-gateway.mypinata.cloud",
});
const instruction = await pinata.x402.updatePaymentInstruction(
"01234567-89ab-cdef-0123-456789abcdef",
{
name: "Updated Premium Content",
}
);
type PaymentInstructionResponse = {
data: PaymentInstruction;
};
type PaymentInstruction = {
id: string;
version: number;
payment_requirements: PaymentRequirement[];
name: string;
description?: string;
created_at: string;
};
type PaymentRequirement = {
asset: string;
pay_to: string;
network: "base" | "base-sepolia" | "eip155:8453" | "eip155:84532";
amount: string;
description?: string;
};
stringconst instruction = await pinata.x402.updatePaymentInstruction(
"01234567-89ab-cdef-0123-456789abcdef",
{
name: "Updated Name",
}
);
stringconst instruction = await pinata.x402.updatePaymentInstruction(
"01234567-89ab-cdef-0123-456789abcdef",
{
name: "Updated Premium Content",
}
);
PaymentRequirement[]const instruction = await pinata.x402.updatePaymentInstruction(
"01234567-89ab-cdef-0123-456789abcdef",
{
payment_requirements: [
{
asset: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
pay_to: "0xnewaddress1234567890abcdef12345678",
network: "base",
amount: "20000", // $0.02 in USDC (6 decimals)
},
],
}
);
| Property | Type | Required | Description |
|---|---|---|---|
asset | string | Yes | The USDC token contract address for the network |
pay_to | string | Yes | The wallet address to receive payments |
network | "base" | "base-sepolia" | "eip155:8453" | "eip155:84532" | Yes | The blockchain network |
amount | string | Yes | The amount required for access |
description | string | No | Optional description for this requirement |
stringconst instruction = await pinata.x402.updatePaymentInstruction(
"01234567-89ab-cdef-0123-456789abcdef",
{
description: "Updated description for the payment instruction",
}
);