Skip to content

Commit 8dd9e5f

Browse files
committed
docs: forceRedirect, redirectUrl 파라미터 설명 추가
1 parent 3e7f810 commit 8dd9e5f

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

src/routes/(root)/opi/ko/integration/start/v2/checkout.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ async function requestPayment() {
115115
지정한 `redirectUrl`로 다시 리다이렉트됩니다. 이 경우에는 함수 호출 결과를 이용할 수 없고,
116116
결제 성공 여부 등은 [쿼리 문자열](http://en.wikipedia.org/wiki/Query_string)로 전달받게 됩니다.
117117

118+
<Hint style="info">
119+
PC 환경에서도 리다이렉트 방식을 사용하려면 `forceRedirect: true` 옵션을 사용하세요.
120+
자세한 내용은 아래 [3-2. forceRedirect 옵션](#3-2-forceredirect-옵션으로-리다이렉트-강제하기)을 참고하세요.
121+
</Hint>
122+
118123
```ts
119124
PortOne.requestPayment({
120125
/* 파라미터 생략 */
@@ -136,6 +141,37 @@ PortOne.requestPayment({
136141
예를 들어 paymentId가 `payment-39ecfa97`, redirectUrl이 `https://example.com/payment-redirect`인 경우,
137142
결제 성공 시에 `https://example.com/payment-redirect?paymentId=payment-39ecfa97`로 리다이렉트됩니다.
138143

144+
### 3-2. forceRedirect 옵션으로 리다이렉트 강제하기
145+
146+
PC 환경에서도 결과를 리다이렉트 방식으로 받고 싶은 경우 `forceRedirect` 옵션을 사용할 수 있습니다.
147+
`forceRedirect` 옵션을 사용할 경우 `redirectUrl`을 필수적으로 전달해 주셔야 합니다.
148+
```ts title="TypeScript"
149+
PortOne.requestPayment({
150+
storeId: "store-xxxxxxxx",
151+
channelKey: "channel-key-xxxxxxxx",
152+
paymentId: `payment-${crypto.randomUUID()}`,
153+
orderName: "나이키 와플 트레이너 2 SD",
154+
totalAmount: 1000,
155+
currency: "CURRENCY_KRW",
156+
payMethod: "CARD",
157+
redirectUrl: "https://example.com/payment/complete",
158+
forceRedirect: true, // PC에서도 리다이렉트 방식 사용
159+
});
160+
```
161+
162+
<Hint style="warning">
163+
`forceRedirect: true`를 사용할 때 `redirectUrl`은 반드시 `http://` 또는 `https://`로 시작해야 합니다.
164+
</Hint>
165+
166+
### 3-3. 모바일 환경에서의 결제창 동작
167+
168+
모바일 환경에서 `redirectUrl`을 설정하지 않으면 SDK가 자동으로 PC 모드로 전환하여
169+
결제창을 표시합니다. 이 경우 결과는 Promise로 반환됩니다.
170+
171+
<Hint style="info">
172+
모바일에서 `redirectUrl` 없이 결제할 경우, 결제창이 팝업 또는 iframe 형태로 표시됩니다.
173+
</Hint>
174+
139175
## 4. 결제 완료 처리 (서버)
140176

141177
paymentId를 서버에 전달하면, 서버는 포트원의 [결제 조회 API](/api/rest-v2/payment#get%20%2Fpayments%2F%7BpaymentId%7D)

src/schema/browser-sdk.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5308,6 +5308,17 @@ resources:
53085308
type: resourceRef
53095309
optional: true
53105310
$ref: "#/resources/entity/RedirectUrl"
5311+
forceRedirect:
5312+
type: boolean
5313+
optional: true
5314+
description: |
5315+
**결과 리턴 방식을 리디렉션으로 강제**
5316+
5317+
`true`로 설정하면 원래 프로미스로 resolve 되었을 상황에서도
5318+
`redirectUrl`로 쿼리 파라미터와 함께 리디렉션합니다.
5319+
5320+
- `redirectUrl`이 없으면 기존처럼 프로미스로 반환합니다.
5321+
- 본인인증 시작 전 발생하는 에러는 리디렉션하지 않습니다.
53115322
customData:
53125323
type: string
53135324
optional: true
@@ -5392,6 +5403,17 @@ resources:
53925403
type: resourceRef
53935404
optional: true
53945405
$ref: "#/resources/entity/RedirectUrl"
5406+
forceRedirect:
5407+
type: boolean
5408+
optional: true
5409+
description: |
5410+
**결과 리턴 방식을 리디렉션으로 강제**
5411+
5412+
`true`로 설정하면 원래 프로미스로 resolve 되었을 상황에서도
5413+
`redirectUrl`로 쿼리 파라미터와 함께 리디렉션합니다.
5414+
5415+
- `redirectUrl`이 없으면 기존처럼 프로미스로 반환합니다.
5416+
- 빌링키 발급 시작 전 발생하는 에러는 리디렉션하지 않습니다.
53955417
locale:
53965418
optional: true
53975419
type: resourceRef
@@ -5514,6 +5536,17 @@ resources:
55145536
type: resourceRef
55155537
optional: true
55165538
$ref: "#/resources/entity/RedirectUrl"
5539+
forceRedirect:
5540+
type: boolean
5541+
optional: true
5542+
description: |
5543+
**결과 리턴 방식을 리디렉션으로 강제**
5544+
5545+
`true`로 설정하면 원래 프로미스로 resolve 되었을 상황에서도
5546+
`redirectUrl`로 쿼리 파라미터와 함께 리디렉션합니다.
5547+
5548+
- `redirectUrl`이 없으면 기존처럼 프로미스로 반환합니다.
5549+
- 빌링키 발급 및 결제 시작 전 발생하는 에러는 리디렉션하지 않습니다.
55175550
noticeUrls:
55185551
optional: true
55195552
type: array
@@ -5637,6 +5670,17 @@ resources:
56375670
type: resourceRef
56385671
optional: true
56395672
$ref: "#/resources/entity/RedirectUrl"
5673+
forceRedirect:
5674+
type: boolean
5675+
optional: true
5676+
description: |
5677+
**결과 리턴 방식을 리디렉션으로 강제**
5678+
5679+
`true`로 설정하면 원래 프로미스로 resolve 되었을 상황에서도
5680+
`redirectUrl`로 쿼리 파라미터와 함께 리디렉션합니다.
5681+
5682+
- `redirectUrl`이 없으면 기존처럼 프로미스로 반환합니다.
5683+
- 결제 시작 전 발생하는 에러는 리디렉션하지 않습니다.
56405684
noticeUrls:
56415685
optional: true
56425686
type: array

0 commit comments

Comments
 (0)