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

# Depositing Funds

> Depositing funds into internal accounts

Grid provides two options to fund an account:

* Prefund
* Just-in-time funding

With prefunding, you'll deposit funds into internal accounts via Wire, PIX, hosted payment page, or crypto transfers. You can then use the balances as the source of funds for quotes and transfers.

With just-in-time funding, you'll receive payment instructions as part of the quote. Once funds arrive, the payment to the receiver is automatically initiated.

<Note>
  Just-in-time funding supports instant payment rails only (for example: RTP,
  PIX, SEPA Instant).
</Note>

## Prerequisites

* You have created a customer (for customer-scoped internal accounts)
* You have `GRID_CLIENT_ID` and `GRID_CLIENT_SECRET`

<Tip>
  Export your credentials for use with cURL:

  ```bash theme={null}
  export GRID_CLIENT_ID="your_client_id"
  export GRID_CLIENT_SECRET="your_client_secret"
  ```
</Tip>

## Prefunding an account via push payments (Wire, SEPA, PIX, etc.)

When customers need to deposit funds themselves, display the funding payment instructions in your application:

<Steps>
  <Step title="Retrieve the internal account">
    Fetch the customer's internal account for their desired currency using the API.

    <CodeGroup>
      ```bash cURL (Customer accounts) theme={null}
      curl -X GET 'https://api.lightspark.com/grid/2025-10-13/customers/internal-accounts?customerId=Customer:019542f5-b3e7-1d02-0000-000000000001' \
        -u "$GRID_CLIENT_ID:$GRID_CLIENT_SECRET"
      ```

      ```bash cURL (Platform internal accounts) theme={null}
      curl -X GET 'https://api.lightspark.com/grid/2025-10-13/platform/internal-accounts' \
        -u "$GRID_CLIENT_ID:$GRID_CLIENT_SECRET"
      ```
    </CodeGroup>
  </Step>

  <Step title="Extract payment instructions">
    Parse the `fundingPaymentInstructions` array and select the appropriate instructions based on your customer's preferred payment method.

    ```javascript theme={null}
    const instructions = account.fundingPaymentInstructions[0];
    const bankInfo = instructions.accountOrWalletInfo;
    ```
  </Step>

  <Step title="Display instructions clearly">
    Show the payment details prominently in your UI and enable copy / paste:

    * Account holder name
    * Bank name and routing information (account/routing number, CLABE, PIX key, etc.)
    * Payment URL (for COP deposits, redirect the customer to the `paymentUrl` returned in the payment instructions)
    * Reference code (if provided)
    * Any additional notes from `instructionsNotes`
  </Step>

  <Step>
    Customer initiates a push payment from their bank or wallet to the account/address specified.
  </Step>

  <Step title="Monitor for deposits">
    Set up webhook listeners to receive updates for the deposit transaction and account balance updates. The account balance will update automatically.

    <Info>
      You'll receive `INTERNAL_ACCOUNT.BALANCE_UPDATED` webhook events when the internal account balance changes.
    </Info>
  </Step>
</Steps>

## Just-in-time funding (payment instructions from a quote)

With just-in-time funding, you request a quote and receive payment instructions (for example, a bank account or instant rail details). When your customer confirms the transaction, you trigger payment from your app.

More details of just-in-time funding can be found in the Sending Payments guides.
