README.md in przelewy24_payment-0.1.2 vs README.md in przelewy24_payment-0.1.3
- old
+ new
@@ -24,13 +24,18 @@
```ruby
Przelewy24Payment.setup do |config|
config.seller_id = 'your_seller_id'
config.language = 'pl'
- config.mode = :development
- config.error_url = 'http://localhost:3000/your_payment/comeback'
- config.comeback_url = 'http://localhost:3000/your_payment/comeback'
+ config.mode = Rails.env.to_sym # or just put :development or :production symbol
+ config.error_url = '/your_controller/comeback'
+ config.comeback_url = '/your_controller/comeback'
+ config.hostname = {
+ :development => "http://localhost:3000",
+ :production => "your.domain",
+ :staging => "staging.domain"
+ }
end
```
## Usage
@@ -48,10 +53,11 @@
class YourPaymentController < ApplicationController
include Przelewy24PaymentController
...
# after success payemnt this method will be trigger
+ # so you can do whatever you want
def payment_success(payment_params)
# payment_params returns hash with:
# p24_session_id
# p24_order_id
# p24_kwota
@@ -61,11 +67,12 @@
# e.g
# payment = Payment.find_by_session_id(payment_params[:p24_session_id])
end
- # after error payemnt this method will be trigger
+ # after error payment this method will be trigger
+ # so you can do whatever you want
def payment_error(payment_params, code, description)
# payment_params returns hash with:
# p24_session_id
# p24_order_id
# p24_kwota
@@ -75,10 +82,12 @@
#
# code return error code
# description return error description
end
+ # method to setup params to verify it final verifyciation
+ # so you can do whatever you want
def payment_verify(response_params)
# e.g:
# payment = Payment.find_by_session_id(response_params[:p24_session_id])
# you must return hash with amount which was save in your db and optional if you use your crc_key
@@ -106,16 +115,16 @@
def your_payment
session_id = Przelewy24Payment.friendly_token[0,20]
value = give_your_amount
@data = { :session_id => session_id,
- :description => "opis",
+ :description => "opis", # optional param
:value => value,
- :client => 'Adam Nowak',
- :address => 'Powstancow 22/2',
- :zipcode => '53-456',
- :city => 'Wroclaw',
- :country => 'Polska',
+ :client => 'Adam Nowak', # optional param
+ :address => 'Powstancow 22/2', # optional param
+ :zipcode => '53-456', # optional param
+ :city => 'Wroclaw', # optional param
+ :country => 'Polska', # optional param
:email => 'payment@example.com',
# adding this params, you overwrite your config settings so this param is optional
# :language => 'pl',
# :crc => your_crc_key,
# :seller_id => seller_id