Ruby 사용자를 위한 아임포트 REST API 연동 모듈입니다.
Iamport.configure do |config|
config.api_key = "API_KEY"
config.api_secret = "API_SECRET"
end
Iamport.token
Iamport.payment("IMP_UID")
Iamport.payments
Iamport.payments(status: "paid")
Iamport.payments(status: "paid", page: 2)
Iamport.prepare(merchant_uid: "M00001", amount: 10000)
Iamport.prepared(merchant_uid: "M00001")
body의 값은 API 문서 - cancel에 있는 사용하는 것을 추가하여 진행하면 됩니다.
body = {
imp_uid: "IMP_UID",
merchant_uid: "M00001",
amount: ""
}
Iamport.cancel(body)
가맹점지정 고유번호를 이용하여 결제정보를 찾는 API
Iamport.find("M00001")
카드정보를 카드사에 요청하여 빌링키를 발급하는 API
Iamport.create_subscribe_customer("your_customer_1234", {
card_number: "1234-1234-1234-1234",
expiry: "2019-07",
birth: "801234",
pwd_2digit: "00",
customer_email: "user@your_customer.com",
customer_name: "홍길동",
customer_tel: "010-1234-5678"
})
※ 필수 항목 : card_number
, expiry
, birth
, pwd_2digit
※ 법인카드의 경우 pwd_2digit
항목 생략가능
{"code"=>0,
"message"=>nil,
"response"=>
{"card_name"=>"현대카드",
"customer_addr"=>nil,
"customer_email"=>"user@your_customer.com",
"customer_name"=>"홍길동",
"customer_postcode"=>nil,
"customer_tel"=>"010-1234-5678",
"customer_uid"=>"your_customer_1234",
"inserted"=>1487921135,
"updated"=>1487921513}}
※ inserted
의 값과 updated
의 값이 같은 경우 신규 발급, 다른 경우 변경을 의미함.
{"code"=>-1,
"message"=>"카드정보 인증 및 빌키 발급에 실패하였습니다. [F112]유효하지않은 카드번호를 입력하셨습니다. (card_bin 없음)",
"response"=>nil}
휴대폰 본인인증 연동 API
Iamport.certification("IMP_UID")
Add this line to your application's Gemfile:
gem 'httparty'
gem 'iamport'
And then execute:
$ bundle
Or install it yourself as:
$ gem install iamport
TODO: Write usage instructions here
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/iamport. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.