# 支払依頼リクエスト（PayPay 継続課金）

`PUT /v1/payments/{id}/payment_request`

- operationId: `requestPaymentPayPay`
- tags: 決済

<span class="smallText color--red-400">※ PayPay（継続課金）のみ利用可</span>\
\
残高不足などで失敗したPayPay継続課金の決済に対し、購入者へ支払いを依頼します。\
\
継続課金の決済は購入者の操作を必要としませんが、残高不足などで失敗した場合はその決済のままでは回収できません。\
このAPIで支払依頼を送信すると、購入者のPayPayアプリに支払いの依頼が通知され、購入者が支払うことで決済が完了します。\
\
支払依頼の送信に成功すると`status`は支払い待ち（`AWAITING_CUSTOMER_PAYMENT`）に遷移します。\
購入者が支払うと売上確定済み（`CAPTURED`）へ、支払期限までに支払われなかった場合は期限切れ（`EXPIRED`）へ遷移します。\
いずれも結果通知（Webhook）または決済取得APIで確認してください。
<span class="smallText">
\
\
**請求する金額はこのAPIでは指定できません。** 対象の決済の利用金額（`amount`）と税送料（`tax`）の合計が請求されます。\
\
支払依頼を送信できるのは、決済実行API（`PUT /v1/payments/{id}`）で実行した継続課金の決済のうち、支払いが完了していないものです。\
サブスクリプションによって発生した決済は対象外です（サブスクリプションの失敗はリトライにより自動で再請求されます）。\
\
支払い待ちの決済に対して重複して支払依頼を送信することはできません。送信済みの支払依頼を取り消す場合は決済キャンセルAPIを使用してください。
</span>


## コードサンプル

### cURL

```bash
curl \
    -X PUT \
    -H "Authorization:Bearer <Secret API Key>" \
    -H "Content-Type: application/json" \
    -d '{
    "pay_type": "Paypay",
    "expiry_date": "2022/05/16 23:59:59"
}' \
'https://api.test.fincode.jp/v1/payments/{id}/payment_request'
```

## パラメータ

| 名前 | 位置 | 必須 | 型 | 説明 |
| --- | --- | --- | --- | --- |
| `Tenant-Shop-Id` | header |  | schema | <span class="smallText color--red-400">※ プラットフォームのメインショップのみ指定可</span> |
| `id` | path | ✓ | OrderId_schema | オーダーID（決済情報のID） |

## リクエストボディ

Content-Type: `application/json`

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `pay_type` | PayType | ✓ | 決済種別 |
| `customer_id` | id |  | 顧客ID |
| `expiry_date` | expiry_date |  |  |

## レスポンス

### 200 リクエストに成功

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `shop_id` | Shop_properties-id |  |  |
| `id` | string |  | オーダーID |
| `access_id` | string |  | 取引ID |
| `amount` | integer |  | 利用金額 |
| `tax` | integer |  | 税送料 |
| `total_amount` | integer(int64) |  | 合計金額 |
| `client_field_1` | client_field_n |  | 加盟店自由項目 1 |
| `client_field_2` | client_field_n |  | 加盟店自由項目 2 |
| `client_field_3` | client_field_n |  | 加盟店自由項目 3 |
| `process_date` | string |  | 決済 処理日時 |
| `customer_id` | id |  | 顧客ID |
| `customer_group_id` | string |  | 顧客情報共有グループID |
| `error_code` | error_code |  | この決済において発生したエラーのうち、一番最新のエラーのエラーコードです。 |
| `bill_id` | string |  | 請求ID |
| `created` | created |  |  |
| `updated` | updated |  |  |
| `pay_type` | PayType |  | 決済種別 |
| `job_code` | enum(AUTH | CAPTURE | CANCEL) |  | 取引種別 |
| `status` | PaymentStatus |  | 決済ステータス |
| `code_url` | string |  | PayPay支払いURL |
| `code_expiry_date` | string |  | 支払期限 |
| `redirect_url` | string |  | リダイレクトURL |
| `redirect_type` | enum(1 | 2) |  | リダイレクト先種別 |
| `auth_max_date` | string |  | 仮売上期限 |
| `order_description` | string |  | 注文内容の説明 |
| `capture_description` | string |  | 売上確定の説明 |
| `update_description` | string |  | 金額変更の説明 |
| `cancel_description` | string |  | キャンセルの説明 |
| `store_id` | string |  | 店舗ID |
| `code_id` | string |  | PayPayの支払いコードID |
| `payment_id` | string |  | PayPay 決済ID |
| `paypay_result_code` | string |  | PayPay処理結果コード |
| `merchant_payment_id` | string |  | PayPay トランザクションID |
| `merchant_capture_id` | string |  | PayPay 売上確定ID |
| `merchant_update_id` | string |  | PayPay 金額変更ID |
| `merchant_revert_id` | string |  | PayPay キャンセルID |
| `merchant_refund_id` | string |  | PayPay 返金ID |
| `payment_date` | string |  | 支払日時 |
| `paypay_method` | enum(CONTINUOUS) |  | 決済方式 |
| `payment_method_id` | string |  | 決済手段ID |
| `subscription_id` | Subscription_properties-id |  | サブスクリプションID |

### 400 不正なリクエスト

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `errors` | array<FincodeAPIError> |  |  |

