Class: Simplepay::Services::Subscription
- Inherits:
-
Simplepay::Service
- Object
- Simplepay::Service
- Simplepay::Services::Subscription
- Defined in:
- lib/simplepay/services/subscription.rb
Overview
A Simple Pay Subscription is an automatically recurring payment which is charged every interval (Simplepay::Support::BillingFrequency) until a limiting period (Simplepay::Support::SubscriptionPeriod) is met.
With this type of payment, for example, you may charge your customer:
$10.00 every 3 days until 9 days.
$9.95 every 1 month until forever.
Simple Pay Subscription Fields
Required Fields
The following attributes are required when creating a Simple Pay Subscription form (in addition to those listed in Simplepay::Service
):
- amount
-
The dollar value you’d like to collect.
- description
-
A summary of the reason for the payment, this is displayed to your customer during checkout.
- recurring_frequency
-
Defines how often to charge your customer (ex. “1 month”)
Optional Fields
- abandon_url
-
The fully-qualified URL to send your custom if they cancel during payment.
- auto_renew
-
Instructs Amazon to automatically renew the subscription after the
subscription_period
ends. - cobranding_style
-
Defines the type of cobranding to use during the checkout process.
- collect_shipping_address
-
Tells Amazon whether or not to ask for shipping address and contact information.
- immediate_return
-
Immediately returns the customer to your
return_url
directly after payment. - ipn_url
-
Fully-qualified URL to which Amazon will POST instant payment notifications.
- process_immediately
-
Instructs Amazon to immediately process the payment.
- reference_id
-
A custom string your can set to identify this transaction, it will be returned with the IPNs and other returned data.
- return_url
-
Fully-qualified URL for where to send your customer following payment.
- start_date
-
Instructs Amazon with the timestamp to start the recurring subscription charges.
- subscription_period
-
Defines the expiration window of the subscription (i.e. charge
amount
everyrecurring_frequency
for “36 months”)
Example
(in your view, using the form helper)
<%= simplepay_form_for(:subscription, {
:amount => 12.95,
:recurring_frequency => "1 year",
:description => "My.Url Yearly Dues"
}) %>
Constant Summary
Constants inherited from Simplepay::Service
Simplepay::Service::ENDPOINT_URL, Simplepay::Service::SANDBOX_URL
Instance Attribute Summary
Attributes inherited from Simplepay::Service
Method Summary
Methods inherited from Simplepay::Service
field, fields, #fields, #form, required_field, set_submit_tag, submit_tag, #url