# ショップ決済手段 更新

`PUT /v1/shops/payment_methods/{id}`

- operationId: `updateShopPaymentMethod`
- tags: ショップ決済手段

IDで指定したショップ決済手段を更新します。


## コードサンプル

### cURL

```bash
curl \
    -X PUT \
    -H "Authorization:Bearer <Secret API Key>" \
    -H "Content-Type: application/json" \
    -d '{
    "pay_type": "Payeeaccount",
    "display_flag": "1",
    "display_number": "1",
    "client_field_1": "備考1"
}' \
    'https://api.test.fincode.jp/v1/shops/payment_methods/pm_xxxxxxxxxxxxxxxxxxxxxx'
```

### Node.js

```javascript
import fetch from "node-fetch";

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

(async () => {
    const id = "<Shop Payment Method ID>";
    const endpoint = `${BASE_URL}/v1/shops/payment_methods/${id}`;

    const response = await fetch(endpoint, {
        method: "PUT",
        headers: {
            Authorization: `Bearer ${API_KEY}`,
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            pay_type: "Payeeaccount",
            display_flag: "1",
            display_number: "1",
            client_field_1: "備考1",
        }),
    });

    if (!response.ok) {
        console.error(`Error: ${response.statusText}`);
        return;
    }

    const data = await response.json();
    console.log(data);
})();
```

### Go

```go
package main

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

func main() {
	apiKey := "<Secret API Key>"
	id := "<Shop Payment Method ID>"

	url := fmt.Sprintf("https://api.test.fincode.jp/v1/shops/payment_methods/%s", id)

	reqBody := bytes.NewBufferString(`{
		"pay_type": "Payeeaccount",
		"display_flag": "1",
		"display_number": "1",
		"client_field_1": "備考1"
	}`)

	req, err := http.NewRequest("PUT", url, reqBody)
	if err != nil {
		log.Fatalf("リクエスト作成エラー: %v", err)
	}
	req.Header.Set("Authorization", "Bearer "+apiKey)
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatalf("リクエスト送信エラー: %v", err)
	}
	defer resp.Body.Close()

	respBody, _ := io.ReadAll(resp.Body)
	fmt.Println(string(respBody))
}
```

### PHP

```php
<?php

$apiKey = '<Secret API Key>';
$id = "<Shop Payment Method ID>";
$baseUrl = "https://api.test.fincode.jp";
$endpoint = "/v1/shops/payment_methods/{$id}";
$headers = [
    "Authorization: Bearer " . $apiKey,
    "Content-Type: application/json"
];

$data = json_encode([
    "pay_type" => "Payeeaccount",
    "display_flag" => "1",
    "display_number" => "1",
    "client_field_1" => "備考1"
]);

$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);

$response = curl_exec($session);
if ($response === false) {
    echo "cURL Error: " . curl_error($session);
} else {
    var_dump($response);
}
curl_close($session);
```

### Python 3

```python
import requests

api_key = '<Secret API Key>'
id = '<Shop Payment Method ID>'
url = f'https://api.test.fincode.jp/v1/shops/payment_methods/{id}'

headers = {
    'Authorization': f'Bearer {api_key}',
    'Content-Type': 'application/json'
}

data = {
    "pay_type": "Payeeaccount",
    "display_flag": "1",
    "display_number": "1",
    "client_field_1": "備考1"
}

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"通信エラー: {e}")
```

### Ruby

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

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

def main
  id = '<Shop Payment Method ID>'
  endpoint = "/v1/shops/payment_methods/#{id}"
  uri = URI.parse(BASE_URL + endpoint)

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

  data = {
    pay_type: "Payeeaccount",
    display_flag: "1",
    display_number: "1",
    client_field_1: "備考1"
  }

  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)
  puts response.body
end

main
```

## パラメータ

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

## リクエストボディ

Content-Type: `application/json`

#### 銀行振込（指定口座）

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `pay_type` | pay_type | ✓ |  |
| `display_flag` | display_flag |  |  |
| `display_number` | display_number |  |  |
| `client_field_1` | properties-client_field_1 |  |  |
| `client_field_2` | properties-client_field_2 |  |  |
| `client_field_3` | properties-client_field_3 |  |  |

## レスポンス

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

##### 銀行振込（指定口座）

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `id` | string |  | ショップ決済手段ID |
| `pay_type` | enum(Payeeaccount) |  | 決済種別 |
| `process_date` | string(date-time) |  | 処理日時 形式：`yyyy/MM/dd HH:mm:ss.SSS` |
| `status` | enum(ACTIVATED) |  | ステータス |
| `display_flag` | enum(0 | 1) |  | 表示フラグ |
| `display_number` | enum(1 | 2 | 3) |  | 表示順序 |
| `payee_account` | object |  | 銀行口座情報 |
| `client_field_1` | string |  | 加盟店向け自由項目 1 |
| `client_field_2` | string |  | 加盟店向け自由項目 2 |
| `client_field_3` | string |  | 加盟店向け自由項目 3 |
| `delete_flag` | enum(0 | 1) |  | 削除フラグ |
| `created` | string(date-time) |  | 作成日時 形式：`yyyy/MM/dd HH:mm:ss.SSS` |
| `updated` | string(date-time) |  | 更新日時 形式：`yyyy/MM/dd HH:mm:ss.SSS` |

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

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

