Iamport
Ruby ์ฌ์ฉ์๋ฅผ ์ํ ์์ํฌํธ REST API ์ฐ๋ ๋ชจ๋์
๋๋ค.
Code Status
์ธํ
ํ๋ ๋ฐฉ๋ฒ
Iamport.configure do |config|
config.api_key = "API_KEY"
config.api_secret = "API_SECRET"
end
์ฌ์ฉ๋ฒ
token API
Iamport.token
payment API
Iamport.payment("IMP_UID")
payments API
Iamport.payments
Iamport.payments(status: "paid")
Iamport.payments(status: "paid", page: 2)
payments.validation API
๊ฒฐ์ ์์ ๊ธ์ก์ ์ฌ์ ๋ฑ๋ก
Iamport.prepare(merchant_uid: "M00001", amount: 10000)
์ฌ์ ๋ฑ๋ก๋ ๊ฒฐ์ ์ ๋ณด๋ฅผ ์กฐํ
Iamport.prepared(merchant_uid: "M00001")
cancel API
body์ ๊ฐ์ API ๋ฌธ์ - cancel์ ์๋ ์ฌ์ฉํ๋ ๊ฒ์ ์ถ๊ฐํ์ฌ ์งํํ๋ฉด ๋ฉ๋๋ค.โ
body = {
imp_uid: "IMP_UID",
merchant_uid: "M00001",
amount: ""
}
Iamport.cancel(body)
find API
๊ฐ๋งน์ ์ง์ ๊ณ ์ ๋ฒํธ๋ฅผ ์ด์ฉํ์ฌ ๊ฒฐ์ ์ ๋ณด๋ฅผ ์ฐพ๋ API
Iamport.find("M00001")
subscribe_customer API
์นด๋์ ๋ณด๋ฅผ ์นด๋์ฌ์ ์์ฒญํ์ฌ ๋น๋งํค๋ฅผ ๋ฐ๊ธํ๋ 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
ํญ๋ชฉ ์๋ต๊ฐ๋ฅ
๋น๋งํค ๋ฐ๊ธ/๋ณ๊ฒฝ ์ฑ๊ณต์ Response
{"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
์ ๊ฐ์ด ๊ฐ์ ๊ฒฝ์ฐ ์ ๊ท ๋ฐ๊ธ, ๋ค๋ฅธ ๊ฒฝ์ฐ ๋ณ๊ฒฝ์ ์๋ฏธํจ.
๋น๋งํค ๋ฐ๊ธ/๋ณ๊ฒฝ ์คํจ์ Response
{"code"=>-1,
"message"=>"์นด๋์ ๋ณด ์ธ์ฆ ๋ฐ ๋นํค ๋ฐ๊ธ์ ์คํจํ์์ต๋๋ค. [F112]์ ํจํ์ง์์ ์นด๋๋ฒํธ๋ฅผ ์
๋ ฅํ์
จ์ต๋๋ค. (card_bin ์์)",
"response"=>nil}
Installation
Add this line to your application's Gemfile:
gem 'httparty'
gem 'iamport'
And then execute:
$ bundle
Or install it yourself as:
$ gem install iamport
Usage
TODO: Write usage instructions here
Development
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.
Contributing
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.
License
The gem is available as open source under the terms of the MIT License.