# テナントショップ 更新

`PUT /v1/tenants/{id}`

- operationId: `updateTenantShop`
- tags: テナントショップ

`examination_master_id`で指定した決済手段におけるプラットフォーム利用料などの設定の変更を`id`で指定したテナントに対して実行します。


## コードサンプル

### cURL

```bash
curl \
    -X PUT \
    -H "Authorization:Bearer <Secret API Key>" \
    -H "Content-Type: application/json" \
    -d '{
    "examination_master_id": "<Examination Master ID>",
    "platform_rate": "4.8"
}' \
'https://api.test.fincode.jp/v1/tenants/{id}'
```

### Node.js

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

const API_KEY = "<Secret API Key>";

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

	[TODO] path params

    try {
        // リクエストの送信
        const customer = await fincode.tenants.update({
            [TODO] body or query
        });
    } catch (e) {
        // エラーの処理
    }
})();
```

### Go

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"log"
	"net/http"
)

func main() {

	apiKey := "<Secret API Key>"

	tenantShopID := "<Tenant Shop ID>"

	body := UpdatingTenantShopRequest{
		ExaminationMasterID:       stringPointer("paypay"),
		PayPayContentCategoryType: stringPointer("1"),
		PlatformRate:              stringPointer("8.0"),
	}

	marshalledBody, _ := json.Marshal(body)

	// リクエストの作成
	req, _ := http.NewRequest(
		"PUT",
		fmt.Sprintf("https://api.test.fincode.jp/v1/tenants/%s", tenantShopID),
		bytes.NewBuffer(marshalledBody),
	)
	req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", apiKey))
	req.Header.Set("Content-Type", "application/json")

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

}

type UpdatingTenantShopRequest struct {
	ExaminationMasterID       *string `json:"examination_master_id,omitempty"`
	PlatformRate              *string `json:"platform_rate,omitempty"`
	FixedFee                  *string `json:"fixed_fee,omitempty"`
	WebRegistrationFee        *string `json:"web_registration_fee,omitempty"`
	PayPayContentCategoryType *string `json:"paypay_content_category_type,omitempty"`
	APIKeyDisplayFlag         *string `json:"api_key_display_flag,omitempty"`
}

func stringPointer(s string) *string {
	return &s
}
```

### PHP

```php
<?php

$apiKey = '<Secret API Key>';

$tenantShopId = '<Tenant Shop ID>';

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

$data = json_encode([
    "examination_master_id" => "vm",
    "platform_rate" => "5.0"
]);

$session = curl_init();
curl_setopt($session, CURLOPT_URL, $baseUrl . $endpoint);
curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
curl_setopt($session, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($session, CURLOPT_POSTFIELDS, $data);
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/tenants/{tenant_shop_id}'

# ヘッダーを設定
headers = {
    'Authorization': f'Bearer {api_key}',
    'Content-Type': 'application/json'
}

data = {
    "examination_master_id": "jad",
    "platform_rate": "5.00"
}

# HTTP POSTリクエストの送信
try:
    response = requests.put(url, headers=headers, json=data)

    # レスポンスの処理
    if response.status_code == 200:
        # 成功した場合の処理
        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'
require 'json'


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

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

    uri = URI.parse(BASE_URL + endpoint)

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

    data = {
        examination_master_id: 'jad',
        platform_rate: '6.0',
    }

    # リクエストの作成
    request = Net::HTTP::Put.new(uri.request_uri)
    request['Authorization'] = "Bearer #{API_KEY}"
    request['Content-Type'] = 'application/json'

    request.body = data.to_json

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

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

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

main
```

## パラメータ

| 名前 | 位置 | 必須 | 型 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | ✓ | schema | ショップID |

## リクエストボディ

Content-Type: `application/json`

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `examination_master_id` | ExaminationMasterId |  |  |
| `platform_rate` | platform_rate |  | （個別）プラットフォーム利用料率。 |
| `fixed_fee` | fixed_fee |  | （個別）プラットフォーム利用料 最低料金。 |
| `web_registration_fee` | web_registration_fee |  | （個別）プラットフォーム利用料 Web登録手数料。 |
| `paypay_content_category_type` | paypay_content_category_type |  | PayPay審査により決定されるPayPay商材カテゴリー。 |
| `api_key_display_flag` | api_key_display_flag |  | APIキー表示フラグ |
| `registration_number` | string |  | 適格請求書発行事業者登録番号（T番号）。 |
| `is_displayed` | boolean |  | 適格請求書発行事業者登録番号の表示設定（マスタ）。 |
| `is_displayed_for_invoice` | boolean |  | インボイス（請求書）における適格請求書発行事業者登録番号の表示設定。 |
| `is_displayed_for_tenant_account_detail` | boolean |  | テナント売上明細における適格請求書発行事業者登録番号の表示設定。 |

## レスポンス

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

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `id` | string |  | ショップID |
| `shop_name` | string |  | ショップ名 |
| `shop_name_kana` | string |  | ショップ名（カナ） |
| `shop_type` | ShopType |  |  |
| `platform_id` | string |  | プラットフォームID |
| `platform_name` | string |  | プラットフォーム名 |
| `shared_customer_flag` | enum(0 | 1) |  | 顧客情報共有フラグ |
| `customer_group_id` | string |  | 顧客情報共有グループID |
| `platform_rate_list` | array<PlatformRateConfig> |  | 決済手段ごとに存在するプラットフォーム手数料設定のリスト |
| `send_mail_address` | string |  | 通知先メールアドレス |
| `shop_mail_address` | string |  | ショップメールアドレス |
| `log_keep_days` | integer |  | ログ保存日数 |
| `api_version` | string |  | APIバージョン |
| `api_key_display_flag` | enum(0 | 1) |  | 管理画面におけるAPIキー表示フラグ。 |
| `created` | created |  |  |
| `updated` | updated |  |  |
| `registration_number` | string |  | 適格請求書発行事業者登録番号（T番号）。 |
| `is_displayed` | boolean |  | 適格請求書発行事業者登録番号の表示設定（マスタ）。 |
| `is_displayed_for_invoice` | boolean |  | インボイス（請求書）における適格請求書発行事業者登録番号の表示設定。 |
| `is_displayed_for_tenant_account_detail` | boolean |  | テナント売上明細における適格請求書発行事業者登録番号の表示設定。 |

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

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

