# 银行转账

Accept bank transfer payments on your invoices.

You can offer your customers the ability to pay your invoices with bank transfers, such as ACH in the US, or Bacs in the UK. Stripe creates a unique virtual bank account number and displays it on the invoice PDF and the [hosted invoice page](https://docs.stripe.com/invoicing/hosted-invoice-page.md), so your customers know where to send the funds.

Stripe automatically reconciles these bank transfers to the correct invoices when they’re received. If we can’t automatically reconcile a transfer, it remains in the customer balance until you manually reconcile it.

This method allows you to accept bank transfers without exposing your own bank details.

## Receive a bank transfer 

You can enable bank transfer as a supported payment method through the Dashboard or API.

#### 管理平台

To enable bank transfers as a default payment method for USD and GBP invoices:

1. In the Stripe Dashboard, go to **Settings** > **Billing** > [Invoices](https://dashboard.stripe.com/settings/billing/invoice).
2. Under **Default payment methods**, select **Edit payment methods**.
3. On the next page, click **Turn on** for **Bank transfer**.
4. After the bank transfer payment method shows an active status, bank transfer payments display by default for any new invoice you create. If **Bank transfer** doesn’t appear on the invoice settings page, first enable it in your [Payment methods settings](https://dashboard.stripe.com/settings/payment_methods).

> For all other currencies, you can’t enable bank transfers as a default payment method. However, you can add it as a payment method on individual invoices.

#### API

The following diagram shows an overview of the common steps when accepting a bank transfer payment:

接受银行转账付款时的一般步骤 (See full diagram at https://docs.stripe.com/invoicing/bank-transfer)

```text
[服务器] -- Stripe 创建了一个包含以下银行账户信息的账单：POST /v1/invoices --> [Stripe]
[Stripe] -- 已邮件发送账单 --> [客户]
[客户] -- 客户通过银行转账方式发送了正确金额的资金 --> [Stripe]
[Stripe] -- 向现金余额充值 --> [Stripe]
[Stripe] -- 核对欠款账单 --> [Stripe]
[Stripe] -- POST invoice.paid webhook --> [服务器]
[Stripe] -- POST payment_intent.succeeded webhook --> [服务器]
[服务器] -- 用 200 OK 响应 --> [Stripe]
```

To enable bank transfers, add `customer_balance` to an invoice using the API. You can then make an API call to create an invoice with bank transfers as a payment method.

If you represent your customers as customer-configured [Account](https://docs.stripe.com/api/v2/core/accounts/object.md) objects instead of [Customer](https://docs.stripe.com/api/customers/object.md) objects, replace the `customer` parameter in these code examples with the `customer_account` parameter. For more details, see [Represent customers using Account objects](https://docs.stripe.com/accounts-v2/use-accounts-as-customers.md).

#### EU

首先，创建一张账单。

```curl
curl https://api.stripe.com/v1/invoices \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "customer={{CUSTOMER_ID}}" \
  -d "payment_settings[payment_method_types][]=customer_balance" \
  -d "payment_settings[payment_method_options][customer_balance][funding_type]=bank_transfer" \
  -d "payment_settings[payment_method_options][customer_balance][bank_transfer][type]=eu_bank_transfer" \
  -d "payment_settings[payment_method_options][customer_balance][bank_transfer][eu_bank_transfer][country]=NL" \
  -d collection_method=send_invoice \
  -d days_until_due=30
```

然后您即可向账单中添加一个或多个账单明细项。

```curl
curl https://api.stripe.com/v1/invoiceitems \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d amount=1234 \
  -d currency=eur \
  -d "customer={{CUSTOMER_ID}}" \
  -d "description=Professional services" \
  -d "invoice={{INVOICE_ID}}"
```

然后您就可以最终确认账单了。

```curl
curl -X POST https://api.stripe.com/v1/invoices/{{INVOICE_ID}}/finalize \
  -u "<<YOUR_SECRET_KEY>>:"
```

账单确认后，您的客户可以在托管账单页面上查看他们的付款说明。托管账单页面的 URL 被以 `hosted_invoice_url` 包含在 API 响应中。

#### UK

首先，创建一张账单。

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

然后您即可向账单中添加一个或多个账单明细项。

```curl
curl https://api.stripe.com/v1/invoiceitems \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d amount=1234 \
  -d currency=gbp \
  -d "customer={{CUSTOMER_ID}}" \
  -d "description=Professional services" \
  -d "invoice={{INVOICE_ID}}"
```

然后您就可以最终确认账单了。

```curl
curl -X POST https://api.stripe.com/v1/invoices/{{INVOICE_ID}}/finalize \
  -u "<<YOUR_SECRET_KEY>>:"
```

账单确认后，您的客户可以在托管账单页面上查看他们的付款说明。托管账单页面的 URL 被以 `hosted_invoice_url` 包含在 API 响应中。

#### JP

首先，创建一张账单。

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

然后您即可向账单中添加一个或多个账单明细项。

```curl
curl https://api.stripe.com/v1/invoiceitems \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d amount=1234 \
  -d currency=jpy \
  -d "customer={{CUSTOMER_ID}}" \
  -d "description=Professional services" \
  -d "invoice={{INVOICE_ID}}"
```

然后您就可以最终确认账单了。

```curl
curl -X POST https://api.stripe.com/v1/invoices/{{INVOICE_ID}}/finalize \
  -u "<<YOUR_SECRET_KEY>>:"
```

账单确认后，您的客户可以在托管账单页面上查看他们的付款说明。托管账单页面的 URL 被以 `hosted_invoice_url` 包含在 API 响应中。

#### MX

首先，创建一张账单。

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

然后您即可向账单中添加一个或多个账单明细项。

```curl
curl https://api.stripe.com/v1/invoiceitems \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d amount=1234 \
  -d currency=mxn \
  -d "customer={{CUSTOMER_ID}}" \
  -d "description=Professional services" \
  -d "invoice={{INVOICE_ID}}"
```

然后您就可以最终确认账单了。

```curl
curl -X POST https://api.stripe.com/v1/invoices/{{INVOICE_ID}}/finalize \
  -u "<<YOUR_SECRET_KEY>>:"
```

账单确认后，您的客户可以在托管账单页面上查看他们的付款说明。托管账单页面的 URL 被以 `hosted_invoice_url` 包含在 API 响应中。

#### US

首先，创建一张账单。

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

然后您即可向账单中添加一个或多个账单明细项。

```curl
curl https://api.stripe.com/v1/invoiceitems \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d amount=1234 \
  -d currency=usd \
  -d "customer={{CUSTOMER_ID}}" \
  -d "description=Professional services" \
  -d "invoice={{INVOICE_ID}}"
```

然后您就可以最终确认账单了。

```curl
curl -X POST https://api.stripe.com/v1/invoices/{{INVOICE_ID}}/finalize \
  -u "<<YOUR_SECRET_KEY>>:"
```

账单确认后，您的客户可以在托管账单页面上查看他们的付款说明。托管账单页面的 URL 被以 `hosted_invoice_url` 包含在 API 响应中。

### Handle underpayments and overpayments 

通过银行转账付款时，客户的实际转账金额有可能多于或少于预期付款金额。如果客户转账金额不足，Stripe 会先将收到的部分款项记入未结的 Payment Intent 中。但账单不会部分入账，将在全额到账前保持未结状态。

如果客户支付的金额超过预期金额，Stripe 会尝试核对收到的金额和未结金额，并将剩余的超出金额保留在客户余额中。了解更多有关 [Stripe 如何处理对账](https://docs.stripe.com/payments/customer-balance/reconciliation.md) 的信息。

客户少付时：

客户发送了一笔小于预期金额的银行转账 (See full diagram at https://docs.stripe.com/invoicing/bank-transfer)

```text
[Stripe] -- POST cash_balance.funds_available --> [服务器]
[服务器] -- 用 200 OK 响应 --> [Stripe]
```

客户多付时：

客户发送了一笔大于预期金额的银行转账 (See full diagram at https://docs.stripe.com/invoicing/bank-transfer)

```text
[Stripe] -- POST payment_intent.succeeded --> [服务器]
[Stripe] -- POST cash_balance.funds_available --> [服务器]
[Stripe] -- POST invoice.paid --> [服务器]
[服务器] -- 用 200 OK 响应 --> [Stripe]
```

## Automatic transfer reconciliation 

When Stripe receives an inbound transfer, it uses the transfer’s reference code and amount to find matching invoices.

If multiple invoices are eligible, Stripe prioritizes them by due date or finalization date. If reference matching doesn’t use all the funds, later matching steps consider the customer’s full cash balance, including unreconciled funds from earlier transfers.

### Reference codes 

​​Transfers commonly include a memo, such as:

- *INVOICE-0011*
- *Payment for INVOICE-0001*
- *This is for 001. I’ll send the check for 002 next week.*

If the memo contains an invoice number, Stripe first attempts to reconcile the transfer to the referenced invoice. A direct reference match bypasses the 365-day overdue limit. Stripe reconciles the transfer to the matched invoice regardless of how long it’s been overdue.

### Exact amount 

If there’s no reference match, Stripe looks for the oldest open invoice where the amount precisely matches the amount available in the cash balance. If we find one, we reconcile the funds to the invoice. For amount-based and multi-invoice matching, Stripe can only reconcile cash balance funds to open or past due invoices that are less than 365 days overdue.

### Multiple invoices 

If any balance remains, it’s possible that your customer tried to pay multiple invoices with one or more transfers. Stripe looks for a group of invoices (five or fewer) where the available cash balance matches the total expected. If there are multiple possible combinations, Stripe selects the smallest combination. If there are multiple options for the smallest combination, Stripe selects the combination that contains the oldest invoice.

### Oldest payable invoice 

If more balance remains, it’s possible that your customer tried to pay multiple invoices with one transfer, or transferred extra funds. Stripe progressively pays open invoices by due date or until no invoices remain to pay.

### Reconciliation failures 

When funds transferred to Stripe aren’t reconciled to any open [PaymentIntents](https://docs.stripe.com/api/payment_intents.md) or invoices, the funds are placed in the customer balance and Stripe sends the `cash_balance.funds_available` *webhook* (A configurable endpoint that executes when it receives certain event notifications from an event destination).

## Manual reconciliation 

In certain circumstances, you might want to [override the Stripe automatic reconciliation](https://docs.stripe.com/payments/customer-balance/reconciliation.md#cash-manual-reconciliation) behavior on a per-customer basis.

In manual reconciliation mode, Stripe doesn’t attempt to automatically reconcile any funds received, so you must manually reconcile all payments.

Learn more about [manual payment application](https://docs.stripe.com/invoicing/apply-payments.md).

## Unreconciled cash balance funds 

Funds might remain unreconciled in a customer balance, for example, if a customer sends excess funds and there are no open invoices. If funds remain unreconciled for 75 days, Stripe automatically attempts to return the aged portion to the customer’s bank account. A return can fail if the customer’s bank can’t process it (for example, if the bank account is closed).

Newer funds remain in the cash balance and follow their own 75-day timeline. If the aged funds remain at the 90-day mark, Stripe transfers that portion to your Stripe account balance instead of making another return attempt.

You can see the full list of customers who have [unreconciled cash balances](https://docs.stripe.com/payments/customer-balance/reconciliation.md#cash-unreconciled-funds) and the attempted return date in your [Dashboard](https://dashboard.stripe.com/test/customers?tab=remaining_balance).

## Confirm account ownership 

Your customer might want to verify your bank details before initiating a transfer. If they ask for account ownership verification (or a bank verification letter), you can [download a letter confirming account ownership](https://docs.stripe.com/payments/customer-balance/funding-instructions/account-ownership-letter.md).

## Underpayments 

Your customer’s payment might be slightly less than the amount required to pay the invoice fully. This can be common with international wire transfers. Instead of handling this and similar situations manually, you can configure an underpayment threshold below which you consider it acceptable to automatically close the invoice and credit the customer the difference.

To configure this setting, go to **Settings** > **Billing** > [Invoices](https://dashboard.stripe.com/settings/billing/invoice). Under **Adjustments and reconciliation**, enable **Automatically write-off invoices**.

When you finalize an invoice, Stripe applies the customer’s existing cash balance if it can fully pay the invoice after accounting for this threshold. If the available balance is less than that amount, Stripe leaves the funds in the cash balance instead of partially applying them to the newly finalized invoice.

## Partial payments 

If your customer wants to pay an invoice with multiple payments, you can allow Stripe to automatically reconcile incoming bank transfer payments to open or past due invoices, even if the amount of the transfer doesn’t fully pay an invoice. We only attempt a partial reconciliation if your customer provides an invoice number in the transfer memo.

This setting applies when an incoming bank transfer arrives. It doesn’t cause Stripe to partially apply an existing cash balance when you finalize a new invoice.

To configure this setting, go to **Settings** > **Billing** > [Invoices](https://dashboard.stripe.com/settings/billing/invoice). Under **Adjustments and reconciliation**, enable **Automatically reconcile partial bank transfer payments**.

## Payment instructions 

For each customer, Stripe generates a unique, virtual bank account number that can accept transfers in the currency of the invoice. The transfer instructions for this virtual bank account are visible to your customer on invoices.

The payment details Stripe creates are:

- **Unique**: No customers have the same account number.
- **Consistent**: A single customer consistently receives the same funding instructions across multiple invoices.
- **Currency-appropriate**: In countries where bank transfers are supported, Stripe generates local bank account information (for example, a UK account for customers in the UK).
- **Customer-localized**: Payment instructions shown on invoices respect [customer-preferred languages](https://docs.stripe.com/invoicing/customize.md#customer-language), so you can localize instructions for each customer.

In some countries, Stripe also provides you with a unique transfer reference number for your customer to include with each transfer to help match the transfer against outstanding payments. Some countries have limits on the number of virtual bank account numbers that you can create for free.

​​After a virtual bank account in Stripe receives a transfer, Stripe automatically reconciles the funds to open invoices and creates a payment to pay the invoice.

## Refund transfers 

You can refund completed payments directly to the customer’s bank account or to the customer balance on Stripe. If you enabled automatic reconciliation and you send funds to the customer balance, Stripe automatically attempts to reconcile the funds to open invoices.

## Testing 

You can [test an inbound transfer of funds](https://docs.stripe.com/payments/bank-transfers/accept-a-payment.md?payment-ui=direct-api#test-your-integration) in the Dashboard or with the Stripe CLI.
