Ruby client for ReCharge Payments' recurring payments API for Shopify.
Ruby gems:
gem install recharge-api
Bundler:
gem "recharge-api", :require => "recharge"
require"recharge"ReCharge.api_key="YOUR_KEY"# Can also use Rechargedata={:address_id=>123234321,:customer_id=>565728,# ... more stuff:next_charge_scheduled_at=>Time.new,:properties=>{:name=>"size",:value=>"medium"}}subscription=ReCharge::Subscription.create(data)subscription.address_id=454343subscription.save# OrReCharge::Subscription.update(id,data)subscription=ReCharge::Subscription.new(data)subscription.saveorder1=ReCharge::Order.get(123123)order1.line_items.eachdo |li|
pli.titlepli.quantityendorder2=ReCharge::Order.get(453321)p"Different"iforder1 != order2JSON.dump(order2.to_h)customers=ReCharge::Customer.list(:page=>10,:limit=>50)customers.eachdo |customer|
addresses=ReCharge::Customer.addresses(customer.id)# ...endFor complete documentation refer to the API docs: http://rdoc.info/gems/recharge-api
Add the following to your Rakefile:
require"recharge/tasks"This will add the following tasks:
recharge:hook:create- create webhookHOOKto be sent toCALLBACKrecharge:hooks:delete- delete the webhook(s) given byIDrecharge:hooks:delete_all- delete all webhooksrecharge:hooks:list- list webhooks
All tasks require RECHARGE_API_KEY be set.
For example, to create a hook run the following:
rake recharge:hooks:create RECHARGE_API_KEY=YOURKEY HOOK=subscription/created CALLBACK=https://example.com/callback
Released under the MIT License: www.opensource.org/licenses/MIT
Made by ScreenStaring