#+998941673401-subscription

1 messages · Page 1 of 1 (latest)

dreamy ruin
#

Hi there, are you using the pending_setup_intent of the subscription?

blissful knoll
#

no

#

I use stripe package for python,

#

There Subscription class, I create it

dreamy ruin
#

can you share with me the code?

blissful knoll
#

yeah,

#

'subs = create_subscription(stripe_customer_id='cus_Kj6ekA2fDTDiBr',
stripe_price_id='price_1K4NTtJ3sIBGsWShQPyu2yQi',
default_source='card_1K3f6dJ3sIBGsWShEqzjo8wc'
)

#

def create_subscription(stripe_customer_id: str, stripe_price_id: str, default_source):
try:
return stripe.Subscription.create(
customer=stripe_customer_id,
default_source=default_source,
items=[
{"price": stripe_price_id},
],
)
except InvalidRequestError as err:
return {'error_message': err.user_message}

blissful knoll
dreamy ruin
blissful knoll
#

@dreamy ruin do I need to get the invoice id from the incomplete subsctiption object and pay the amount by myself as a developer right?

south tangle
#

Hey! Taking over from @dreamy ruin - let me catch-up!

#

Do you have some front-end (JavaScript) code where you call Stripe.js to confirm the initial subscription payment?

blissful knoll
#

no, I develop API for mobile app using python,

south tangle
#

How are you collecting payment information from your customers?

blissful knoll
#

he provides card info and I get token for this card from stripe and I add this token to customer

#

and this card becomes customers

south tangle