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

# Add Funds to Your Balance

> Top up your platform balance to pay out connected accounts

<Steps>
  <Step title="Save a payment method on your account">
    Create a top up from the [Dashboard](https://whop.com/dashboard/balance/), or save a card through the API with [Create setup intent](/api-reference/beta/setup-intents/create-setup-intent) and `owner_id` set to your account ID. Either saves a payment method on your account that you can reuse programmatically.
  </Step>

  <Step title="Get payment methods">
    List saved payment methods for your account:

    <CodeGroup>
      ```typescript TypeScript theme={null}
      const paymentMethods = await client.paymentMethods.list({
        company_id: "biz_xxxxxxxxxxxxx",
      });

      const paymentMethod = paymentMethods.data[0];
      ```

      ```python Python theme={null}
      payment_methods = client.payment_methods.list(
          company_id="biz_xxxxxxxxxxxxx",
      )

      payment_method = payment_methods.items[0]
      ```

      ```rust Rust theme={null}
      let payment_methods = client
          .payment_methods
          .list(
              &PaymentMethodsListQueryRequest {
                  company_id: Some("biz_xxxxxxxxxxxxx".to_string()),
                  ..Default::default()
              },
              None,
          )
          .await?;

      let payment_method = &payment_methods.data[0];
      println!("{payment_method:?}");
      ```

      ```go Go theme={null}
      page, err := client.PaymentMethods.List(context.TODO(), &whopsdk.ListPaymentMethodsRequest{
          CompanyID: whopsdk.String("biz_xxxxxxxxxxxxx"),
      })
      if err != nil {
          log.Fatal(err)
      }

      paymentMethod := page.Results[0]
      fmt.Println(paymentMethod)
      ```
    </CodeGroup>
  </Step>

  <Step title="Create a top up">
    Create a deposit to your account and pass the saved payment method to charge:

    <CodeGroup>
      ```typescript TypeScript theme={null}
      const deposit = await client.deposits.create({
        destination: "biz_xxxxxxxxxxxxx",
        amount: 1000.0,
        payment_method_id: paymentMethod.id,
      });

      console.log(deposit.card?.payment_id);
      ```

      ```python Python theme={null}
      deposit = client.deposits.create(
          destination="biz_xxxxxxxxxxxxx",
          amount=1000.0,
          payment_method_id=payment_method.id,
      )

      print(deposit.card.payment_id)
      ```
    </CodeGroup>

    In this example:

    * `destination` is your platform's account ID
    * `amount` is the amount in USD to add to your balance
    * `payment_method_id` is the saved payment method to charge

    The response's `card.payment_id` is the payment the charge created. The request needs an API key with the `payment:charge` scope.
  </Step>

  <Step title="Handle payment events">
    Listen for payment webhooks to confirm the top up was successful:

    ```typescript theme={null}
    if (webhookData.type === "payment.succeeded") {
      const payment = webhookData.data;
      console.log("Top up successful:", payment.id);
    }

    if (webhookData.type === "payment.failed") {
      const payment = webhookData.data;
      console.log("Top up failed:", payment.failure_message);
    }
    ```
  </Step>
</Steps>

## Related resources

<CardGroup cols={2}>
  <Card title="Collect payments for connected accounts" icon="arrow-right-arrow-left" href="/developer/platforms/collect-payments-for-connected-accounts">
    Transfer funds to connected accounts
  </Card>

  <Card title="Render payout portal" icon="browser" href="/developer/platforms/render-payout-portal">
    Let users withdraw their funds
  </Card>
</CardGroup>


## Related topics

- [Collect Payments for Connected Accounts](/developer/platforms/collect-payments-for-connected-accounts.md)
- [Payouts & Money Movement](/developer/payouts/overview.md)
- [Balances](/elements/beta/wallet/balances.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.