Skip to main content
Types for x402 monetization features

PaymentRequirement

Defines a single payment requirement within a payment instruction.
type PaymentRequirement = {
  asset: string;
  pay_to: string;
  network: "base" | "base-sepolia" | "eip155:8453" | "eip155:84532";
  amount: string;
  description?: string;
};
PropertyTypeDescription
assetstringThe USDC token contract address for the network (e.g., 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 for Base)
pay_tostringThe wallet address to receive payments
network"base" | "base-sepolia" | "eip155:8453" | "eip155:84532"The blockchain network for transactions. Accepts friendly names or EIP-155 chain IDs
amountstringThe amount required in USDC smallest units (6 decimals). Example: "10000" = $0.01
descriptionstringOptional description for this requirement

PaymentInstruction

Represents a complete payment instruction with all its requirements.
type PaymentInstruction = {
  id: string;
  version: number;
  payment_requirements: PaymentRequirement[];
  name: string;
  description?: string;
  created_at: string;
};
PropertyTypeDescription
idstringUnique identifier for the payment instruction
versionnumberVersion number of the instruction
payment_requirementsPaymentRequirement[]Array of payment requirements
namestringName of the payment instruction
descriptionstringOptional description
created_atstringISO timestamp of creation

CreatePaymentInstructionRequest

Request body for creating a new payment instruction.
type CreatePaymentInstructionRequest = {
  name: string;
  payment_requirements: PaymentRequirement[];
  description?: string;
};

UpdatePaymentInstructionRequest

Request body for updating an existing payment instruction.
type UpdatePaymentInstructionRequest = {
  name?: string;
  payment_requirements?: PaymentRequirement[];
  description?: string;
};

PaymentInstructionListQuery

Query parameters for listing payment instructions.
type PaymentInstructionListQuery = {
  limit?: number;
  pageToken?: string;
  cid?: string;
  name?: string;
  id?: string;
};
PropertyTypeDescription
limitnumberMaximum number of results to return
pageTokenstringPagination token for next page
cidstringFilter by associated CID
namestringFilter by instruction name
idstringFilter by instruction ID

PaymentInstructionListResponse

Response structure for listing payment instructions.
type PaymentInstructionListResponse = {
  data: {
    payment_instructions: PaymentInstruction[];
    next_page_token?: string;
  };
};

PaymentInstructionResponse

Response structure for single payment instruction operations.
type PaymentInstructionResponse = {
  data: PaymentInstruction;
};

PaymentInstructionDeleteResponse

Response structure for delete operations.
type PaymentInstructionDeleteResponse = {
  data: {};
};

CidListQuery

Query parameters for listing CIDs associated with a payment instruction.
type CidListQuery = {
  limit?: number;
  pageToken?: string;
};

CidListResponse

Response structure for listing CIDs.
type CidListResponse = {
  data: {
    cids: string[];
    next_page_token?: string;
  };
};

CidAssociation

Represents a CID associated with a payment instruction.
type CidAssociation = {
  payment_instruction_id: string;
  cid: string;
  created_at: string;
};
PropertyTypeDescription
payment_instruction_idstringID of the associated payment instruction
cidstringThe IPFS CID
created_atstringISO timestamp of when the association was created

CidAssociationResponse

Response structure for adding a CID to a payment instruction.
type CidAssociationResponse = {
  data: CidAssociation;
};

CidRemoveResponse

Response structure for removing a CID from a payment instruction.
type CidRemoveResponse = {
  data: {};
};