#+998941673401-subscription
1 messages · Page 1 of 1 (latest)
can you share with me the code?
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}
please help
Hi, you will need to pay the first invoice, see https://stripe.com/docs/billing/subscriptions/overview#subscription-lifecycle
@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?
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?
Specifically: https://stripe.com/docs/billing/subscriptions/build-subscription?ui=elements#collect-payment
no, I develop API for mobile app using python,
How are you collecting payment information from your customers?
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
You still need to use Stripe.js to complete the initial subscription payment (essentially activating the subscription): https://stripe.com/docs/billing/subscriptions/build-subscription?ui=elements#complete-payment
This is why you have status: 'incomplete' right now: https://stripe.com/docs/billing/subscriptions/overview#default-incomplete