API연동

PIPE PG API 연동 문서

시작하기

PIPE는 누구라도 쉽게 암호화폐를 이용하여 결제를 받을 수 있는 서비스입니다.
간단한 가입으로 APIKEY를 발급받고 단 2개의 API만으로 PIPE의 전 기능을 이용 할 수 있습니다.
데스크톱과 모바일 환경에 최적하된 코드를 제공하고 있으며, 주요 웹브라우저를 완벽하게 지원할 수 있습니다.

클라이언트 아이디 발급

PIPE를 사용하려면 애플리케이션을 생성하고 APIKEY를 발급받아야 합니다.
(애플리케이션을 생성하려면 아이디가 필요합니다.)

단계1. 어플리케이션 생성하기

PIPE관리페페이지의 에플리케이션 등록에서 기본 정보를 입력합니다.

단계2. 웹 서비스 URL 및 IP 등록하기

사용할 서버의 정보를 입력하고 저장을 합니다.
(입력된 정보외의 접근은 전부 차단됩니다.)

단계3. 사용할 코인설정 및 정산 받을 지갑 설정하기

이용하고자 하는 코인의 종류를 선택하고 정산 받고자하는 지갑주소를 입력합니다.
(보유한 지갑이 없는경우 PIPE wallet을 이용해 보세요.)

결제창 호출

회원 가입 후 이용하고자 하는 어플리케이션을 생성 한뒤 아래 양식으로 결제창을 호출 할 수 있습니다.
REQUEST
POST https://pay.pipeblockchain.com/api/v1/invoice/create
HEADERS
Content-Type: multipart/form-data
PARAMETERS
Parameter Name Type Require Notes
api_key String Require 애플리케이션 설정에서 발급받은 Api Key
price_currency String Require 결제할 금액의 통화(KRW / USD)
price Float Require 결제할 금액 ex) KRW : 100000, USD : 10.02
(소수는 소수점 2자리까지 입력해주세요.)
order_id String Require 판매자 주문 아이디.(판매자 내부 관리 번호)
order_name String Optional 판매자 주문 명.(판매자 내부 관리 명).
미입력시 order id 로 자동 지정.
language String Optional(Default en) 결제 페이지 언어.(en / kr)
결제 페이지 요청시 수동으로 변경가능합니다.
callback_url String Require 결제 결과를 수신하기 위한 URL.
애플리케이션 설정에 입력한 URL를 포함하여 전체 경로를 입력해주세요.
ex) https://dev-www.pipeblockchain.com/payment/callback
open_type String Optional 결제창 접근 방식
Value Comment
redirect 페이지 이동. 결제 완료후 요청된 redirect_url 로 이동
popup 새창 열림. 결제 완료후 결제창 닫음(window.close())
layer 레이어 팝업. 결제 완료후 '_PIPE_PG_CLOSE()' 함수 호출. 해당 함수는 상점 사이트에서 정의하시면 됩니다.
redirect_url String Optional 애플리케이션 사이트로 이동할 URL.
애플리케이션 설정에 입력한 URL를 포함하여 전체 경로를 입력해주세요.
ex) https://dev-www.pipeblockchain.com/payment/callback
refund_address String Optional 결제 실패시 자동으로 환급받을 주소.
미입력시 결제화면에서 입력받습니다.
REQUEST EXAMPLE
## HTTPS POST
## Replace YOUR-API-KEY with a Application Auth Key from your PIPE Dashboard
curl https://pay.pipeblockchain.com/api/v1/invoice/create \
    -X POST \
    -H "Content-Type: multipart/form-data" \
    -d '{"api_key"=>YOUR-API-KEY,"price"=>12.34,"price_currency"=>"USD","callback_url"=>YOUR-PAYMENT-CALLBACK-URL,"order_id"=>"test_order_id","order_name"=>"test_order_name","refund_address"=>"refund_address"}'
					
RESPONSE TYPE
JSON
RESPONSE
Field Name Type Notes
code Number 결과 코드 (성공 : 1, 실패 : 그외)
message String 결과 메세지 (성공 : 'success', 실패 : fail reason)
data String(Array) 요청 성공시 Invoice ID 와 Invoice URL 이 제공됩니다.
Name Type Comment
invoice_id String 결제 가능한 Invoice ID.
invoice_url String Invoice ID 로 결제 가능한 결제 페이지 주소.
create_time Number Invoice 생성일 타임스탬프.
RESPONSE EXAMPLE
{
	code: 1,
	message: "success",
	data:
	{
		invoice_id: "944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5",
		invoice_url: "https://pay.pipeblockchain.com/invoice-944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5",
		create_time: 1552893129
	}
}
					

결제결과 수신

결제창을 호출할때 지정한 CALLBACK URL 로 결제 결과를 수신 받습니다.
호출 정상 수신시 "ok"가 리턴된다면 정상 수신으로 반영합니다.
RESPONSE
Field Name Type Notes
code Number 결과 코드 (성공 : 1, 실패 : 그외)
message String 결과 메세지 (성공 : 'success', 실패 : fail reason)
data String(Array)
Name Type Comment
invoice_id String 결제 Invoice ID.
order_id String 판매자 주문 아이디.(판매자 내부 관리 번호)
order_name String 판매자 주문 명.(판매자 내부 관리 명)
price_currency String 요청된 결제 금액의 통화
price Float 요청된 결제 금액
request_refund_address String 코인 환불 주소
status Number Invoice 상태
2 : 결제 완료
create_time Number Invoice 생성일 타임스탬프.
update_time Number Invoice 수정일 타임스탬프.
coin_currency String 결제된 코인 유형 (ETH / BTC)
coin_amount Sting 결제된 코인 수량
sender_address Sting 입금주소(결제 코인이 "ETH" 일 경우 )
deposit_address Sting 결제 주소
deposit_amount Sting 입금된 코인 수량
deposit_status Number Invoice 상태
0 : 입금 대기
1 : 입금 완료
2 : 전송중
deposit_date Number Invoice 입금완료 타임스탬프.
RESPONSE EXAMPLE
{
	code: "1",
	message: "success",
	data:
	{
		invoice_id: "944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5",
		order_id: "O20190318161209298156",
		order_name: "Test Order Name",
		price: 10500,
		price_currency: "KRW",
		request_refund_address: "0x71a4A8c7286e048eb2E4dAE3bD8EACe119C56076",
		status: 1,
		create_date: 1552893129,
		update_date: 1552893129,
		coin_currency: "ETH",
		coin_amount: "0.06673",
		sender_address: "",
		deposit_address: "0xe7EE045db39A13ad577E0E50F2A5255eB5e031dD",
		deposit_amount: "0.06673"
		deposit_status: "1",
		deposit_date: 1552896129
	}
}
					

결제결과 수신 테스트

결제 결과를 수신 받을수 있는 테스트 API 입니다.
해당 API 는 실제 결제완료 처리가 되지 않습니다.
정상 수신시 "ok"가 리턴된다면 정상 수신으로 반영합니다
중복적으로 호출 가능합니다.
REQUEST
POST https://pay.pipeblockchain.com/api/v1/test/callback
HEADERS
Content-Type: multipart/form-data
PARAMETERS
Parameter Name Type Require Notes
api_key String Require 애플리케이션 설정에서 발급받은 Api Key
invoice_id String Require 결제 Invoice ID.
callback_url String Optional 결제 결과를 수신하기 위한 URL.
기본값은 결제창 호출 API 에 전달된 callback_url 입니다.
REQUEST EXAMPLE
## HTTPS POST
## Replace YOUR-API-KEY with a Application Auth Key from your PIPE Dashboard
curl https://pay.pipeblockchain.com/api/v1/test/callback \
-X POST \
-H "Content-Type: multipart/form-data" \
-d '{"api_key"=>YOUR-API-KEY,"invoice_id"=>"944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5"}'
					
RESPONSE
Field Name Type Notes
code Number 결과 코드 (성공 : 1, 실패 : 그외)
message String 결과 메세지 (성공 : 'success', 실패 : fail reason)
data String(Array) 전송 성공시 전송데이터와 수신데이터가 리턴됩니다.
Name Type Comment
callback_url String 결제결과를 전송한 url
send Array callback_url 로 전송한 데이터 배열
response String callback_url 에서 리턴된 데이터
RESPONSE EXAMPLE
{
	code: 1,
	message: "success",
	data:
	{
		callback_url: "YOUR-PAYMENT-CALLBACK-URL",
		send:
		{
			invoice_id: "944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5",
			order_id: "O20190318161209298156",
			.....
		},
		response: "ok"
	}
}
						

Invoice 조회

REQUEST
POST https://pay.pipeblockchain.com/api/v1/invoice/get
HEADERS
Content-Type: multipart/form-data
PARAMETERS
Parameter Name Type Require Notes
api_key String Require 애플리케이션 설정에서 발급받은 Api Key
invoice_id String Require 결제 Invoice ID.
REQUEST EXAMPLE
## HTTPS POST
## Replace YOUR-API-KEY with a Application Auth Key from your PIPE Dashboard
curl https://pay.pipeblockchain.com/api/v1/invoice/get \
-X POST \
-H "Content-Type: multipart/form-data" \
-d '{"api_key"=>YOUR-API-KEY,"invoice_id"=>"944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5"}'
					
RESPONSE TYPE
JSON
RESPONSE
Field Name Type Notes
code Number 결과 코드 (성공 : 1, 실패 : 그외)
message String 결과 메세지 (성공 : 'success', 실패 : fail reason)
data String(Array)
Name Type Comment
invoice_id String 결제 Invoice ID.
order_id String 판매자 주문 아이디.(판매자 내부 관리 번호)
order_name String 판매자 주문 명.(판매자 내부 관리 명)
price_currency String 요청된 결제 금액의 통화
price Float 요청된 결제 금액
request_refund_address String 코인 환불 주소
status Number Invoice 상태
1 : 결제 대기
2 : 결제 완료
3 : 결제 만료
4 : 결제 환불
create_time Number Invoice 생성일 타임스탬프.
update_time Number Invoice 수정일 타임스탬프.
coin_currency String 결제된 코인 유형 (ETH / BTC)
coin_amount Sting 결제된 코인 수량
sender_address Sting 입금주소(결제 코인이 "ETH" 일 경우 )
deposit_address Sting 결제 주소
deposit_amount Sting 입금된 코인 수량
deposit_status Number Invoice 상태
0 : 입금 대기
1 : 입금 완료
2 : 전송중
deposit_date Number Invoice 입금완료 타임스탬프.
RESPONSE EXAMPLE
{
	code: "1",
	message: "success",
	data:
	{
		invoice_id: "944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5",
		order_id: "O20190318161209298156",
		order_name: "Test Order Name",
		price: 10500,
		price_currency: "KRW",
		request_refund_address: "0x71a4A8c7286e048eb2E4dAE3bD8EACe119C56076",
		status: 1,
		create_date: 1552893129,
		update_date: 1552893129,
		coin_currency: "ETH",
		coin_amount: "0.06673",
		sender_address: "",
		deposit_address: "0xe7EE045db39A13ad577E0E50F2A5255eB5e031dD",
		deposit_amount: "0.06673"
		deposit_status: "1",
		deposit_date: 1552896129
	}
}
						

환불 요청

결제 이후 환불 요청시 네트워크 수수료를 제외하고 결제 요청시 입력한 환불 주소로 환불됩니다.
REQUEST
POST https://pay.pipeblockchain.com/api/v1/invoice/refund
HEADERS
Content-Type: multipart/form-data
PARAMETERS
Parameter Name Type Require Notes
api_key String Require 애플리케이션 설정에서 발급받은 Api Key
invoice_id String Require 결제 Invoice ID.
callback_url String Optional 환불 결과를 수신하기 위한 URL.
애플리케이션 설정에 입력한 URL를 포함하여 전체 경로를 입력해주세요.
ex) https://dev-www.pipeblockchain.com/refund/callback
REQUEST EXAMPLE
## HTTPS POST
## Replace YOUR-API-KEY with a Application Auth Key from your PIPE Dashboard
curl https://pay.pipeblockchain.com/api/v1/invoice/refund \
	-X POST \
	-H "Content-Type: multipart/form-data" \
	-d '{"api_key"=>YOUR-API-KEY,"invoice_id"=>"944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5","callback_url"=>YOUR-REFUND-CALLBACK-URL}'
						
RESPONSE TYPE
JSON
RESPONSE
Field Name Type Notes
code Number 결과 코드 (성공 : 1, 실패 : 그외)
message String 결과 메세지 (성공 : 'success', 실패 : fail reason)
data String(Array) 요청 성공시 환불 ID가 제공됩니다.
Name Type Comment
refund_id String 환불 ID.
create_time Number 환불 요청일 타임스탬프.
RESPONSE EXAMPLE
	{
		code: 1,
		message: "success",
		data:
		{
			invoice_id: "944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5",
			create_time: 1552893129
		}
	}
						

환불결과 수신

환불 API 요청시 지정한 CALLBACK URL 로 환불 결과(환불실패/전송/성공)를 수신 받습니다.
호출 정상 수신시 "ok"가 리턴된다면 정상 수신으로 반영합니다.
RESPONSE
Field Name Type Notes
code Number 결과 코드 (성공 : 1, 실패 : 그외)
message String 결과 메세지 (성공 : 'success', 실패 : fail reason)
data String(Array) 요청 성공시 Invoice ID 와 Invoice URL 이 제공됩니다.
Name Type Comment
refund_id String 환불 ID.
invoice_id String 결제 Invoice ID.
order_id String 애플리케이션 주문 아이디.
order_name String 애플리케이션 주문 아이디.
price_currency String 요청된 결제 금액의 통화
price Float 요청된 결제 금액
coin_currency String 결제된 코인 유형 (ETH / BTC)
coin_amount Sting 결제된 코인 수량
refund_amount Sting 환불 코인 수량
refund_network_fee Sting 환불 네트워크 수수료
transaction_address Sting 환불 트랜젝션 주소
refund_address String 코인 환불 주소
status Number Invoice 상태
1 : 환불 요청 완료
2 : 환불 진행중
3 : 환불 완료
4 : 환불 실패
fail_reason String 환불 실패시 실패사유
create_time Number 환불 요청일 타임스탬프.
update_time Number 환불 정보 수정일 타임스탬프.
transaction_date Number 환불 트랜젝션 생성일 타임스탬프.
complete_date Number 환불 완료일 타임스탬프.
RESPONSE EXAMPLE
	{
		code: "1",
		message: "success",
		data:
		{
			invoice_id: "944B4B9C7367CBA6B0AC751E9C9AFB7663DDB73E6D32210D58885464E61575B5",
			order_id: "O20190318161209298156",
			order_name: "Test Order Name",
			price: 10500,
			price_currency: "KRW",
			refund_id: "9F63463B752E2402666C4937E0AD69D5F83F8A977FD24C03DD3FBE78DFEA1837",
			deposit_address: "0x13C902918E0b386BFBbBa5256b7e422a61C36D6E",
			refund_address: "0x71a4A8c7286e048eb2E4dAE3bD8EACe119C56076",
			coin_currency: "ETH",
			coin_amount: "0.06673",
			refund_amount: "0.0667258",
			refund_network_fee: "0.0000042",
			transaction_address: "e9b8c0aa78d3fd59c86cfc1b9067e350668f009e2793a955ee0552fe4db4e633",
			status: 1,
			create_date: 1552893129,
			update_date: 1552893129,
			transaction_date: 1552893329,
			complete_date: 1552894129
		}
	}