Skip to content

Instantly share code, notes, and snippets.

@matthodan
Created August 2, 2010 06:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save matthodan/504213 to your computer and use it in GitHub Desktop.
Save matthodan/504213 to your computer and use it in GitHub Desktop.
credit_card = {
:type => '[cc type, e.g. 'visa']',
:number => '[cc number, from test account]',
:verification_value => '123',
:month => '[expiration month, from test account]',
:year => '[expiration year, from test account]',
:first_name => '[first name, can be anything]',
:last_name => '[last name, can be anything]',
:street_1 => '[street address, can be anything]',
:city => '[city, can be anything]',
:state => '[state, can be anything]',
:country => '[use 'US' if you used a U.S. state code above]',
:zip => '[zip code, can be anything]',
:email => '[payor email address, can be anything]'
}
# I have the 'billing_start_date' set to one-month from today, but
# this can be set to any date as long as it's not in the past
recurring = {
:description => '[text description of the transaction]',
:billing_start_date => Time.now.advance(:months => 1).iso8601,
:periodicity => :monthly,
:amount => [amount in cents],
:auto_bill_outstanding_amount => true
}
# Initial payment is optional, read the PayPal API docs to learn more
initial = {
:amount => [amount in cents]
}
# Trial is optional, read the PayPal API docs to learn more
trial = {
:periodicity => :monthly,
:total_billing_cycles => 1,
:amount => [amount in cents]
}
currency = 'USD'
@response = GATEWAY.create_recurring_profile(
:credit_card => credit_card,
:address => address,
:recurring => recurring,
:initial => initial,
:trial => trial,
:currency => currency)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment