payloadcms/payload · error · Error
Argument 'stripeArgs' must be an array.
Error message
Argument 'stripeArgs' must be an array.
What it means
Thrown by `stripeProxy` when `stripeMethod` resolves to a valid callable Stripe method but `stripeArgs` is not an array — the proxy spreads `foundMethod(...stripeArgs)`, so a non-array cannot be applied. This is a client payload-shape error, not a Stripe API error.
Source
Thrown at packages/plugin-stripe/src/utilities/stripeProxy.ts:37
// NOTE: Stripe API methods using reference "this" within their functions, so we need to bind context
const foundMethod = lodashGet(stripe, stripeMethod).bind(contextToBind)
if (typeof foundMethod === 'function') {
if (Array.isArray(stripeArgs)) {
try {
const stripeResponse = await foundMethod(...stripeArgs)
return {
data: stripeResponse,
status: 200,
}
} catch (error: unknown) {
return {
message: `A Stripe API error has occurred: ${error}`,
status: 404,
}
}
} else {
throw new Error(`Argument 'stripeArgs' must be an array.`)
}
} else {
throw Error(
`The provided Stripe method of '${stripeMethod}' is not a part of the Stripe API.`,
)
}
} else {
throw Error('You must provide a Stripe method to call.')
}
}
View on GitHub (pinned to 00c58b35c0)
Solutions
- Send `stripeArgs` as an array of positional arguments, e.g. `[{ limit: 100 }]` or `['cus_X']`
- If calling a method that takes an ID plus params, use `['cus_X', { metadata: {...} }]`
- Validate `Array.isArray(body.stripeArgs)` client-side before sending
Example fix
// before
{ stripeMethod: 'customers.list', stripeArgs: { limit: 10 } }
// after
{ stripeMethod: 'customers.list', stripeArgs: [{ limit: 10 }] } Defensive patterns
Strategy: validation
Validate before calling
// Enforce the stripeArgs shape before sending
const body = { stripeMethod, stripeArgs }
if (!Array.isArray(body.stripeArgs))
throw new Error('stripeArgs must be an array of positional args, e.g. [{ limit: 10 }]')
await fetch('/api/stripe', { method: 'POST', body: JSON.stringify(body) }) Type guard
function isValidStripePayload(p: unknown): p is { stripeMethod: string; stripeArgs: unknown[] } {
return !!p && typeof (p as any).stripeMethod === 'string' && Array.isArray((p as any).stripeArgs)
} Prevention
- Always send `stripeArgs` as a positional-args array, not an object
- For methods taking an ID plus options, use `[id, optionsObj]`
- Add a client-side type check so the error never reaches the server
When it happens
Trigger: POSTing to the Stripe REST endpoint with `stripeArgs` as an object (e.g. `{ limit: 10 }`) instead of an array (`[{ limit: 10 }]`); omitting `stripeArgs` so it is `undefined`; passing a JSON string instead of a parsed array.
Common situations: Misreading the example in `rest.ts` (`['cus_...']` or `[{ limit: 100 }, {...}]`) and sending a bare object; client serializer that wraps the value; copy-paste from a Stripe SDK call that takes positional args flattened to an object.
Related errors
- Invalid staged upload.
- PaymentIntent ID is required
- Cart items snapshot not found or invalid in the PaymentInten
- Currency is required.
- Cart is empty or not provided.
AI-assisted analysis of payloadcms/payload@00c58b35c0 (2026-08-12).
Data as JSON: /api/errors/7ab3a87aac0939c9.
Report an issue: GitHub.