# 링크페이 재발송

원문: https://commerce.bootpay.ai/api/link-payment/notify

> 만든 링크페이를 알림톡 · 문자 · 이메일 중 send_types 로 고른 채널로 다시 보냅니다. 여러 채널을 함께 고르면 모두에 보냅니다.

이미 만든 링크페이를 고객에게 다시 보냅니다. 결제 안내는 알림톡 · 문자 · 이메일 중에서 아래 `send_types` 로 골라 보냅니다.

## API 엔드포인트

::: endpoint
method: POST
url: https://api.bootapi.com/v1/invoices/:invoice_id/notify
auth: [Basic Auth](https://commerce.bootpay.ai/api/server/authentication)
:::

::: warning 알려진 문제 — 재발송 API 가 지금 동작하지 않습니다
지금은 이 API 를 부르면 발송 없이 `SERVER_ERROR`(HTTP 500)가 돌아옵니다. 재발송은 관리자 콘솔의 링크페이 목록에서 「재발송」으로 하거나(매뉴얼 [결제 링크 보내기](https://blog.bootpay.ai/articles/link-pay-send)), [링크 생성](https://commerce.bootpay.ai/api/link-payment/create) 때 `use_notification: true` 로 처음부터 발송합니다.
:::

## 알림 유형 (`send_types`)

`send_types` 배열에 넣는 값입니다. **숫자**로 보냅니다.

| 값 | 채널 | 설명 |
|----|------|------|
| `1` | 알림톡 (카카오) | 카카오 알림톡 발송 |
| `2` | 문자 | SMS/LMS 문자 메시지 발송 |
| `3` | 이메일 | 이메일 발송 |

::: tip
여러 값을 넣으면 여러 채널로 함께 보냅니다. 예: `[1, 3]` 은 알림톡과 이메일을 함께 보냅니다.
:::

::: warning 표에 없는 값은 무시됩니다
발송에 쓰이는 값은 위 세 개뿐입니다. 그 밖의 값을 넣으면 오류 없이 조용히 걸러져 아무 데도 발송되지 않으니, 오타에 주의합니다.
:::

## 요청 파라미터

::: parameters

| 파라미터 | 타입 | 필수 | 설명 |
|---------|------|------|------|
| invoice_id | String | Y | 링크페이 ID (URL 파라미터) |
| send_types | Array | Y | 알림 유형 배열 (1: 알림톡, 2: 문자, 3: 이메일 — 위 표 참고) |

:::

## 코드 예제

::: code-group

```bash [cURL]
curl -X POST "https://api.bootapi.com/v1/invoices/687a1b2c3d4e5f6789012345/notify" \
  -H "Authorization: Basic {base64(client_key:secret_key)}" \
  -H "Content-Type: application/json" \
  -d '{
    "send_types": [2, 3]
  }'
```

```javascript [Node.js]
import { BootpayCommerce } from '@bootpay/backend-js';

const commerce = new BootpayCommerce({
    client_key: '{client_key}',
    secret_key: '{secret_key}'
});

const response = await commerce.invoice.notify(
    '687a1b2c3d4e5f6789012345',
    [2, 3]  // 문자, 이메일
);
console.log(response);
```

```python [Python]
from bootpay_backend.commerce import BootpayCommerce

commerce = BootpayCommerce('{client_key}', '{secret_key}')
response = commerce.invoice.notify(
    '687a1b2c3d4e5f6789012345',
    [2, 3]  # 문자, 이메일
)
print(response)
```

```php [PHP]
use Bootpay\ServerPhp\BootpayCommerceApi;

$commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
$response = $commerce->invoice->notify(
    '687a1b2c3d4e5f6789012345',
    [2, 3]  // 문자, 이메일
);
print_r($response);
```

```java [Java]
import kr.co.bootpay.store.BootpayStore;
import kr.co.bootpay.store.model.request.TokenPayload;
import java.util.Arrays;

TokenPayload tokenPayload = new TokenPayload("{client_key}", "{secret_key}");
BootpayStore commerce = new BootpayStore(tokenPayload).withToken();
var response = commerce.invoice.notify(
    "687a1b2c3d4e5f6789012345",
    Arrays.asList(2, 3)  // 문자, 이메일
);
System.out.println(response.getData());
```

```ruby [Ruby]
require 'bootpay'

commerce = BootpayStore::RestClient.new(client_key: '{client_key}', secret_key: '{secret_key}')
response = commerce.invoice_notify(
  invoice_id: '687a1b2c3d4e5f6789012345',
  send_types: [2, 3]  # 문자, 이메일
)
puts response.data
```

```go [Go]
commerce := bootpay.NewCommerceAPI("{client_key}", "{secret_key}", nil, "production")
response, err := commerce.Invoice.Notify(
    "687a1b2c3d4e5f6789012345",
    []int{2, 3},  // 문자, 이메일
)
fmt.Println(response, err)
```

```csharp [.NET]
using Bootpay.Commerce;
using System.Collections.Generic;

var commerce = new BootpayCommerceApi("{client_key}", "{secret_key}");
var response = await commerce.InvoiceNotify(
    "687a1b2c3d4e5f6789012345",
    new List<int> { 2, 3 }  // 문자, 이메일
);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

:::

## 응답

#### 성공 응답

```json
{
  "status": 200,
  "message": "발송이 완료되었습니다."
}
```

#### 에러 응답

HTTP 상태 코드(`404`)는 헤더로 오고, 본문에는 코드 이름이 문자열로 옵니다.

```json
{
  "error_code": "INVOICE_NOT_FOUND",
  "message": "링크페이 정보가 없습니다"
}
```

## 에러 코드

::: info 공통 에러
인증·권한 관련 에러는 [에러 코드표](https://commerce.bootpay.ai/api/reference/codes)를 참고합니다.
:::

::: error-codes

| 코드 | 메시지 | 대처 방법 |
|------|--------|-----------|
| `INVOICE_NOT_FOUND` | 링크페이 정보가 없습니다 | invoice_id를 확인합니다 |
| `INVOICE_DENIED` | 링크페이 정보에 조회권한이 없는 회원세션입니다 | 올바른 API 키를 사용하고 있는지 확인합니다 |

:::
