API 방식으로 빌링키 발급,결제요청,예약결제를 구현할수 있습니다.
일회성 결제 요청하기
REST API POST /subscribe/payments/onetime 을 호출하여 일회성 결제를 요청합니다. 요청 시 전달된 카드는 포트원에 등록되지 않습니다.
Copy curl -H "Content-Type: application/json" \
-X POST -d '{"merchant_uid":"order_id_8237352", "card_number":"1234-1234-1234-1234", "expiry":"2019-01", "birth":"123456", "amount":3000}' \
https://api.iamport.kr/subscribe/payments/onetime
빌링키 발급 요청하기
REST API POST /subscribe/customers/{customer_uid} 를 호출하여 빌링키 발급을 요청합니다.
Copy curl -H "Content-Type: application/json" \
-X POST -d '{"card_number":"1234-1234-1234-1234", "expiry":"2025-12", "birth":"820213", "pwd_2digit":"00"}' \
https://api.iamport.kr/subscribe/customers/your-customer-unique-id
빌링키 발급 및 최초 결제 요청하기
REST API POST /subscribe/payments/onetime 을 호출하여 빌링키 발급과 최초 결제를 요청합니다.
customer_uid
: 빌링키 등록을 위해서 지정해야 합니다.
Copy curl -H "Content-Type: application/json" \
-X POST -d '{"customer_uid":"your-customer-unique-id", "merchant_uid":"order_id_8237352", "card_number":"1234-1234-1234-1234", "expiry":"2019-01", "birth":"123456", "amount":3000}' \
https://api.iamport.kr/subscribe/payments/onetime
빌링키로 결제 요청하기
빌링키 발급과 최초 결제가 성공하면 빌링키는 전달된 customer_uid
와 1:1 매칭되어 포트원에 저장됩니다. 보안상의 이유로 서버는 빌링키에 직접 접근할 수 없기 때문에 customer_uid
를 이용해서 재결제(POST /subscribe/payments/again ) REST API를 다음과 같이 호출합니다.
Copy curl -H "Content-Type: application/json" \
-X POST -d '{"customer_uid":"your-customer-unique-id", "merchant_uid":"order_id_8237352", "amount":3000}' \
https://api.iamport.kr/subscribe/payments/again
자세한 가이드는 아래 링크를 참조하세요