# 請求書カード払い情報取得

`GET /v1/business_payments/{id}`

- operationId: `retrieveBusinessPayment`
- tags: 請求書カード払い

エンドポイントに指定してある取引IDに応じたバイヤ請求書カード払い情報を取得する。


## コードサンプル

### cURL

```bash
curl \
    -X GET \
    -H "Authorization:Bearer <Secret API Key>" \
    -H "Tenant-Buyer-Id: b_***********" \
'https://api.test.fincode.jp/v1/business_payments/{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 accessId = "<Access ID>";

    try {
        // リクエストの送信
        const businessPayment = await fincode.businessPayments.retrieve(accessId);
    } catch (e) {
        // エラーの処理
    }
})();
```

### Go

```go
package main

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

func main() {
    apiKey := "<Secret API Key>"
    accessID := "<Access ID>"

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

    // リクエストの送信
    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>';

$accessId = '<Access ID>';

$baseUrl = "https://api.test.fincode.jp";
$endpoint = "/v1/business_payments/{$accessId}";
$headers = [
    "Authorization: Bearer " . $apiKey,
    "Content-Type: application/json"
    "Tenant-Buyer-Id: b_***********"
];

$session = curl_init();
curl_setopt($session, CURLOPT_URL, $baseUrl . $endpoint);
curl_setopt($session, CURLOPT_HTTPHEADER, $headers);
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>'

access_id = '<Access ID>'

url = f'https://api.test.fincode.jp/v1/business_payments/{access_id}'

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

# 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
  access_id = '<Access ID>'
  endpoint = "/v1/business_payments/#{access_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['Content-Type'] = 'application/json'
  request["Tenant-Buyer-Id"] = "b_***********"

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

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

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

main
```

## パラメータ

| 名前 | 位置 | 必須 | 型 | 説明 |
| --- | --- | --- | --- | --- |
| `Tenant-Buyer-Id` | header | ✓ | schema | <span class="smallText color--red-400">※ バイヤープラットフォームのみ指定可</span> |
| `id` | path | ✓ | string | 取引ID |

## レスポンス

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

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `access_id` | string |  | 取引ID |
| `buyer_shop_id` | string |  | バイヤーID |
| `billing_amount` | number |  | 請求金額 |
| `card_payment_fee` | number |  | カード払い手数料 |
| `fee_rate` | number |  | 手数料率（3%の場合は0.03） |
| `min_fee` | number |  | 最低手数料金額 |
| `total_amount` | number |  | 合計金額 |
| `status` | string |  | ステータス |
| `process_date` | string |  | 処理日時（yyyy/MM/dd HH:mm:ss.SSS） |
| `card_brand` | string |  | カードブランド |
| `card_no_display` | string |  | 表示用カード番号 |
| `due_date` | string |  | 支払期日（yyyy/MM/dd） |
| `transfer_exec_date` | string |  | 振込実行日（yyyy/MM/dd） |
| `invoice_file_name_display` | string |  | 表示用請求書ファイル名 |
| `remitter_name` | string |  | 振込依頼人名 |
| `invoice_file` | string |  | 請求書ファイル（Base64でエンコード化） |
| `customer_buyer_shop_id` | string |  | 顧客バイヤーID |
| `receipt_id` | string |  | 支払ID |
| `bill_pay_types` | array<string> |  | 請求管理_決済種別 |
| `examin_result_reason` | string |  | 審査結果理由 |
| `auth_ret_url` | string |  | オーソリコールバックURL（指定がない場合は `null`） |
| `payee` | BusinessPayment.Payee.Detail |  |  |
| `payee_bank` | BusinessPayment.PayeeBank.Detail |  |  |
| `mulpay_api_key` | string |  | マルペイキー |
| `mulpay_public_key_path` | string |  | マルペイ公開鍵のパス |

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

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

