Compropago
This gem helps you integrate ComproPago's API to your ruby app.
Installation
Add this line to your application's Gemfile:
gem 'compropago', '~> 0.0.1'
And then execute:
$ bundle
Or install it yourself as:
$ gem install compropago
Usage
Authentication
We encourage you to set your API keys in an environment variable rather than hardcoding your API keys.
compropago = Compropago::Client.new(ENV['COMPROPAGO_API_KEY'])
Once you have created an instance of compropago, you can call the methods described in the api reference on it.
Examples
Create a charge
Creating a charge using only the required params product_price, product_name, customer_name, customer_email, payment_type.
# create_charge(product_price, product_name, customer_name, customer_email, payment_type)
compropago.create_charge(3150.0, 'iphone5s', 'Irma Sanz', '[email protected]', 'OXXO')
Adding the optional params product_id and image_url to the request:
# create_charge(product_price, product_name, customer_name, customer_email, payment_type, product_id, image_url)
compropago.create_charge(3150.0, 'iphone5s', 'Irma Sanz', '[email protected]', 'OXXO', '5ku8g', 'image.jpg')
Verify a charge
Verify a charge previously made.
# verify_charge(payment_id)
compropago.verify_charge('b75076ac-a94b-478a-945c-c2caf85be668')
SMS payment instructions
Send payment instructions over SMS.
# send_payment_instructions(payment_id, customer_phone, customer_company_phone)
compropago.send_payment_instructions('b75076ac-a94b-478a-945c-c2caf85be668', '2221515805', 'TELCEL')
Contributing
- 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