Open jayfk opened 8 years ago
@jayfk Would you mind joining our Pinax Slack team (http://slack.pinaxproject.com) and bringing this up in the #pinax-stripe channel? Someone should be able to help you faster if you ping us in Slack. Thank you! :)
@jayfk this does seem like a bug, i'm going to need to try and reproduce it so I can debug further.
@jayfk so i just started with a fresh project:
pinax start --dev stripe mytestproject
I then seeded the database with some users and ran init_customers
using a demo stripe account and customers were created just fine.
pinax-stripe
(django-stripe-payments
)?Thanks, Patrick
Was this an existing site you were adding users to?
No, I started relatively fresh with a cookiecutter-django project.
Were you upgrading from a previous version of pinax-stripe (django-stripe-payments)?
No.
Do you have active users in your Stripe account?
I've created a couple of test users on the stripe dashboard, but does this matter here? When looking at the code, all init_customers
is doing is to call customers.create
for every user.
What version of the API is your Stripe account set to?
2015-10-16 (latest)
If I get a chance, I'll try to reproduce it with a new demo account on a new project.
Do you have your stripe account setup in such a way that there is a default plan or something? You should be able to create a customer without having a payment source, but it seems like perhaps in your case on your Stripe account that customer is trying to be added to a plan or something. Still looking.
@jayfk
Oh I see, I bet the plan settings.PINAX_STRIPE_DEFAULT_PLAN
is not None
or points to a plan that doesn't have a trial period so it's trying to charge immediately upon customer creation and when it can't the exception is being raised. I believe this is the proper behavior but open to ideas from your perspective.
Have you set PINAX_STRIPE_DEFAULT_PLAN
to something?
I had this issue, too. Users could not sign up. My settings.py had a default plan as follows: PINAX_STRIPE_DEFAULT_PLAN='plan1' where 'plan1' was the id of my stripe subscription plan. In my stripe account, 'plan1' had a trial period of 15 days. To get this to work, I had to remove the default plan from settings.py, then from the shell, run:
from pinax.stripe.actions import plans
plans.sync_plans() This added the plan to my db. The new users could then sign up and subscribe to the plan, but I had to leave the default plan out of my settings.py.
I don't think this is a bug on the code. Perhaps, the problem has to do with the configuration of the plan. At least that was my problem. I didn't had a "grace period" activated hence creating the same issue. So, try adding the "trial_period_days" to check if ends with your error. It worked for me. :)
Having the same issue.. I don't want to have a grace period on my plan. I should be able to create a customer and then add a card afterwards?
Hey all, the reason for this is because by default Subscription
s are charged at the beginning of the term, without a payment method attached to the Customer
object the initial Invoice
would be immediately un-payable.
One work around this as mentioned is using one of the trial_
parameters which will delay that initial charge.
https://stripe.com/docs/api/subscriptions/create#create_subscription-trial_end
token = tokenResults.id
from pinax.stripe.actions import customers
customers.create(user=User.objects.get(pk=user.pk),charge_immediately=False, plan=None)
from pinax.stripe.actions.sources import create_card
create_card(customer=User.objects.get(pk=user.pk).customer,token=token)
from pinax.stripe.actions.subscriptions import create
if planType == "Monthly":
create(customer=User.objects.get(pk=user.pk).customer,plan='XXX',quantity=1,trial_days=0)
else:
create(customer=User.objects.get(pk=user.pk).customer,plan='XX',quantity=1,trial_days=0)
I was able to get the desired results without putting anyone on a trial this way -- for anyone looking for a way to do it later.
I followed the getting started docs, but when running
python manage.py init_customers
, I'm getting: