Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
API for Amazon's Flexible Payments Service
branch: master

This branch is 53 commits behind kickstarter:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README.rdoc
Rakefile
amazon_flex_pay.gemspec

README.rdoc

AmazonFlexPay

Library for Amazon's Flexible Payment Service.

CONFIGURE

In config/initializers/amazon_flex_pay.rb, do the following:

AmazonFlexPay.access_key = 'your access key'
AmazonFlexPay.secret_key = 'your secret key'
AmazonFlexPay.go_live! # if you're done with the sandbox

EXAMPLES

Note that while the examples are shown using Rails methods, the only Rails requirement is ActiveSupport's inflector.

  1. Construct a single-use pipeline for the user. This is where the user will agree to pay a certain amount to a specific recipient.

    pipeline = AmazonFlexPay.single_use_pipeline('mypipeline3292', :recipient_token => 'RTOKEN', :transaction_amount => '12.99')
    redirect_to pipeline.url('http://example.com/return')
  2. Then on the return page, take the sender token and run a Pay request:

    begin
      response = AmazonFlexPay.pay('12.99', 'USD', 'STOKEN', 'myrequest3292')
      flash[:notice] = "Thanks! Your payment is processing."
    rescue AmazonFlexPay::API::ErrorResponse => e
      flash[:error] = "Sorry, something went wrong."
      e.errors.each do |error|
        # notify yourself about error.code and error.message
      end
    end
    redirect_to product_path
  3. Then wait for a IPN to your registered listening URL and check that it's successful.

LEARN MORE

All methods required for integrating API calls and Pipeline requests are found in the AmazonFlexPay module.

Copyright © 2011 Lance Ivy, released under the MIT license.

Something went wrong with that request. Please try again.