# ショップ決済手段 登録

`POST /v1/shops/payment_methods`

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

ショップに紐づく決済手段（*Shop Payment Method*）を登録します。


## コードサンプル

### cURL

```bash
curl \
    -X POST \
    -H "Authorization:Bearer <Secret API Key>" \
    -H "Content-Type: application/json" \
    -d '{
    "pay_type": "Payeeaccount",
    "display_flag": "1",
    "display_number": "1",
    "payee_account": {
        "bank_code": "0001",
        "branch_code": "001",
        "account_type": "1",
        "account_number": "1234567",
        "account_name": "株式会社アイウエオ",
        "account_name_kana": "ｶﾌﾞｼｷｶﾞｲｼｬｱｲｳｴｵ"
    }
}' \
    'https://api.test.fincode.jp/v1/shops/payment_methods'
```

### Node.js

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

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

(async () => {
    const endpoint = `${BASE_URL}/v1/shops/payment_methods`;

    const response = await fetch(endpoint, {
        method: "POST",
        headers: {
            Authorization: `Bearer ${API_KEY}`,
            "Content-Type": "application/json",
        },
        body: JSON.stringify({
            pay_type: "Payeeaccount",
            display_flag: "1",
            display_number: "1",
            payee_account: {
                bank_code: "0001",
                branch_code: "001",
                account_type: "1",
                account_number: "1234567",
                account_name: "株式会社アイウエオ",
                account_name_kana: "ｶﾌﾞｼｷｶﾞｲｼｬｱｲｳｴｵ",
            },
        }),
    });

    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>"

	url := "https://api.test.fincode.jp/v1/shops/payment_methods"

	reqBody := bytes.NewBufferString(`{
		"pay_type": "Payeeaccount",
		"display_flag": "1",
		"display_number": "1",
		"payee_account": {
			"bank_code": "0001",
			"branch_code": "001",
			"account_type": "1",
			"account_number": "1234567",
			"account_name": "株式会社アイウエオ",
			"account_name_kana": "ｶﾌﾞｼｷｶﾞｲｼｬｱｲｳｴｵ"
		}
	}`)

	req, err := http.NewRequest("POST", 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>';
$baseUrl = "https://api.test.fincode.jp";
$endpoint = "/v1/shops/payment_methods";
$headers = [
    "Authorization: Bearer " . $apiKey,
    "Content-Type: application/json"
];

$data = json_encode([
    "pay_type" => "Payeeaccount",
    "display_flag" => "1",
    "display_number" => "1",
    "payee_account" => [
        "bank_code" => "0001",
        "branch_code" => "001",
        "account_type" => "1",
        "account_number" => "1234567",
        "account_name" => "株式会社アイウエオ",
        "account_name_kana" => "ｶﾌﾞｼｷｶﾞｲｼｬｱｲｳｴｵ"
    ]
]);

$session = curl_init();
curl_setopt($session, CURLOPT_URL, $baseUrl . $endpoint);
curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
curl_setopt($session, CURLOPT_CUSTOMREQUEST, "POST");
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>'
url = 'https://api.test.fincode.jp/v1/shops/payment_methods'

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

data = {
    "pay_type": "Payeeaccount",
    "display_flag": "1",
    "display_number": "1",
    "payee_account": {
        "bank_code": "0001",
        "branch_code": "001",
        "account_type": "1",
        "account_number": "1234567",
        "account_name": "株式会社アイウエオ",
        "account_name_kana": "ｶﾌﾞｼｷｶﾞｲｼｬｱｲｳｴｵ"
    }
}

try:
    response = requests.post(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
  endpoint = '/v1/shops/payment_methods'
  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",
    payee_account: {
      bank_code: "0001",
      branch_code: "001",
      account_type: "1",
      account_number: "1234567",
      account_name: "株式会社アイウエオ",
      account_name_kana: "ｶﾌﾞｼｷｶﾞｲｼｬｱｲｳｴｵ"
    }
  }

  request = Net::HTTP::Post.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
```

## パラメータ

| 名前 | 位置 | 必須 | 型 | 説明 |
| --- | --- | --- | --- | --- |
| `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 |  |  |
| `payee_account` | object | ✓ | 銀行口座情報 |
| `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> |  |  |

