
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
= AmazonFlexPay
Library for Amazon's Flexible Payment Service.
== INITIALIZE
Initialize the gem, probably in config/initializers/amazon_flex_pay.rb (for Rails):
AmazonFlexPay.access_key = 'your access key' AmazonFlexPay.secret_key = 'your secret key' AmazonFlexPay.go_live! if Rails.env.production?
== CALL
=== AmazonFlexPay::Pipelines
Start here. You'll need tokens for API calls. These are generated by users via parameterized pipelines.
==== Example
Construct a single-use pipeline for the user. This is where the user will agree to pay a certain amount to a specific recipient (maybe you?).
redirect_to AmazonFlexPay.single_use_pipeline( 'mypipeline3292', 'http://example.com/return', :recipient_token => 'RTOKEN', :transaction_amount => '12.99' )
=== AmazonFlexPay::API
With tokens, you can make API calls. Note that results are asynchronous via IPNs. Payment and Refund examples are below. You can see all available API methods here[https://github.com/kickstarter/amazon_flex_pay/blob/master/lib/amazon_flex_pay/api.rb].
==== Payment Example
Once you have a sender token, you can attempt to collect.
begin response = AmazonFlexPay.pay('12.99', 'USD', 'senderToken123') flash[:notice] = "Thanks! Your payment is processing." rescue AmazonFlexPay::API::Error => 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
==== Refund Example
If you would like to give your last order a $10 refund, you can call the refund method like this:
order = Order.last
AmazonFlexPay.refund( order.transaction_id, order.id, caller_description: 'Friends and family discount.', refund_amount: { value: 10, currency_code: 'USD' }, )
Note: In this example, we are using the order id as the caller reference. You can pass any reference that you like. Also, the 'caller_description' and 'refund_amount' options are not required. The default refund amount is the original transaction amount.
Copyright (c) 2013 Kickstarter, released under the MIT license.
FAQs
Unknown package
We found that amazon_flex_pay demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.