#Munaim-Subscription
1 messages · Page 1 of 1 (latest)
The question is why subscription has incomplete status?
Why stripe did not deduct payment?
The subscription is over due because the payment is incomplete. You can click on the payment to find out more details
Event log says
can you send me the subscription ID so I can take a look?
But I have saved payment method on stripe hosted page during session creation using
'payment_intent_data' => [
'setup_future_usage' => 'off_session'
],
Subscription ID:
sub_1KLyz3Lz6HCfXzm2FSNcltid
OK, so this subscription doesn't have a default_payment_method, and the customer doesn't have a invoice_settings.default_payment_method either, that's thy the payment is failed.
You shall attach either one default_payment_method then it should work.
I need to attach both parameters?
Either one will do. you can learn more about it here https://stripe.com/docs/api/subscriptions/object#subscription_object-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok Thanks i will look into it
I need your help I am using stripe checkout prebuilt page
for payment deduction
how can I save default method parameter during that?
Did you pass the setup_future_usage param when creating the checkout session? https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes I have used this parameter in checkout session
payment method of that is already saved
@spring lantern Please check and then let me know
Hi @rancid zodiac please give me a few mins, I'm still working on it
ok sure
Did you use subscription schedule to create sub_1KLyz3Lz6HCfXzm2FSNcltid?
Yes I have created schedule subscription first then stripe has converted this into above subscription id
How did you create the subscriptions schedule, can you show me the code?
OK, when you create the schedule, did the customer has a default payment method in its invoice_settings?
First my customer has paid through stripe checkout prebuilt page and it saved my customer payment method. After that I have run above code for that particular customer. My customer is created on stripe end because I am using prebuilt page
My customer is created during stripe checkout session using prebuilt page
What intent did you pass to the Checkout API for your customer to make the first payment? is it pending_setup_intent or latest_invoice.payment_inetent ?
Here is my checkout session code
You are creating a checkout session for a new subscription here.
Not for the subscription created by your subscription schedule.
I am creating session for one time payment or subscription both based on condition
for one time payment my payment mode is ''payment' and for other subscription my payment mode is ''subscription''
Hmm, sorry I'm not following, I thought we were discussiong the subcription triggered by the schedule?
If my customer pays one time payment using checkout page then against that customer i am creating schedule subscription through cron job
and during checkout i have saved the customer payment method
saved the customer payment method -> Do you save it to the invoice_settings.default_payment_method ?
I want when my customer pays me one time through checkout page then i have to create schedule subscription for that particular customer which stripe has saved during checkout session . After that schedule subscription
converted to subscription automatically when time started.
Above is my scenario
Customer is created during checkout session how Can I save invoice_settings.default_payment_method during that checkout session ?
Hope you understand now
When stripe converts schedule subscription to subscription then stripe didn't deduct payment. This is my problem
OK I think I know your problem. Here is my suggestion
Upon the checkout session completion, the payment_method is attached to the customer and the subscription. However it's not set as the invoice_settings.default_payment_method for the customer and that's why you have the payment incomplete problem in the new subscription triggered by the schedule.
You can listen to the checkout.session.completed event and manually update the customer's invoice_settings.default_payment_method to the checkout_session.payment_intent.payment_method
I am not listening checkout.session.completed event
Please tell I need to update both parameters
invoice_settings.default_payment_method
checkout_session.payment_intent.payment_method
I am just creating a session or retrieving a session then saved info of response on my end
I think I can update customer manually I want to know that i need to update following both parameters
invoice_settings.default_payment_method
checkout_session.payment_intent.payment_method
@spring lantern Take your time and then please let me know about suggestion
Hi @rancid zodiac thanks for the waiting. sorry I wasn't very clear in my answer.
After registering your Webhook endpoint to checkout.session.completed, your server will get notified when a checkout session is completed.
In the webhook event handling, you shall
- call the Checkout Checkout Retrieve API https://stripe.com/docs/api/checkout/sessions/retrieve with payment_intent hash expanded
- call the Customer Update API, https://stripe.com/docs/api/customers/update and use the the payment_method ID from the expanded payment_intent that you obtained from the previous API call to update invoice_settings.default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.