성공적으로 상태코드 200
이 반환되면 결제가 최종적으로 완료됩니다 .
[POST]:
/api/token/refresh
[GET]:
/api/settlement
[GET]:
/api/payments/orderid/{orderId}
[GET]:
/api/payments/{signature}
[GET]:
/api/payments/userId/{userId}
[GET]:
/api/payments/date?startDate={startDate}&endDate={endDate}&page={page}&count={count}
[POST]:
/api/payments/{signature}/cancel
widget.css
[POST]:
/purchase/token
각 프레임워크 및 기기별 결제 위젯 연동 방법은 [point3 결제 위젯 연동하기] 를 참고해주세요!
결제 위젯이 반환하는 시그니처를 수신하는 방법은 [point3 결제 위젯 연동하기] 를 참고해주세요!
[POST]:
/purchase/confirm
기존 토큰을 파기하고 새 토큰을 생성합니다.
Request Header:
Response:
정산 가능한 금액을 조회합니다. 정산금은 30분 간격으로 갱신됩니다.
Request Header:
Response:
OrderID
로 결제를 조회합니다. 결제 토큰 생성 요청 시 Point3 백엔드에서 OrderID
의 유일성을 검증하지 않으므로, 여러 개의 결제 건 수가 반환될 수 있습니다.
Request Header:
Response:
Signature
로 결제를 조회합니다.
Request Header:
Response:
userId
(clientGeneratedUserId) 로 결제를 조회합니다.
Request Header:
Response:
날짜로 결제를 조회합니다.
Request Header:
Response:
Signature
로 결제를 취소합니다. 취소 건은 5분 간격으로 처리됩니다.
Request Header:
Response:
위젯을 iframe
형태로 호출해주시고, 위젯에서 보내는 메세지를 수신할 수 있도록 window
에 EventListener
를 추가해주세요.
Request Header:
Request Body:
Response:
필드 유의 사항
발급 받은 토큰은 point3 위젯을 호출하는데에 사용됩니다.
결제가 이루어지는 주소는 다음과 같습니다.
이때 토큰에 특수문자가 포함되어 있을 수 있으므로, 정상적으로 URL에 토큰을 넣어 결제 위젯을 호출할 수 있게 토큰을 인코딩 해주세요. Javascript의 경우에는 encodeURIComponent() 내장함수를 사용하면 됩니다.
위 URL을 통해 결제 위젯을 호출합니다.
위젯 호출 시 point3 내부 로직을 통해 결제가 진행됩니다.
결제가 완료되면 point3 결제 위젯에서 시그니처를 반환합니다.
이 시그니처는 각각의 주문에 대해 부여된 고유한 key
값입니다.
결제 토큰을 통해 결제를 준비합니다. 토큰을 통해 결제요청을 성공적으로 받게되면, 결제가 이루어집니다!
Request Header:
Response:
Authorization | Basic <발급 받은 고객사 비밀키> |
Authorization | Basic <발급 받은 고객사 비밀키> |
Authorization | Basic <발급 받은 고객사 비밀키> |
Authorization | Basic <발급 받은 고객사 비밀키> |
Authorization | Basic <발급 받은 고객사 비밀키> |
Authorization | Basic <발급 받은 고객사 비밀키> |
Authorization | Basic <발급 받은 고객사 비밀키> |
Authorization | Basic <발급 받은 고객사 비밀키> |
Authorization | Basic <발급 받은 고객사 비밀키> |
yyyy-MM-dd'T'hh:mm:ss
) 포맷을 따릅니다. endDate
가 비어 있는 경우, startDate
부터 현재까지 모든 결제를 조회합니다.count
기본값은 30
이며 선택 사항입니다.page
는 1
부터 시작합니다.import android.os.Bundle;
import android.webkit.WebView;
import androidx.appcompat.app.AppCompatActivity;
import android.webkit.JavascriptInterface
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webView = findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(new Point3WidgetBridge(), "Point3WidgetBridge");
webView.loadUrl("https://widget.point3.io/?d=토큰"); // Point3 위젯 호출
}
}
private class Point3WidgetBridge {
public Point3WidgetBridge() {
}
@JavascriptInterface
public void postMessage(String rawJson) {
JSONObject data = new JSONObject(rawJson);
// 결제 성공 시 data.get("msg") 는 siganture를 반환합니다.
switch (data.get("status")) {
case "success":
// 결제 위젯 성공 시 수행할 동작
break;
case "error":
// 결제 실패 시 로직 (유저 이탈)
break;
default:
break;
}
}
}
import UIKit
import WebKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let contentController = WKUserContentController()
let configuration = WKWebViewConfiguration()
// WebView에서 전송하는 데이터를 수신할 메세지 핸들러를 추가합니다.
contentController.add(self, name: "point3WidgetHandler")
configuration.userContentController = contentController
let webView = WKWebView(frame: view.frame, configuration: configuration)
view.addSubview(webView)
if let url = URL(string: "https://widget.point3.io/?d=토큰") { // Point3 위젯 호출
webView.load(URLRequest(url: url))
}
}
}
extension ViewController: WKScriptMessageHandler {
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
guard message.name = "point3WidgetHandler",
let dictionary = message.body as? [String: String],
let status = dictionary["status"],
let msg = dictionary["msg"] else { return }
// 결제 성공 시 msg 변수에는 siganture가 채워집니다.
switch status {
case "success":
// 결제 성공 시 로직
break;
case "error":
// 결제 실패 시 로직 (유저 이탈)
break;
default:
break
}
}
}
import React from "react";
import { WebView } from "react-native-webview";
const WebViewScreen = () => {
const handlePoint3Widget = (e) => {
const data = JSON.parse(e.nativeEvent.data)
const { status, msg } = data
// 결제 성공 시 msg 변수에는 signature가 채워집니다.
switch (status) {
case "success":
// 결제 성공 시 로직
break;
case "error":
// 결제 실패 시 로직 (유저 이탈)
break;
default:
break;
}
}
return (
<View>
<WebView
onMessage={handlePoint3Widget}
source={"https://widget.point3.io/?d=토큰"}
/>
</View>
);
}
<head>
<!-- Point3 위젯 스크립트 추가 -->
<script src="https://resources.point3.io/widget.js"></script>
<link rel="stylesheet" href="https://resources.point3.io/widget.css" />
<!-- 스크립트 끝 -->
</head>
<body>
<div class="point3-widget">
<div class="point3-widget-inner">
<iframe
id="point3-widget-iframe"
src="https://widget.point3.io/?d=토큰"
sandbox="allow-forms allow-scripts allow-same-origin allow-popups allow-top-navigation allow-modals allow-popups-to-escape-sandbox allow-presentation allow-storage-access-by-user-activation allow-top-navigation-by-user-activation"
/>
</div>
</div>
<script>
function onPaymentError() {
// 결제 실패 시 로직 (유저 이탈)
console.log("유저가 위젯을 종료하였습니다.")
}
function onPaymentSuccess(signature) {
// 결제 성공 시 수행할 동작
// 결제 성공 시 signature 파라미터 변수에는 signature가 채워집니다.
}
</script>
</body>
.point3-widget {
position: absolute;
top: 0;
left: 0;
z-index: 9999;
width: 100%;
height: 100%;
background-color: #0D0D0D;
-webkit-overflow-scrolling: touch;
}
.point3-widget > .point3-widget-inner {
position: absolute;
top: 50%;
left: 50%;
transform: translate(calc((-312px / 2)), calc((-560px / 2)));
width: 312px;
height: 560px;
}
#point3-widget-iframe {
position: absolute;
width: 100%;
height: 100%;
border: none;
}
import React from 'react'
// 위젯 CSS 로드
import './widget.css'
export const WidgetPage = () => {
const onPaymentSuccess = (signature) => {
// 결제 성공 시 수행할 동작
// 결제 성공 시 signature 파라미터 변수에는 signature가 채워집니다.
}
const onPaymentError = () => {
// 결제 실패 시 로직 (유저 이탈)
}
// 이벤트 리스너 추가
window.addEventListener('message', function (e) {
if (e.origin !== "https://widget.point3.io") return;
if (!e.data) return;
const { status, msg } = e.data
if (!status && !msg) return;
if (status === 'error') {
onPaymentError()
}
if (msg === 'success') {
onPaymentSuccess(msg)
}
});
return (
<>
<div className="point3-widget">
<div className="point3-widget-inner">
<iframe
id="point3-widget-iframe"
key={1}
src="https://widget.point3.io/?d=토큰"
sandbox="allow-forms allow-scripts allow-same-origin allow-popups allow-top-navigation allow-modals allow-popups-to-escape-sandbox allow-presentation allow-storage-access-by-user-activation allow-top-navigation-by-user-activation"
/>
</div>
</div>
</>
)
}
.point3-widget {
position: absolute;
top: 0;
left: 0;
z-index: 9999;
width: 100%;
height: 100%;
background-color: #0D0D0D;
-webkit-overflow-scrolling: touch;
}
.point3-widget > .point3-widget-inner {
position: absolute;
top: 50%;
left: 50%;
transform: translate(calc((-312px / 2)), calc((-560px / 2)));
width: 312px;
height: 560px;
}
#point3-widget-iframe {
position: absolute;
width: 100%;
height: 100%;
border: none;
}
<div class="point3-widget">
<div class="point3-widget-inner">
<iframe
id="point3-widget-iframe"
src="https://widget.point3.io/?d=토큰"
sandbox="allow-forms allow-scripts allow-same-origin allow-popups allow-top-navigation allow-modals allow-popups-to-escape-sandbox allow-presentation allow-storage-access-by-user-activation allow-top-navigation-by-user-activation"
/>
</div>
</div>
function onPaymentSuccess(signature) {
// 결제 성공 시 수행할 동작
// 결제 성공 시 변수에는 signature가 채워집니다.
}
function onPaymentError() {
// 결제 실패 시 로직 (유저 이탈)
}
window.addEventListener('message', function (e) {
if (e.origin !== "https://widget.point3.io") return;
if (!e.data) return;
const { status, msg } = e.data
if (!status && !msg) return;
if (status === 'error') {
onPaymentError()
}
if (msg === 'success') {
onPaymentSuccess(msg)
}
});
{
"clientGeneratedUserId": "IDIDIDIDIDIDIDIDIDIDIDIDIDIDT0",
// 고객사에서 발급하고 관리하는 유저 ID [고유 필수]
"totalCharge": 1000,
// 결제 총액 (integer)
"orderIdFromClient": "orderIdRandom",
// 고객사에서 관리하는 결제 ID [고유 권장] (string)
"cultureExpenseType": "a",
// 문화비 소득공제 타입 (1자리 string)
"cashReceiptType": "a",
// 현금영수증 발급 주체 타입 (1자리 string)
"clientBusinessNum": "1428801897",
// 고객사 사업자 번호 (10자리 string)
"clientNickname": "바이올렛 캔디 앤 젤리",
// 고객사 닉네임 (string)
"purchasingProductName": "바이올렛 솜사탕맛 젤리",
// 상품/서비스명 (string)
"taxFreeAmount": 900,
// 면세 금액 (integer)
"vat": 100
// 부가세 (integer)
}
"https://widget.point3.io/?d=<토큰>"
{
"signature": "시그니처",
}