#NotP_Dot - Subscription

1 messages ยท Page 1 of 1 (latest)

tall oasisBOT
toxic gazelle
karmic light
#

yes - req_U3IMBUqmZkJEv7

#

This is also how I am creating the user:
try:
customer = stripe.Customer.create(
description="Customer Created Via Marketplace API",
email=email
)
print("Created customer", customer)
if(customer and 'id' in customer):
return customer['id']
else:
print("Error, Customer was not created with the email", email)
return ""
except Exception as e:
return str(e)

toxic gazelle
#

Please consider adding a default payment method
This is what your code needs to do

#

You can create a Customer with a default payment method in your create function call using the Test tokens we provide

karmic light
#

I am a bit confused, when creating the customer I need to specify their payment method?

toxic gazelle
#

You would just specify one of these as the payment_method parameter

#

If you expect them to be able to pay for anything

karmic light
#

for example setting tok_visa when creating the customer for their payment method would be fine, even if they pay with something besides visa?

#

and it seems like payment_method is optional

toxic gazelle
#

Yes it's optional. But then you will get errors when you attempt to automate payments with that customer, unless you specify a payment method when creating the Subscription.

#

I don't think it's clear what you are trying to achieve with your scripts. Could you explain what the overall goal is?

karmic light
#

Overall goal is to create a subscription that also takes a one time payment for the first month.
In order to achieve this I need to use stripe.Subscription.create and add on add_invoice_items

In order to use stripe.Subscription.create I need to first create a customer, which I am doing using stripe.Customer.create.

When the customer is created I then pass the customerID to stripe.Subscription.create but received the error that I brought up earlier regarding payment method

#

if you believe there is a better way to achieve this please do provide suggestions

toxic gazelle
#

Try adding payment_behavior='default_incomplete' to your Subscription create funtion

#

NotP_Dot - Subscription

karmic light
#

I think that kinda fixed the error. I'll play around more with it thanks for the help

toxic gazelle
karmic light
#

Thank you for your help

toxic gazelle
#

Happy to do it ๐Ÿ™‚

karmic light
#

one quick question

#

if you're using stripe.checkout.Session.create and passing mode="subscription" can you somehow pass a one time payment along with this session?

toxic gazelle
#

No. Right now its either/or