Simple handler for PayPal Express Checkout
Add this line to your application's Gemfile:
gem 'paypal_express_checkout'
And then execute:
$ bundle
Or install it yourself as:
$ gem install paypal_express_checkout
PaypalExpressCheckout.sandbox! # enables sandbox in development or test
# Check the configuration options
PaypalExpressCheckout.configure({
business: '<YOUR PAYPAL ACCOUNT EMAIL>',
return: '<RETURN URL AFTER SUCCESS PURCHASE>',
cancel_return: '<URL TO REDIRECT WHEN PURCHASE IS CANCEL>',
notify_url: '<URL WHERE IPN WOULD SEND PURCHASE INFORMATION>'
})
PaypalExpressCheckout.add_product({
name: "My awesome product name",
amount: 15, # Product's price
quantity: 3,
number: 1242, #SKU
})
redirect_to PaypalExpressCheckout.payment_url # generate the url that the user need to be redirected to complete the purchase
- business: account email or id
- custom: custom data
- invoice: code to identify the bill
- currency_code: "USD" e.g, check the full list here http://bit.ly/anciiH
- cpp_header_image: Image header url [750 pixels wide by 90 pixels high]
- cpp_cart_border_color: The HTML hex code for your principal identifying color
- return: The URL to which PayPal redirects buyers after they complete their payments.
- cancel_return: Specify a URL on your website that displays payment cancellation page
- notify_url: The URL to which PayPal posts information about the payment (IPN)
- lc: Languaje [En,Es] - default En
- shipping
- shipping2
- handling
- tax
- discount_amount_cart: Discount amount [9.99]
- discount_rate_cart: Discount percentage [15]
- first_name
- last_name
- address1
- address2
- city
- state
- zip
- night_phone_a
- night_phone_b
- night_phone_c
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/chukitow/paypal_express_checkout.
The gem is available as open source under the terms of the MIT License.