# 請求書カード払いオーソリ依頼

`PUT /v1/business_payments/auth`

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

請求書カード払いオーソリ依頼を行います。


## コードサンプル

### cURL

```bash
curl \
    -X PUT \
    -H "Authorization:Bearer <Secret API Key>" \
    -H "Content-Type: application/json" \
    -H "Tenant-Buyer-Id: b_***********" \
    -d '{
    "p": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefh"
}' \
'https://api.test.fincode.jp/v1/business_payments/auth'
```

### Node.js

```javascript
const API_KEY = "<Secret API Key>";

(async () => {
  const response = await fetch(
    "https://api.test.fincode.jp/v1/business_payments/auth",
    {
      method: "PUT",
      headers: {
        Authorization: `Bearer ${API_KEY}`,
        "Content-Type": "application/json",
        "Tenant-Buyer-Id": "b_***********",
      },
      body: JSON.stringify({
        p: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefh",
      }),
    },
  );

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

### Go

```go
package main

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

func main() {
    body := []byte(`{"p": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefh"}`)

    req, err := http.NewRequest(http.MethodPut, "https://api.test.fincode.jp/v1/business_payments/auth", bytes.NewBuffer(body))
    if err != nil {
        panic(err)
    }

    req.Header.Set("Authorization", "Bearer <Secret API Key>")
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Tenant-Buyer-Id", "b_***********")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    b, err := io.ReadAll(resp.Body)
    if err != nil {
        panic(err)
    }

    fmt.Println(string(b))
}
```

### PHP

```php
<?php

$payload = json_encode([
    'p' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefh',
]);

$ch = curl_init('https://api.test.fincode.jp/v1/business_payments/auth');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer <Secret API Key>',
    'Content-Type: application/json',
    'Tenant-Buyer-Id: b_***********'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

echo $response;
```

### Python 3

```python
import requests

api_key = '<Secret API Key>'

url = 'https://api.test.fincode.jp/v1/business_payments/auth'
headers = {
    'Authorization': f'Bearer {api_key}',
    'Content-Type': 'application/json'
    'Tenant-Buyer-Id': 'b_***********'
}
data = {
    'p': 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefh'
}

response = requests.put(url, headers=headers, json=data)
print(response.text)
```

### Ruby

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

uri = URI.parse("https://api.test.fincode.jp/v1/business_payments/auth")
request = Net::HTTP::Put.new(uri)
request["Authorization"] = "Bearer <Secret API Key>"
request["Content-Type"] = "application/json"
request["Tenant-Buyer-Id"] = "b_***********"
request.body = {
  p: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefh"
}.to_json

response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
  http.request(request)
end

puts response.body
```

## パラメータ

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

## リクエストボディ

Content-Type: `application/json`

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `p` | string | ✓ | ブラウザ情報<br> 購入者がredirect_urlにアクセスし、 3Dセキュア認証成功をトリガーにオーソリコールバックURL宛に送信するデータのうち、 pの値を設定します。 |

## レスポンス

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

| パラメータ | 型 | 必須 | 説明 |
| --- | --- | --- | --- |
| `result` | enum(OK | NG) |  | オーソリ結果 OK: オーソリ成功 NG: オーソリ失敗 |

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

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

