Skip to main content

Plans

List plans by merchant

GET /v0/plans/:merchant

Returns all plans for the merchant across all modules they own.

Auth: API key or SIWE session

Path parameters:

ParameterTypeDescription
merchantstringMerchant wallet address (0x…)

Query parameters:

ParameterTypeRequiredDescription
chain_idnumberNoChain ID to filter. Defaults to the indexer's configured chain.

Response fields:

FieldTypeDescription
plan_id_on_chainstringOn-chain plan ID
module_addressstringSubscriptionModule contract address
merchant_addressstringMerchant wallet address
token_addressstringPayment token contract address
pricestringAmount charged per billing cycle, in token base units
token_decimalsnumber | nullToken decimal places (e.g. 6 for USDC)
token_symbolstring | nullToken symbol (e.g. "USDC")
billing_intervalstringBilling interval in seconds
grant_amountstringCredit grant amount (for credit modules)
namestring | nullHuman-readable plan name
descriptionstring | nullPlan description
activebooleanWhether the plan is accepting new subscribers
created_atstringISO 8601 creation timestamp
info

price and billing_interval are returned as strings because they are bigint values on-chain. Parse with BigInt() in JavaScript or handle as strings to avoid precision loss.

Example request:

const res = await fetch(
'https://api.amser.io/v0/plans/0xMerchantAddress',
{
headers: {
'Authorization': `Bearer ${process.env.AMSER_API_KEY}`,
},
}
);
const plans = await res.json();

Example response:

[
{
"plan_id_on_chain": "1",
"module_address": "0xabcdef1234567890abcdef1234567890abcdef12",
"merchant_address": "0x2222222222222222222222222222222222222222",
"token_address": "0x036cbd53842c5426634e7929541ec2318f3dcf7e",
"price": "10000000",
"token_decimals": 6,
"token_symbol": "USDC",
"billing_interval": "2592000",
"grant_amount": "0",
"name": "Pro Plan",
"description": "Monthly pro subscription",
"active": true,
"created_at": "2026-01-15T12:00:00.000Z"
}
]

In this example, the price of "10000000" with token_decimals: 6 represents 10 USDC. The billing interval of "2592000" seconds is 30 days.


Get plan by ID

GET /v0/plans/:merchant/:id

Returns a single plan by its on-chain plan ID.

Auth: API key or SIWE session

Path parameters:

ParameterTypeDescription
merchantstringMerchant wallet address (0x…)
idstringOn-chain plan ID

The response shape is identical to a single element from the list endpoint.


List plans by module

GET /v0/modules/:moduleAddress/plans

Returns all plans for a specific module address. This is the correct endpoint for frontends building a public pricing page — it does not require authentication.

Auth: None required (public endpoint — plan data is public)

Path parameters:

ParameterTypeDescription
moduleAddressstringSubscriptionModule contract address (0x…)

Query parameters:

ParameterTypeRequiredDescription
chain_idnumberNoChain ID to filter

The response shape is the same array format as the merchant list endpoint.

Example request:

const res = await fetch(
'https://api.amser.io/v0/modules/0xModuleAddress/plans'
);
const plans = await res.json();