This development is in a very early stage, please use it at your own risk and feel free to improve it and send Pull Requests.
If your are using a Gemfile add the following line and run the bundle command.
gem "puntopagos"
Create puntopagos.yml to your config folder:
development: environment: "sandbox" puntopagos_key: "YOUR-API-KEY" puntopagos_secret: "YOUR-APP-SECRET" test: environment: "sandbox" puntopagos_key: "YOUR-API-KEY" puntopagos_secret: "YOUR-APP-SECRET" production: environment: "production" puntopagos_key: "YOUR-API-KEY" puntopagos_secret: "YOUR-APP-SECRET"
The config file supports ERB templating. For example you can add values from
your environment
production: environment: <%= ENV["PUNTOPAGOS_ENV"]%> puntopagos_key: <%= ENV["PUNTOPAGOS_KEY"]%> puntopagos_secret: <%= ENV["PUNTOPAGOS_SECRET"]%>
trx_id = 'UNIQUE-TRACKING-ID' # Number as a string amount = '1000.00' # Number as a string with two decimals payment_method = 'some number' # Optional parameter (see PuntoPagos documentation) req = PuntoPagos::Request.new() resp = req.create(trx_id, amount, payment_method) if (resp.success?) redirect_to resp.payment_process_url end
# Action where PuntoPagos it's gonna post def action notification = PuntoPagos::Notification.new # This methods requires the headers as a hash and the params object as a hash notification.valid? headers, params end
status = PuntoPagos::Status.new status.check token, trx_id, amount status.valid? # if there's an error you can call status.error
Gateway | Payload | Expected Result |
Transbank | Visa / 4051885600446623 / CVV: 123 / exp: any | Success |
Transbank | Mastercard / 5186059559590568 / CVV: 123 / exp: any | Failure |
- Config testing
- Response testing
- Functional testing
- Documentation
Ignacio Mella & Gert Findel
Thanks to dvinales for not suing us.