# リーダー上のチップを回収

リーダー上のチップ処理を使用すると、顧客が支払い方法を提示する前に、推奨されるチップ金額をリーダーに表示できます。リーダーは、お客様の[チップオプション](https://docs.stripe.com/terminal/features/collecting-tips/on-reader.md#customize-tips-reader)に基づいて 3 種類の提示額を顧客に表示します。リーダーは、支払いを回収する呼び出しのたびに、チップ処理の選択画面を自動的に表示します。[支払いを確定する](https://docs.stripe.com/terminal/payments/collect-card-payment.md#confirm-payment)と、選択したチップを含む金額の `PaymentIntent` が確定されます。
![](https://b.stripecdn.com/docs-statics-srv/assets/wpe-darkmode-pay.fdf5e2100ca53b54e100a28b8589b1d1.png)

決済画面
![](https://b.stripecdn.com/docs-statics-srv/assets/wpe-darkmode-subtotal.50779461be74aa98f600aef3e7715a16.png)

チップの選択画面 (パーセント)
![](https://b.stripecdn.com/docs-statics-srv/assets/wpe-darkmode-total.eb4f25263c136bed268f68a6f5e82933.png)

合計画面
![](https://b.stripecdn.com/docs-statics-srv/assets/wpe-darkmode-approved.6eb33af4ca019de7621d07363e24dd8e.png)

承認画面

### サポート状況

- AT
- AU
- BE
- BG
- CA
- CH
- CY
- CZ
- DE
- DK
- EE
- ES
- FI
- FR
- GB
- GI
- HR
- HU
- IE
- IT
- JP
- LI
- LT
- LU
- LV
- MT
- MY
- NL
- NO
- NZ
- PL
- PT
- RO
- SE
- SG
- SI
- SK
- US

**リーダー:** [Stripe Reader S700/S710](https://docs.stripe.com/terminal/readers/stripe-reader-s700-s710.md)、[BBPOS WisePOS E](https://docs.stripe.com/terminal/readers/bbpos-wisepos-e.md)、[BBPOS WisePad 3](https://docs.stripe.com/terminal/readers/bbpos-wisepad3.md)

## リーダーでのチップ処理の有効化とカスタマイズ

[Configuration (設定)](https://docs.stripe.com/api/terminal/configuration.md) オブジェクトまたは[ダッシュボード](https://docs.stripe.com/terminal/fleet/configurations-overview.md?dashboard-or-api=dashboard#update-the-default-configuration-for-the-account)を使用して、リーダーのチップ処理を設定します。

- スマートチップで提示: リーダーは、チップ加算前の金額帯に応じて、3 種類のパーセンテージまたは金額を動的に表示します。
- パーセンテージで提示: リーダーにパーセンテージに基づく 3 種類のチップ金額を表示します。
- 金額を提示: リーダーに 3 種類のチップ金額を表示します。

BBPOS WisePad 3 でリーダー上のチップ機能を使用するには、以下の Terminal SDK のいずれかのバージョンを使用する必要があります。

- Android SDK 2.8.1 以上
- iOS SDK 2.16.1 以上

#### スマートチップを提示

チップを割合で 3 種類、または金額で 3 種類、リーダー上に提示できます。リーダーは、チップ加算前の金額のしきい値に応じて、これらのスマートチップのいずれかを動的に表示します。`Configuration` オブジェクトを次のように作成または更新します。デフォルトでは、割合に基づくチップは税引き後に計算されます。課税前のチップを提案するには、別の[チップ対象金額](https://docs.stripe.com/terminal/features/collecting-tips/on-reader.md#tip-eligible)を指定します。

```curl
curl https://api.stripe.com/v1/terminal/configurations \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "tipping[usd][percentages][]=15" \
  -d "tipping[usd][percentages][]=20" \
  -d "tipping[usd][percentages][]=25" \
  -d "tipping[usd][fixed_amounts][]=100" \
  -d "tipping[usd][fixed_amounts][]=200" \
  -d "tipping[usd][fixed_amounts][]=300" \
  -d "tipping[usd][smart_tip_threshold]=1000"
```

上記の例では、リーダーが提示する内容を動的に選択します。

- チップ加算前の金額が `smart_tip_threshold` (10 USD) を下回っている場合、リーダーには、上から順に 1 USD、$2、$3 のチップを提示する 3 種類のボタンが表示されます。
- チップ加算前の金額が `smart_tip_threshold` (10 USD) 以上の場合、リーダーには、上から順にチップ加算前の合計に対する 15%、20%、25% のチップを提示する 3 種類のボタンが表示されます。

#### パーセンテージで提示

リーダー上に 3 種類のチップの割合を提示できます。リーダーは `Configuration` オブジェクトを作成または更新するときに指定された順序で、チップ金額を表示します。デフォルトでは、これらのチップは税引き後に計算されます。課税前のチップを提案するには、別の[チップ対象金額](https://docs.stripe.com/terminal/features/collecting-tips/on-reader.md#tip-eligible)を指定します。

```curl
curl https://api.stripe.com/v1/terminal/configurations \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "tipping[usd][percentages][]=15" \
  -d "tipping[usd][percentages][]=20" \
  -d "tipping[usd][percentages][]=25"
```

上記の例では、リーダーが上から順に、チップ加算前の合計に対する 15%、20%、25% の金額で 3 種類のチップを提示します。

#### 金額で提示

3 種類のチップ金額をリーダー上に提示できます。USD での決済の場合、リーダーは `Configuration` オブジェクトを作成または更新するときに指定された順序でチップ金額を表示します。

```curl
curl https://api.stripe.com/v1/terminal/configurations \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "tipping[usd][fixed_amounts][]=100" \
  -d "tipping[usd][fixed_amounts][]=200" \
  -d "tipping[usd][fixed_amounts][]=300"
```

上記の例では、リーダーが上から順に、1 USD、2 USD、3 USD のチップを提示します。

`Configuration` オブジェクトで複数の通貨を指定する場合は、各通貨に同じ設定キーを指定する必要があります。たとえば、`USD` に `percentages` のみを指定した場合、他の通貨に `fixed_amounts` や `smart_tip_threshold` を指定することはできません。

チップ処理を設定して `Configuration` オブジェクトを作成したら、アカウントまたは店舗に[その設定を割り当てる](https://docs.stripe.com/terminal/fleet/configurations-overview.md?dashboard-or-api=api#create-a-configuration-for-an-individual-location)ことができます。BBPOS WisePad 3 リーダーは、POS アプリケーションに接続したときに新規または更新された設定を受信します。BBPOS WisePOS E リーダーが新規または更新された設定を受信するまでには、最大で 5 分かかります。

## 支払いを回収する

リーダーを介してチップを渡す場合は、[支払いの回収](https://docs.stripe.com/terminal/payments/collect-card-payment.md)の手順に従ってください。

[支払い方法を収集](https://docs.stripe.com/terminal/payments/collect-card-payment.md#collect-payment)するときに、リーダーにチップ選択画面が表示され、支払い方法の決定を促す前に、顧客にチップの選択を求めます。

[チップ処理の設定](https://docs.stripe.com/terminal/features/collecting-tips/on-reader.md#customize-tips-reader)に応じて、顧客は、提示されたチップを選択するか、カスタムのチップを指定するか、チップなしにすることができます。

顧客がこの選択を行うと、リーダーはカードが提示されるまで待機します。

支払いを処理すると、リーダーは選択されたチップを追加します。支払いが成功すると、`PaymentIntent` と `Charge` の [amount](https://docs.stripe.com/api/payment_intents/create.md#create_payment_intent-amount) が更新されて、チップ金額が加算されます。

PaymentIntent の確認前は、チップの金額は `amount_tip` フィールドに返されますが、`amount` には返されません。PaymentIntent の確認後、`amount_tip` フィールドはゼロに設定され、`amount` にはチップ金額が含まれます。チップ金額は [amount_details](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-amount_details) オブジェクトに返されます。

| シナリオ                          | [amount_details.tip.amount](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-amount_details-tip-amount) 戻り値 |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| リーダ上のチップ処理が無効である              | `null`                                                                                                                                 |
| リーダー上のチップ処理が有効で、チップが選択されていない  | `0`                                                                                                                                    |
| リーダー上のチップ処理が有効で、チップ金額が選択されている | 選択された金額                                                                                                                                |

次のケースでは、顧客に対してチップ処理の選択画面は表示されません。

1. `Configuration` オブジェクトにチップ処理設定がない場合。
1. チップ処理設定で `skipTipping` を有効にした場合。
1. リーダーがサポート対象外の国にある場合。
1. チップ設定を現在の支払い通貨に適用することができない場合。たとえば、決済が EUR であり、`Configuration` オブジェクトで USD のチップ処理のみが指定されている場合です。

Stripeリーダーで[支払いをテストする](https://docs.stripe.com/terminal/references/testing.md#physical-test-cards)とき、合計金額の小数点以下の値によっては、合計金額 (チップを含む) に対して支払い拒否のレスポンスがトリガーされることがあります。

## チップ処理のスキップ

チップ設定は無視してかまいません。これにより、支払いの回収時にリーダーのチップ選択画面を非表示にすることができます。

チップ選択画面は、個々の取引で非表示にすることも、一時的にすべての取引で非表示にすることもできます。これにより、顧客はカード提示画面に直接移動できます。

たとえば、レストランでは、テイクアウトの注文のチップはリーダーで受け付け、店内で食事をする顧客については[領収書上でのみチップ](https://docs.stripe.com/terminal/features/collecting-tips/on-receipt.md)を受け付けられるようにすることがあります。

チップ選択画面をスキップするには、以下のいずれかのオプションを使用します。

#### サーバー主導型

```curl
curl https://api.stripe.com/v1/terminal/readers/tmr_xxx/process_payment_intent \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "payment_intent=<payment_intent>" \
  -d "process_config[skip_tipping]=true"
```

#### JavaScript

```js
const result = await terminal.collectPaymentMethod(
  paymentIntent.secret,
  {
    config_override: {
      skip_tipping: true,
    },
  },
);


if ('error' in result) {
  console.log(`collectPayment failed: ${result.error}`);
  return;
}

console.log('collectPayment succeeded');
```

#### iOS

```swift
let collectConfig = try CollectPaymentIntentConfigurationBuilder().setSkipTipping(true).build()
let cancelable = Terminal.shared.collectPaymentMethod(intent, collectConfig: collectConfig) {
  intentWithPaymentMethod, attachError in
  if let error = attachError {
    // Placeholder for handling exception
  } else if let intent = intentWithPaymentMethod {
    // Placeholder for processing paymentIntent
  }
}
```

#### Android

```kotlin
val cancelable = Terminal.getInstance().collectPaymentMethod(
    paymentIntent,
    object : PaymentIntentCallback {
        override fun onSuccess(paymentIntent: PaymentIntent) {
            // Placeholder for handling successful operation
        }

        override fun onFailure(e: TerminalException) {
            // Placeholder for handling exception
        }
    },
    CollectPaymentIntentConfiguration.Builder()
        .skipTipping(true)
        .build()
)
```

#### React Native

```js
const { paymentIntent, error } = await collectPaymentMethod({
  paymentIntent: paymentIntent,
  skipTipping: true,
});


if (error) {
  console.log(`collectPayment failed: ${error.message}`);
  return;
}

console.log('collectPayment succeeded');
```

## チップ対象金額
![](https://b.stripecdn.com/docs-statics-srv/assets/wpe-tip-eligible-amount.4c189af877d87bd89aaf405409f16548.png)

支払いを回収する際に、チップ加算前の金額とは異なるチップ対象金額を設定できます。チップ対象金額を設定することで、パーセンテージに基づくチップの計算対象となる値が変更されます。また、顧客のチップ選択画面には、チップ加算前の金額の横にチップ対象金額が表示されます。

この設定は、商品を販売するだけでなくサービスを提供するビジネスに使用できます。たとえば、ヘアカットサービスとシャンプー商品を販売しているサロンでは、ヘアカットに対してのみパーセンテージに基づくチップを計算することを顧客に通知することができます。

#### サーバー主導型

```curl
curl https://api.stripe.com/v1/terminal/readers/tmr_xxx/process_payment_intent \
  -u "<<YOUR_SECRET_KEY>>:" \
  -d "payment_intent=<payment_intent>" \
  -d "process_config[tipping][amount_eligible]=1500"
```

#### JavaScript

```js
const result = await terminal.collectPaymentMethod(
  paymentIntent.secret,
  {
    config_override: {
      tipping: {
        eligible_amount: 1500,
      },
    },
  },
);


if ('error' in result) {
  console.log(`collectPayment failed: ${result.error}`);
  return;
}

console.log('collectPayment succeeded');
```

#### iOS

```swift
let tippingConfig = try TippingConfigurationBuilder().setEligibleAmount(1500).build()
let collectConfig = try CollectPaymentIntentConfigurationBuilder().setTippingConfiguration(tippingConfig).build()
let cancelable = Terminal.shared.collectPaymentMethod(intent, collectConfig: collectConfig) {
  intentWithPaymentMethod, attachError in
  if let error = attachError {
    // Placeholder for handling exception
  } else if let intent = intentWithPaymentMethod {
    // Placeholder for processing paymentIntent
  }
}
```

#### Android

```kotlin
val cancelable = Terminal.getInstance().collectPaymentMethod(
    paymentIntent,
    object : PaymentIntentCallback {
        override fun onSuccess(paymentIntent: PaymentIntent) {
            // Placeholder for handling successful operation
        }

        override fun onFailure(e: TerminalException) {
            // Placeholder for handling exception
        }
    },
    CollectPaymentIntentConfiguration.Builder()
        .setTippingConfiguration(
            TippingConfiguration.Builder()
                .setEligibleAmount(1500)
                .build()
        )
        .build()
)
```

#### React Native

```js
const { paymentIntent, error } = await collectPaymentMethod({
  paymentIntentId: paymentIntentId,
  skipTipping: false,
  tipEligibleAmount: 1500,
});


if (error) {
  console.log(`collectPayment failed: ${error.message}`);
  return;
}

console.log('collectPayment succeeded');
```

上記の例では、支払いの通貨に基づいてチップ対象金額を設定しています。USD での支払いの場合、チップ対象金額は 15 USD です。

`eligible_amount` の値は 0 以上である必要があります。 `eligible_amount` が 0 の場合、`skip_tipping` の値に関係なくチップはスキップされます。`eligible_amount` が PaymentIntent の金額と同じ場合、`eligible_amount` は無視され、指定された金額に基づいてチップが計算されます。

> チップ処理をスキップするときに 0 より大きいチップ対象金額を設定すると、エラーが発生します。
