#WhySoAsync-subscriptions
1 messages · Page 1 of 1 (latest)
Hello!
- If add an additional level nesting to your
expandparameter it should work:xpand: ['latest_invoice.payment_intent.payment_method']
- Are you aware that we offer retry logic? https://stripe.com/docs/invoicing/automatic-collection#retry-schedule
const activeSubscriptions = await stripe.subscriptions.list({
customer: customerDetails.data[0].id,
expand: ['latest_invoice.payment_intent.payment_method']
});
But generally, you'd use a test card that will decline: https://stripe.com/docs/testing#cards-responses
i get 404
rawType: "invalid_request_error"
requestId: "req_rME7xs96ojI2iu"
statusCode: 400
type: "StripeInvalidRequestError"
status: "error"
yea it works, i was trying to find the payments methods , the last 4 digits and stuff like that
but i can't find them
i don't want to make a GET call to payment methods and mutate the subscription array
i was courious if i could get them by subscription object
and then add/edit/delete payment methods
by subscription
Then you should have the full Payment Method object (which has that data, check the card hash): https://stripe.com/docs/api/payment_methods/object#payment_method_object-card
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you share the ID of that Invoice?
My guess it it was a zero amount
i.e. trial, discount (no payment needed)
in_1KZ0hPDmVlmqORBIAbQtnr1U
ah.. i think i tried to force try last night
to expire
lemme create the subscription again one sec
Yeah, $0. No there's no Payment Intent on the initial invoice
Yeah payment intent is coming now
one more question
can i add more payment intents to the subscription?
it will be array instead of object or?
There's no direct relationship between a Subscription and Payment Intents
They're facilitated through Invoices
There's a new Invoice generated for each billing cycle, and the Payment Intent facilitates payment for that invoice if required
Ah.. so i need to add payment methods to customer if i want to add multiple cards right?
This is a good doc that explains how subscriptions work: https://stripe.com/docs/billing/subscriptions/overview
How can i have 2 different subscriptions and each subscription to have multiple cards
Yes, you'd save them via a Setup Intent
Is that possible?
But if i keep only one card per subscription
If i show him the last 4 digits and card type on that subscription and he would have the ability to remove card then i can update subscription on cancel_on_period end until he adds another card?
And when he adds another card i can activate it again and it will be invoiced the same as it was before
Can i do this from payment methods API only?
Generally you'd create a new pm_xxx object via a Setup Intent and then set the default_payment_method field on the Subscription
Oh okay.
Please tell me if this flow is good.
- User buys subscription, i show him the payment_method and last 4 digits from subscriptions.list({})
- User deletes his payment_method, i will update the subscription to cancel on period end true, he will not be invoiced anymore.
- If he adds another card, i create the payment method through setup intent, get the payment method and update subscription with that payment method while adding cancel on period end false
You can't 'delete' a payment method, FYI. The outcome is still the same but it can only be 'detached' (then its not reusable)
Looks good to me! Obviously is it cancels before they add a new card the subscription will have cancelled
i need to send payment_method to setup intent
i need to use PaymentCard from react stripe
how do i collect data from frontend with new card?
I sent you the link. You'd use Stripe.js/Elements: https://stripe.com/docs/payments/save-and-reuse
Thank you !
Sure, np!