본 문서에서는 페이플 결제 취소 가이드를 안내합니다.
1. 정의
•
결제 취소란 결제된 거래건을 취소하는 기능입니다.
결제 취소 상태는 해외결제 파트너 관리자 결제내역에서 ‘상태’ 값으로 확인할 수 있습니다.
2. 프로세스 개요
3. 파트너 인증 토큰발급
Partner Server Side
•
파트너는 취소 요청을 보내기 전 파트너 인증 프로세스를 진행해야 합니다.
•
파트너 인증을 위한 토큰 발급은 취소 요청 전 필수로 진행해야 합니다.
발급받은 access_token은 취소 요청 시 필요하며,
토큰의 유효기간(10분)이 지나면 토큰을 다시 발급받으셔야 합니다.
파트너 인증 토큰발급 요청시에는 등록한 IP(White IP)와의 통신만 허용합니다.
이외 IP로 파트너 인증 토큰발급 요청을 할 경우 거부되니 주의해주세요.
Partner Authorization Request Parameters
code는 반드시 영문자+숫자만 포함하여 10자만 입력해야합니다.
Table
Search
Request sample
•
Header 정보
/*
* Request HTTP URL
* TEST : https://demo-api.payple.kr/gpay/oauth/1.0/token
* REAL : https://api.payple.kr/gpay/oauth/1.0/token
*/
Request HTTP URL: "https://demo-api.payple.kr/gpay/oauth/1.0/token"
HTTP Method: POST
Content-Type: application/json
Cache-Control: no-cache
JSON
복사
•
Body(Payload) 값
{
"service_id":"demo",
"service_key":"abcd1234567890",
"code":"as12345678"
}
JSON
복사
Partner Authorization Response Parameters
•
토큰발급 요청이 성공하면 페이플에서 파트너에 다음과 같은 성공 리턴을 드립니다.
Table
Search
Response sample
{
"result": "T0000",
"message": "Process Success",
"code": "as12345678",
"access_token": "eyJhbGciOiJzaGEyNT...",
"token_type": "Bearer",
"payCls": "demo", // 테스트 결제(결제창)인 경우에만 필요
"expires_in": "600"
}
JSON
복사
result= "T0000", message= "Process Success"인 경우 요청 성공으로 판단합니다.
발급받은 access_token은 취소 요청시 Authorization 값으로 필요합니다.
4. 결제 취소 요청
Partner Server Side
•
파트너 인증이 완료되면 취소 요청을 합니다.
Cancel Request Parameters
파트너 인증 토큰 발급시 받은 access_token값을 HTTP Authorization Header에 넣어서 요청해주세요.
- 인증 토큰의 유효기간은 10분입니다.
- 한 번의 파트너 인증 토큰 발급으로 유효기간(10분) 이내에 결제를 완료해야 합니다.
페이플에서는 사용자 인증을 OAuth 2.0으로 진행합니다.
Table
Search
Request sample
•
Header 정보
/*
* Request HTTP URL
* TEST : https://demo-api.payple.kr/gpay/cancel
* REAL : https://api.payple.kr/gpay/cancel
*/
Request HTTP URL: "https://demo-api.payple.kr/gpay/cancel"
HTTP Method: POST
Content-Type: application/json
Cache-Control: no-cache
Authorization: Bearer, Access Token
JSON
복사
$arrObHeader = array (
"Authorization: Bearer $paypleToken[access_token]",
"Accept: application/json"
);
PHP
복사
PHP - Header 값 설정 예시
•
Body(Payload) 값
{
"service_id":"demo",
"comments": "테스트상품명",
"service_oid": "test120220608512351",
"pay_id": "6548264741426583803027",
"totalAmount": "0.10",
"currency": "USD",
"resultUrl" : "http://test.shop.com"
}
JSON
복사
Cancel Response Parameters
Table
Search
결제 취소 응답 형식은 아래 Response Sample 형식입니다.
결제 취소 결과로 반환되는 결과는 Depth(info)가 있으니 이 점 참고해주시기 바랍니다.
Response sample
{
"type": "CANCEL",
"result": "A0000",
"message": "처리 성공",
"resultUrl": "http://test.shop.com",
"api_id": "676273618072602",
"api_date": "2022-06-10 16:09:22",
"info": {
"totalAmount": "0.10",
"currency": "USD",
"service_oid": "OID_22072217525616584799763773750",
"submitTimeUtc": "2022-06-10 07:09:22"
},
"serviceDefine": "Service Define Test"
}
JSON
복사
result= "A0000", message= "처리 성공"인 경우 요청 성공으로 판단합니다.