# バイヤープラットフォーム報酬 取得

`GET /v1/buyer_platform_accounts/{id}`

- operationId: `retrieveBuyerPlatformAccount`
- tags: バイヤープラットフォーム報酬

エンドポイントに指定したIDのバイヤープラットフォーム報酬情報を取得するAPI。


## コードサンプル

### cURL

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

### 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 = "<プラットフォーム報酬ID>";
    const endpoint = `${BASE_URL}/v1/buyer_platform_accounts/${id}`;

    const response = await fetch(endpoint, {
        method: "GET",
        headers: {
            Authorization: `Bearer ${API_KEY}`,
        },
    });
    const buyerPlatformAccount = await response.json();
    console.log(buyerPlatformAccount); // 取得したバイヤープラットフォーム報酬データを出力
})();
```

### Go

```go
package main

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

func main() {
	// APIキーの指定
	apiKey := "<Secret API Key>"

	// プラットフォーム報酬IDの指定
	id := "<プラットフォーム報酬ID>"

	// リクエストの作成
	req, err := http.NewRequest(
		"GET",
		"https://api.test.fincode.jp/v1/buyer_platform_accounts/"+id,
		nil,
	)
	if err != nil {
		log.Fatalf("リクエストの作成エラー: %v", err)
	}

	req.Header.Set("Authorization", "Bearer "+apiKey)

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

	fmt.Println(resp.Status)
}
```

### PHP

```php
<?php

$apiKey = '<Secret API Key>';
$id = '<プラットフォーム報酬ID>';
$baseUrl = "https://api.test.fincode.jp";
$endpoint = "/v1/buyer_platform_accounts/" . $id; // GETリクエストのエンドポイント

$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, true);
// curl_setopt($session, CURLOPT_SSL_VERIFYHOST, 2);

$response = curl_exec($session);

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

curl_close($session);
?>
```

### Python 3

```python
import requests

api_key = '<Secret API Key>'
id = '<プラットフォーム報酬ID>'

url = f'https://api.test.fincode.jp/v1/buyer_platform_accounts/{id}'

# ヘッダーを設定
headers = {
    'Authorization': f'Bearer {api_key}',
}

# HTTP GETリクエストの送信
try:
    response = requests.get(url, headers=headers)

    # レスポンスの処理
    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
    id = "<プラットフォーム報酬ID>"
    endpoint = "/v1/buyer_platform_accounts/#{id}"  # GETリクエストのエンドポイント

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

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

    case response
    when Net::HTTPSuccess
        puts 'SUCCESS'
        # レスポンスの表示
        puts JSON.pretty_generate(JSON.parse(response.body))
    else
        puts 'ERROR'
        # エラーの表示
        puts response.body
    end
end

main
```

## パラメータ

| 名前 | 位置 | 必須 | 型 | 説明 |
| --- | --- | --- | --- | --- |
| `id` | path | ✓ | string | プラットフォーム報酬ID |

## レスポンス

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

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `id` | string |  | プラットフォーム報酬ID |
| `buyer_account_id` | string |  | 精算ID |
| `buyer_id` | string |  | バイヤーID |
| `aggregate_term_start` | string |  | 集計対象期間（開始） |
| `aggregate_term_end` | string |  | 集計対象期間（終了） |
| `scheduled_deposit_date` | string |  | 入金予定日 |
| `deposit_date` | string |  | 入金日 |
| `status_code` | integer |  | ステータスコード |
| `count` | integer |  | 対象取引件数 |
| `total_amount` | number |  | 取引総額 |
| `platform_provision_fee_amount` | number |  | 請求書書面上の請求金額 |
| `platform_provision_fee_tax_amount` | number |  | プラットフォーム提供料消費税 |
| `platform_kickback_fee_amount` | number |  | プラットフォーム還元額 |
| `platform_kickback_fee_tax_amount` | number |  | プラットフォーム還元額消費税 |
| `platform_kickback_fee_tax_rate` | number |  | プラットフォーム還元額消費税率（%） |
| `deposit_amount` | number |  | 入金金額 |
| `created` | string |  | 登録日時 |
| `updated` | string |  | 更新日時 |
| `buyer_deposit_destination_history` | BuyerDepositDestinationHistory |  | 入金先口座情報 |

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

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

