juspay/hyperswitch · error · Error

Invalid parameters provided to createPaymentIntentTest comma

Error message

Invalid parameters provided to createPaymentIntentTest command

What it means

Thrown synchronously by the createPaymentIntentTest command (cypress-tests/cypress/support/commands.js:2796) when its inputs fail a shape check: createPaymentBody is null/undefined/non-object, or data.Request.currency is missing. This is pure client-side validation — no HTTP call has been made — and always indicates a broken fixture or wrong call-site arguments.

Source

Thrown at cypress-tests/cypress/support/commands.js:2796

      Request: reqData,
      Response: resData,
    } = data || {};

    const validatedConfigs = validateConfig(configs);
    if (validatedConfigs?.TRIGGER_SKIP) {
      cy.task(
        "cli_log",
        "TRIGGER_SKIP enabled, skipping createPaymentIntentTest"
      );
      return;
    }

    if (
      !createPaymentBody ||
      typeof createPaymentBody !== "object" ||
      !reqData.currency
    ) {
      throw new Error(
        "Invalid parameters provided to createPaymentIntentTest command"
      );
    }

    const configInfo = execConfig(validatedConfigs);
    const profile_id = globalState.get(`${configInfo.profilePrefix}Id`);

    const body = JSON.parse(JSON.stringify(createPaymentBody));
    for (const key in reqData) {
      body[key] = reqData[key];
    }
    body.authentication_type = authentication_type;
    body.capture_method = capture_method;
    body.customer_id = globalState.get("customerId");
    body.profile_id = profile_id;

    const headers = {
      "Content-Type": "application/json",

View on GitHub (pinned to 9b8b89dc37)

Solutions

  1. Check the two preconditions in order: createPaymentBody must be an object, and data.Request.currency must be a non-empty currency code
  2. Fix the fixture: add "currency": "USD" (or the intended ISO-4217 code) to the Request block
  3. Verify argument order at the call site: (createPaymentBody, data, authentication_type, capture_method, globalState, connectedMerchantId)
  4. Print the data object before the call to spot shape drift

Example fix

// before — fixture without currency, throws synchronously
{ "Request": { "amount": 100 } }
// after
{ "Request": { "amount": 100, "currency": "USD" } }
Defensive patterns

Strategy: validation

Validate before calling

const hasIntentParams = (body, data) =>
  Boolean(body) && typeof body === 'object' && Boolean(data && data.Request && data.Request.currency);
if (!hasIntentParams(createPaymentBody, data)) {
  throw new Error('Fixture invalid: need a createPaymentBody object and Request.currency');
}

Type guard

const isCreateIntentInput = (b, d) =>
  typeof b === 'object' && b !== null &&
  typeof d?.Request?.currency === 'string' && d.Request.currency.length === 3;

Prevention

When it happens

Trigger: The test-data JSON lacks currency in its Request block; the spec passes arguments in the wrong order (data before body); the destructured data.Request is undefined because the fixture shape changed; the body fixture accidentally set to null.

Common situations: Fixture-schema refactors dropping currency; copying a spec and swapping the first two parameters; JSON typos like 'Currency' vs 'currency'; shared data files drifting from the command's expected shape.

Related errors


AI-assisted analysis of juspay/hyperswitch@9b8b89dc37 (2026-08-16). Data as JSON: /api/errors/4d94a5359ebf0861. Report an issue: GitHub.