> For the complete documentation index, see [llms.txt](https://ofin.gitbook.io/document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ofin.gitbook.io/document/contract/creation.md).

# 계약 생성

구매자가 플랫폼에서 **후불 결제 금융 서비스**를 이용할 수 있도록 전자계약을 생성하는 API입니다.

## Endpoints

* **URL:** `/api/v1/user/contract`
* **Method:** `POST`&#x20;

## **Request**

<table><thead><tr><th width="158.88671875">변수명</th><th width="123.17578125">타입</th><th width="110.35546875">필수 여부</th><th width="120.2109375">max length</th><th>description</th></tr></thead><tbody><tr><td>companyName</td><td>String</td><td>O</td><td>100</td><td>상호명</td></tr><tr><td>businessNumber</td><td>String</td><td>O</td><td>10</td><td>사업자등록번호는 숫자만 입력 가능</td></tr><tr><td>companyNumber</td><td>String</td><td>X</td><td>13</td><td>법인등록번호는 숫자만 입력 가능</td></tr><tr><td>userName</td><td>String</td><td>O</td><td>50</td><td>대표자명</td></tr><tr><td>companyType</td><td>Enum</td><td>O</td><td>20</td><td><ul><li>회사 유형</li><li>개인(individual), 법인(corporation)</li></ul></td></tr><tr><td>companyAddress</td><td>String</td><td>O</td><td>200</td><td>회사 기본 주소</td></tr><tr><td>companyAddressDetail</td><td>String</td><td>X</td><td>100</td><td>회사 상세 주소</td></tr><tr><td>zipCode</td><td>String</td><td>O</td><td>5</td><td>우편번호</td></tr><tr><td>representativePhone</td><td>String</td><td>O</td><td>11</td><td>대표자 휴대폰 번호는 숫자만 입력 가능</td></tr><tr><td>representativeEmail</td><td>String</td><td>O</td><td>512</td><td>대표자 이메일 주소</td></tr><tr><td>managerName</td><td>String</td><td>X</td><td>50</td><td>공동대표 또는 담당자 이름</td></tr><tr><td>managerPhone</td><td>String</td><td>X</td><td>11</td><td>공동대표 또는 담당자 휴대폰 번호는 숫자만 입력 가능</td></tr><tr><td>managerEmail</td><td>String</td><td>X</td><td>512</td><td>공동대표 또는 담당자 이메일 주소</td></tr><tr><td>businessStartDate</td><td>String</td><td>X</td><td>8</td><td>개업년월일은 yyyymmdd 형식만 가능</td></tr><tr><td>platformServiceStartDate</td><td>String</td><td>X</td><td>10</td><td>플랫폼 이용 시작일, yyyy-mm-dd 형식</td></tr><tr><td>monthlySalesData</td><td>List</td><td>X</td><td>36</td><td>최근 월별 판매 데이터<br>yearMonth: 년월<br>purchaseCount: 구매 횟수<br>purchaseAmount: 구매금액합계</td></tr><tr><td>apiKey</td><td>String</td><td>O</td><td>255</td><td>플랫폼 API Key</td></tr><tr><td>resultCallback</td><td>String</td><td>O</td><td>500</td><td>계약 결과 Callback 받을 URL</td></tr><tr><td>successCallbackUrl</td><td>String</td><td>O</td><td>500</td><td>계약 완료 후 성공 시 redirect 할 URL</td></tr><tr><td>failCallbackUrl</td><td>String</td><td>O</td><td>500</td><td>계약 완료 후 실패 시 redirect 할 URL</td></tr></tbody></table>

#### **Request Example**

```json
{
  "companyName": "올라핀테크",
  "businessNumber": "5098601645",
  "companyNumber": "1358110380170",
  "userName": "김올라",
  "companyType": "CORPORATION",
  "companyAddress": "서울 강남구 봉은사로 327",
  "companyAddressDetail": "11층 올라핀테크",
  "zipCode": "06103",
  "representativePhone": "01012345678",
  "representativeEmail": "allra@allra.co.kr",
  "managerName": "최테크",
  "managerPhone": "01087654321",
  "managerEmail": "fintech@allra.co.kr",
  "businessStartDate": "20230101",
  "platformServiceStartDate": "2024-01-15",
  "monthlySalesData": [
    {
      "yearMonth": "2025-01",
      "purchaseCount": 150,
      "purchaseAmount": 5000000
    },
    {
      "yearMonth": "2025-02",
      "purchaseCount": 300,
      "purchaseAmount": 10000000
    }
  ],
  "apiKey": "my8isVOhkPvAeLbtealSrEYyJBCZa ... BSDINWJPKs6th5QBTdYZHCtLxavagMR2I",
  "resultCallback": "https://ofin.co.kr/demo/callback",
  "successCallbackUrl": "https://ofin.co.kr/demo/success",
  "failCallbackUrl": "https://ofin.co.kr/demo/fail"
}
```

## Response

* **checkoutPage (String) (maxLen:500)**
  * 계약 진행 가능한 URL
* **contractToken (String) (maxLen:25)**
  * 25자리 계약 토큰

{% hint style="warning" %} <mark style="color:orange;">**✔️ 계약 프로세스는 생성 시점부터 30분간 유효합니다.**</mark>

<mark style="color:orange;">**✔️ 유효 시간이 경과하면 토큰이 만료되어 계약을 진행할 수 없습니다.**</mark>

<mark style="color:orange;">**✔️ 계속 진행하려면 새로운 계약을 생성해야 합니다.**</mark>

<mark style="color:orange;">**✔️ 새로운 계약 생성 시, 기존 계약 토큰은 자동으로 비활성화됩니다.**</mark>
{% endhint %}

#### **Response Example**

```json
{
  "meta": {
    "code": "SUCCESS",
    "message": "성공"
  },
  "data": {
    "checkoutPage": "https://ofin.co.kr/contract-front/auth?contractToken=example-contractToken",
    "contractToken": "example-contractToken"
  }
}
```

### Error Handling

* INTERNAL\_SERVER\_ERROR : 서버 내부 에러입니다.
* BAD\_REQUEST :&#x20;
  * apikey 불일치 : 존재하지 않는 API key입니다.
  * 기타정보 불일치 : 유효하지 않는 데이터입니다.

```json
{
  "meta": {
    "code": "BAD_REQUEST",
    "message": "[apiKey: 존재하지 않는 API Key입니다]"
  },
  "data": null
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ofin.gitbook.io/document/contract/creation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
