Sha256: 3416e739a88552f4180eddac7a6ca21b58e5409ca2997267e55efbfe57c78656
Contents?: true
Size: 1.59 KB
Versions: 2
Compression:
Stored size: 1.59 KB
Contents
== Installation $ gem install paysio == Usage Paysio.api_key = 'YOUR_API_KEY' Paysio::Charge.all == Paysio Objects Paysio::Charge.all # get list of charges Paysio::Wallet.all # get list of wallets Paysio::Coupon.all # get list of coupons Paysio::Reward.all # get list of rewards Paysio::Event.all # get list of events Paysio::Log.all # get list of logs Paysio::Customer.all # get list of customers == Actions: update customer = Paysio::Customer.retrieve("cs_1111111") customer.description = "test user" customer.save == Actions: destroy customer = Paysio::Customer.retrieve("cs_1111111") customer.destroy == Actions: refund charge charge = Paysio::Charge.retrieve("ch_1111111") charge.refund == Sample: redirect to charge after create (e.g. in Ruby on Rails) def create charge = Paysio::Charge.create(amount: 100, payment_system_id: 't_123', description: 'test charge') redirect_to charge.redirect end == Sample: handle webhook events def webhook Paysio.api_key = 'HZClZur5OW3BYimWSydQNsArbph2L7IRo0ql8HK' event = Paysio::Event.new(params) end == Sample: handle webhook events, with getting event from api def webhook Paysio.api_key = 'HZClZur5OW3BYimWSydQNsArbph2L7IRo0ql8HK' event = Paysio::Event.retrieve(params['id']) if event.data.object == 'charge': if event.type == 'charge.success' pass #logic for charge success elsif event.type == 'charge.failure' pass #logic for charge failure elsif event.type == 'charge.refund' pass #logic for charge refund end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paysio-1.0.7 | README.rdoc |
paysio-1.0.6 | README.rdoc |