> ## Documentation Index
> Fetch the complete documentation index at: https://docs.methodfi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Transaction

export const ParamList = ({items = [], is_child = false}) => {
  return items.map(item => {
    const field_props = {
      id: Math.random().toString(),
      body: item.name,
      name: item.name,
      type: item.type,
      required: item.required
    };
    const enums = item.enums || [];
    const items = item.items || [];
    const has_items = items?.length > 0;
    const has_enums = enums?.length > 0;
    const should_default_open = item.defaultOpen || false;
    const render_child_item = () => {
      const child_props = {
        title: has_enums ? "Possible enum values" : "properties"
      };
      if (should_default_open) child_props.defaultOpen = true;
      const has_inline_enums = has_enums && enums.every(enum_item => typeof enum_item === 'string') && enums.map((enum_item, idx) => {
        const is_last = idx === enums.length - 1;
        const is_2nd_to_last = idx === enums.length - 2;
        return <>
            <code>{enum_item}</code>
            {is_last && ''}
            {is_2nd_to_last && ' or '}
            {!is_last && !is_2nd_to_last && ', '}
          </>;
      });
      const enum_list = has_enums && !has_inline_enums && <Accordion {...child_props}>
          {enums.map((enum_item, index) => <div key={`enum-${index}`}>
              <code>{enum_item.name}</code>
              <br />
              <p>{enum_item.description}</p>
            </div>)}
        </Accordion>;
      const item_list = has_items && <Expandable {...child_props}>
          <ParamList items={items || []} is_child />
        </Expandable>;
      return <>
          <p>
            {item.description}
            {has_inline_enums && [has_inline_enums.length > 1 ? ' One of ' : ' Must be ', ...has_inline_enums]}
          </p>

          {enum_list}
          {item_list}
        </>;
    };
    return is_child ? <ResponseField {...field_props}>{render_child_item()}</ResponseField> : <ParamField {...field_props}>{render_child_item()}</ParamField>;
  });
};

Transaction simulation is available for Credit Card Accounts that have been verified and are subscribed to the Transactions product.

Simulating a Transaction will mimic a new transaction created by the credit card networks for a specific Account.

## Path Parameters

<ParamList
  items={[
{
name: 'acc_id',
type: 'string',
required: true,
description: 'ID of the Account.',
},
]}
/>

## Body

<ParamList
  items={[
{
name: 'type',
type: 'enum',
required: false,
enums: ['purchase', 'return', 'void'],
description: "The type of transaction to simulate.",
}
]}
/>

## Returns

Returns the Transaction object.

<RequestExample>
  ```bash cURL theme={null}
  curl https://dev.methodfi.com/simulate/accounts/{acc_id}/transactions \
    -X POST \
    -H "Method-Version: 2026-03-30" \
    -H "Authorization: Bearer sk_WyZEWVfTcH7GqmPzUPk65Vjc" \
    -H "Content-Type: application/json" \
    -d '{
      "type": "purchase"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await method
    .accounts(acc_id)
    .simulate
    .transactions
    .create({
      type: "purchase"
    });
  ```

  ```python Python theme={null}
  response = method
    .accounts(acc_id)
    .simulate
    .transactions
    .create({"type": "purchase"})
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "id": "txn_t73AdHRFYwhT9",
    "account_id": "acc_XtKTpHLGhD9Qn",
    "status": "posted",
    "descriptor": "SQ *BENNU COFFEE",
    "merchant": null,
    "merchant_category_code": "5441",
    "amount": 3764,
    "auth_amount": 3764,
    "currency_code": "USD",
    "transaction_amount": 3764,
    "transaction_auth_amount": 3764,
    "transaction_currency_code": "USD",
    "transacted_at": "2025-03-05T07:48:06.000Z",
    "posted_at": "2025-03-06T05:00:00.000Z",
    "voided_at": null,
    "original_txn_id": null,
    "created_at": "2025-03-24T03:54:29.283Z",
    "updated_at": "2025-03-24T04:04:39.200Z"
  }
  ```
</ResponseExample>
