"
If you have to support an existing plan with a Stripe plan id that can not
be used as a Ruby constant, provide the plan id as a symbol when
defining the plan, but provide the name for the constant to define with constant_name:
Stripe.plan "Silver-Plan".to_sym do |plan|
plan.constant_name = 'SILVER_PLAN'
end
Stripe::Plans::SILVER_PLAN # => will be defined
# Will map to plan :id => "Silver-Plan" on Stripe
Note - If you're planning on running rake stripe:prepare to
create your subscription plans, Stripe will restrict plan ids to match
this regexp (/\A[a-zA-Z0-9_\-]+\z/) when created via API but still
allows creation of plan ids that don't follow this restriction when
manually created on stripe.com.
"
Notes:
@tansengming What do you think of how it's validating whether :constant_name provided can be used as a Ruby constant? Rails uses regex match in places like constantize but this seemed more precise?
not sure if master is the right branch to point against
As per new addition to Readme this allows:
" If you have to support an existing plan with a Stripe plan id that can not be used as a Ruby constant, provide the plan id as a symbol when defining the plan, but provide the name for the constant to define with
constant_name
:Note - If you're planning on running
rake stripe:prepare
to create your subscription plans, Stripe will restrict plan ids to match this regexp (/\A[a-zA-Z0-9_\-]+\z/
) when created via API but still allows creation of plan ids that don't follow this restriction when manually created on stripe.com. "Notes:
:constant_name
provided can be used as a Ruby constant? Rails uses regex match in places likeconstantize
but this seemed more precise?master
is the right branch to point against