# Set up a subscription with bank transfers

Learn how to create and charge for a subscription with bank transfers.

Use this guide to set up a *subscription* (A Subscription represents the product details associated with the plan that your customer subscribes to. Allows you to charge the customer on a recurring basis) using [bank transfers](https://docs.stripe.com/payments/bank-transfers.md) as a payment method.

## Create a product and price [Dashboard] [Server-side]

*Products* (Products represent what your business sells—whether that's a good or a service) and *Prices* (Prices define how much and how often to charge for products. This includes how much the product costs, what currency to use, and the interval if the price is for subscriptions) are core resources for Subscriptions. [Create a product and a recurring price](https://docs.stripe.com/products-prices/manage-prices.md#create-product). Save the price ID—you’ll need it later in this guide.

## Create or retrieve a customer [Server-side]

To start, create a customer (either a customer-configured [Account](https://docs.stripe.com/api/v2/core/accounts/object.md#v2_account_object-configuration-customer) object or a [Customer](https://docs.stripe.com/api/customers/object.md) object) with a valid email address, if one doesn’t already exist. The valid email address ensures that the customer can receive invoices you send to them.

#### Accounts v2

Funds from bank transfers are held in the customer’s [cash balance](https://docs.stripe.com/payments/customer-balance.md), so you have to associate a customer with each bank transfer subscription. To manage the cash balance for a customer-configured `Account`, use the Customers API endpoint with the Account ID as the path parameter, for example `v1/customers/acct_xxxxx/cash_balances`.

```curl
curl -X POST https://api.stripe.com/v2/core/accounts \
  -H "Authorization: Bearer <<YOUR_SECRET_KEY>>" \
  -H "Stripe-Version: $latestPreviewApiVersion" \
  --json '{
    "contact_email": "jenny.rosen@example.com",
    "display_name": "Jenny Rosen",
    "configuration": {
        "customer": {}
    },
    "include": [
        "configuration.customer"
    ]
  }'
```

#### Customers v1

Funds from bank transfers are held in the customer’s [cash balance](https://docs.stripe.com/payments/customer-balance.md), so you have to associate a [Customer](https://docs.stripe.com/api/customers.md) object with each bank transfer subscription.

```curl
curl https://api.stripe.com/v1/customers \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "name=Jenny Rosen" \
  --data-urlencode "email=jenny.rosen@example.com"
```

## Create the subscription [Server-side]

[Create](https://docs.stripe.com/api/subscriptions/create.md) the subscription using the customer ID and price ID from the previous steps.

- Set [collection_method](https://docs.stripe.com/api/subscriptions/create.md#create_subscription-collection_method) to `send_invoice`.
- Set [days_until_due](https://docs.stripe.com/api/subscriptions/create.md#create_subscription-days_until_due) to configure how many days the customer has to pay the *invoice* (Invoices are statements of amounts owed by a customer. They track the status of payments from draft through paid or otherwise finalized. Subscriptions automatically generate invoices, or you can manually create a one-off invoice).

#### Accounts v2

```curl
curl https://api.stripe.com/v1/subscriptions \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d customer_account={{CUSTOMER_ACCOUNT_ID}} \
  -d "items[0][price]={{PRICE_ID}}" \
  -d collection_method=send_invoice \
  -d days_until_due=30 \
  -d "payment_settings[payment_method_types][0]=customer_balance"
```

#### Customers v1

```curl
curl https://api.stripe.com/v1/subscriptions \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d customer={{CUSTOMER_ID}} \
  -d "items[0][price]={{PRICE_ID}}" \
  -d collection_method=send_invoice \
  -d days_until_due=30 \
  -d "payment_settings[payment_method_types][0]=customer_balance"
```

An invoice is sent to the customer when the Subscription is due. The invoice is marked as paid if the customer has enough funds in their [cash balance](https://docs.stripe.com/payments/customer-balance.md). Otherwise, it contains the necessary information needed for the customer to push funds from their bank account. This invoice also has a link to the [Hosted Invoice Page](https://docs.stripe.com/invoicing/hosted-invoice-page.md). Subsequent invoices use the price you created in the first step.

Learn more about [bank transfer invoices](https://docs.stripe.com/invoicing/bank-transfer.md).

## Optional: Create a subscription schedule [Server-side]

To schedule changes to this subscription, [create](https://docs.stripe.com/api/subscription_schedules/create.md) a [subscription schedule](https://docs.stripe.com/billing/subscriptions/subscription-schedules.md).

Set [from_subscription](https://docs.stripe.com/api/subscription_schedules/create.md#create_subscription_schedule-from_subscription) to the subscription ID from the previous step.

```curl
curl https://api.stripe.com/v1/subscription_schedules \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d from_subscription={{SUBSCRIPTION_ID}}
```

## Test your integration

Use the Stripe Dashboard or CLI to simulate an [inbound transfer of funds](https://docs.stripe.com/payments/bank-transfers/accept-a-payment.md#test-your-integration).

As soon as you receive a fund, Stripe performs [automatic](https://docs.stripe.com/invoicing/bank-transfer.md#automatic-transfer-reconciliation) or [manual](https://docs.stripe.com/invoicing/bank-transfer.md#manual-reconciliation) reconciliation of the invoice.
