A simple Wechat pay ruby gem.
Add this line to your Gemfile:
gem 'weixin'
And then execute:
$ bundle
# required
Weixin.appid = 'YOUR_APPID'
Weixin.appsecret = 'YOUR_APPSECRET'
Weixin.partnerid = 'YOUR_PARTNERID'
Weixin.partnerkey = 'YOUR_PARTNERKEY'
Weixin.appkey = 'YOUR_APPKEY'
Check official document for detailed request params and return fields
# required fields
params = {
'bank_type' => 'WX'
'body' => 'test',
'fee_type' => '',
'out_trade_no' => '123456789',
'total_fee' => 1,
'spbill_create_ip' => '127.0.0.1',
'notify_url' => 'http://making.dev'
}
Weixin::App.prepay_id(params, 'YOUR_ACCESS_TOKEN')
Bug report or pull request are welcome.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Please write unit test with your code if necessary.
This project rocks and uses MIT-LICENSE.