# テナントショップ契約情報 取得

`GET /v1/contracts/{id}`

- operationId: `retrieveTenantContract`
- tags: テナント申請管理

`id`で指定したテナントショップの契約情報を取得します。


## コードサンプル

### cURL

```bash
curl \
    -X GET \
    -H "Authorization:Bearer <Secret API Key>" \
    -H "Tenant-Shop-Id: <Tenant Shop ID>" \
'https://api.test.fincode.jp/v1/contracts/{Tenant Shop ID}'
```

### Node.js

```javascript
import { createFincode } from "@fincode/node";

const API_KEY = "<Secret API Key>";

(async () => {
    const fincode = createFincode({ apiKey: API_KEY, isLiveMode: false });

    const tenantShopId = "<Tenant Shop ID>";

    try {
        // リクエストの送信
        const contracts = await fincode.tenants.retrieveContract(tenantShopId, {
            tenantShopId: tenantShopId,
        });
    } catch (e) {
        // エラーの処理
    }
})();
```

### Go

```go
package main

import (
	"fmt"
	"log"
	"net/http"
)

func main() {

	apiKey := "<Secret API Key>"

	tenantShopID := "<Tenant Shop ID>"

	// リクエストの作成
	req, _ := http.NewRequest("GET", fmt.Sprintf("https://api.test.fincode.jp/v1/contracts/%s", tenantShopID), nil)
	req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
	req.Header.Set("Tenant-Shop-Id", tenantShopID)

	// リクエストの送信
	client := &http.Client{}
	res, err := client.Do(req)
	if err != nil {
		log.Fatal(err)
	}
	defer res.Body.Close()

}
```

### PHP

```php
<?php

$apiKey = '<Secret API Key>';

$tenantShopId = '<Tenant Shop ID>';

$baseUrl = "https://api.test.fincode.jp";
$endpoint = "/v1/contracts/{$tenantShopId}";
$headers = [
    "Authorization: Bearer " . $apiKey,
];

$session = curl_init();
curl_setopt($session, CURLOPT_URL, $baseUrl . $endpoint);
curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
curl_setopt($session, CURLOPT_HTTPGET, true);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// curl_setopt($session, CURLOPT_SSL_VERIFYPEER, );
// curl_setopt($session, CURLOPT_SSL_VERIFYHOST, );

$response = curl_exec($session);

if ($response === false) {
    # エラー処理
    echo "cURL Error: " . curl_error($session);
} else {
    # APIからのデータを処理
    var_dump($response);
}

curl_close($session);
```

### Python 3

```python
import requests

api_key = '<Secret API Key>'

tenant_shop_id = '<Tenant Shop ID>'

url = f'https://api.test.fincode.jp/v1/contracts/{tenant_shop_id}'

# ヘッダーを設定
headers = {
    'Authorization': f'Bearer {api_key}',
    'Tenant-Shop-Id': tenant_shop_id,
}

try:
    response = requests.get(url, headers=headers)

    # レスポンスの処理
    if response.status_code == 200:
        # APIからのデータを処理
        print(f"Success: {response.json()}")
    else:
        # エラーの処理
        print(f"Error: {response.json()}")
except requests.RequestException as e:
    # 通信エラーの処理
    print(f"Request error: {e}")
```

### Ruby

```ruby
require 'net/http'
require 'uri'

API_KEY = '<Secret API Key>'
BASE_URL = 'https://api.test.fincode.jp'

def main
    tenant_shop_id = '<Tenant Shop ID>'
    endpoint = "/v1/contracts/#{tenant_shop_id}"

    uri = URI.parse(BASE_URL + endpoint)

    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true

    # リクエストの作成
    request = Net::HTTP::Get.new(uri.request_uri)
    request['Authorization'] = "Bearer #{API_KEY}"
    request['Tenant-Shop-Id'] = tenant_shop_id

    # リクエストの送信
    response = http.request(request)

    case response
    when Net::HTTPSuccess
        puts 'SUCCESS'
    else
        puts 'ERROR'
    end

    # レスポンスの表示
    puts response.body
end

main
```

## パラメータ

| 名前 | 位置 | 必須 | 型 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | ✓ | schema | 指定したテナントショップの契約情報を取得します。`Tenant-Shop-Id`ヘッダーも併せて指定してください。 |
| `Tenant-Shop-Id` | header | ✓ | schema | <span class="smallText color--red-400">※ プラットフォームのメインショップのみ指定可</span> |

## レスポンス

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

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `shop_id` | Shop_properties-id |  | ショップID（テナント） |
| `platform_id` | platform_id |  |  |
| `shop_type` | ShopType |  |  |
| `status_code` | ContractStatus |  |  |
| `examination` | array<Examination> |  | 審査情報 |
| `available_status_code` | enum(201 | 202) |  | 利用可能モード |
| `create_date` | string |  | ショップを作成したユーザーの登録日 |
| `contracted_at` | string |  | 本番環境申請日 |
| `start_charging_at` | string |  | 初回登録完了日 |
| `expired_at` | string |  | 解約日 |
| `sales_deposit_status_code` | enum(501 | 502) |  | 本人確認手続き ステータス |
| `sales_deposit_status_updated_date` | string |  | 売上入金 可否ステータス 更新日 |
| `denied_at` | string |  | 契約不成立日 |
| `suspended_billing` | boolean |  | 請求停止フラグ |
| `suspended_billing_date` | string |  | 請求停止フラグ 更新日 |
| `suspended_payment` | boolean |  | 入金停止フラグ |
| `suspended_payment_date` | string |  | 入金停止フラグ 更新日 |
| `suspended_service` | boolean |  | サービス停止フラグ |
| `suspended_service_date` | string |  | サービス停止フラグ 更新日 |
| `suspeded_immediate_use` | boolean |  | 即時利用停止フラグ |
| `suspended_immediate_use_date` | string |  | 即時利用停止フラグ 更新日 |
| `stop_cancelaltion_memo` | string |  | 停止・解約 備考 |
| `obligations_notice` | string |  | 特記事項（債権債務） |
| `user_shop_name` | string |  | ショップ名（ユーザー用） |
| `register_mail` | string |  | 登録メールアドレス |
| `platform_reprentative_shop` | boolean |  | プラットフォームの代表ショップか |
| `shared_customer_flag` | shared_customer_flag |  |  |
| `contract_detail` | ContractDetail |  | 契約情報 |
| `contract_bank_account` | ContractBankAccountInfo |  | 入金先口座 |
| `contract_virtual_bank` | ContractBankAccountInfo |  | バーチャル口座情報 |
| `contract_card_destination` | array<CardDestination> |  | カード決済 仕向け先のリスト |
| `credit_card_setting` | CardPaymentSetting |  | カード決済 設定 |
| `official_registered_corporate_info` | RegistryCorporateInfo |  | 登記簿上の法人情報 |
| `business_operator` | BusinessOperator |  | 事業者情報 |

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

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

