Class: PayPal::ExpressCheckout::Recurring
- Defined in:
- lib/paypal/express_checkout/recurring.rb
Constant Summary
Constants included from Fields
Fields::ASSOCIATIONS, Fields::ATTRIBUTES
Instance Method Summary collapse
- #bill_outstanding ⇒ Object
-
#cancel ⇒ Object
Cancel a recurring profile.
-
#create_profile ⇒ Object
Create a recurring billing profile.
-
#profile ⇒ Object
Retrieve information about existing recurring profile.
-
#reactivate ⇒ Object
Reactivate a suspended recurring profile.
-
#suspend ⇒ Object
Suspend a recurring profile.
-
#update_profile ⇒ Object
Update a recurring billing profile.
Methods inherited from Base
Methods included from Fields
#field_map, #group_collect, #group_fields, #has_fields?, #has_many?, included, #inverted_field_map
Constructor Details
This class inherits a constructor from PayPal::ExpressCheckout::Base
Instance Method Details
#bill_outstanding ⇒ Object
108 109 110 111 112 113 114 115 116 |
# File 'lib/paypal/express_checkout/recurring.rb', line 108 def bill_outstanding params = collect( :profile_id, :amount, :note ) run(:bill_outstanding, params) end |
#cancel ⇒ Object
Cancel a recurring profile. Cancelled profiles cannot be reactivated.
ppr = PayPal::Recurring.new(:profile_id => "I-HYRKXBMNLFSK")
response = ppr.cancel
33 34 35 |
# File 'lib/paypal/express_checkout/recurring.rb', line 33 def cancel run(:manage_profile, :action => :cancel, :profile_id => profile_id) end |
#create_profile ⇒ Object
Create a recurring billing profile.
ppr = PayPal::ExpressCheckout::Recurring.new({
:amount => "9.00",
:initial_amount => "9.00",
:initial_amount_action => :cancel,
:currency => "USD",
:description => "Awesome - Monthly Subscription",
:ipn_url => "http://example.com/paypal/ipn",
:frequency => 1,
:token => "EC-05C46042TU8306821",
:period => :monthly,
:reference => "1234",
:payer_id => "WTTS5KC2T46YU",
:start_at => Time.now,
:failed => 1,
:outstanding => :next_billing,
:trial_period => :monthly,
:trial_length => 1,
:trial_frequency => 1,
:trial_amount => 0.00
})
response = ppr.create_recurring_profile
62 63 64 65 66 67 68 69 70 |
# File 'lib/paypal/express_checkout/recurring.rb', line 62 def create_profile params = group_collect( :payment_items, :recurring, :payer ) run(:create_profile, params) end |
#profile ⇒ Object
Retrieve information about existing recurring profile.
ppr = PayPal::ExpressCheckout::Recurring.new(:profile_id => "I-VCEL6TRG35CU")
response = ppr.profile
104 105 106 |
# File 'lib/paypal/express_checkout/recurring.rb', line 104 def profile run(:profile, :profile_id => profile_id) end |
#reactivate ⇒ Object
Reactivate a suspended recurring profile.
ppr = PayPal::Recurring.new(:profile_id => "I-HYRKXBMNLFSK")
response = ppr.reactivate
23 24 25 |
# File 'lib/paypal/express_checkout/recurring.rb', line 23 def reactivate run(:manage_profile, :action => :reactivate, :profile_id => profile_id) end |
#suspend ⇒ Object
Suspend a recurring profile. Suspended profiles can be reactivated.
ppr = PayPal::Recurring.new(:profile_id => "I-HYRKXBMNLFSK")
response = ppr.suspend
14 15 16 |
# File 'lib/paypal/express_checkout/recurring.rb', line 14 def suspend run(:manage_profile, :action => :suspend, :profile_id => profile_id) end |
#update_profile ⇒ Object
Update a recurring billing profile.
ppr = PayPal::ExpressCheckout::Recurring.new({
:amount => "99.00",
:currency => "USD",
:description => "Awesome - Monthly Subscription",
:note => "Changed plan to Gold",
:ipn_url => "http://example.com/paypal/ipn",
:reference => "1234",
:profile_id => "I-VCEL6TRG35CU",
:start_at => Time.now,
:outstanding => :next_billing
})
response = ppr.update_recurring_profile
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/paypal/express_checkout/recurring.rb', line 88 def update_profile params = group_collect( :recurring, :credit_card, :payer, :address ) run(:update_profile, params) end |