#Reyansh Sharma
1 messages ยท Page 1 of 1 (latest)
hi, you could look into https://stripe.com/docs/terminal/features/saving-cards/overview to see the options for how to save a card with the Terminal, and then that card can be set as the default for a customer's subscription.
Thanks also the way I am setting up the subscription is as follows (I was talking to someone about this in the past):
- Creating the subscription with payment_behavior: 'default_incomplete' (Don't have the payment method etc while creating the payment.
- Send the client secret of the first invoice created for the subscription to TerminalJS.
- Using terminal.[collectPaymentMethod] & sending the intentId to server-side API where I need to [Capture] the payment if not already.
does that work?
I wouldn't expect it to, since the PaymentIntent from the Subscription Invoice doesn't have card_present as a payment_method_type but maybe you are manually setting it
Nope because there is no payment method attached to the customer
you don't need a payment method attached to the customer when creating the subscription unless you're doing something wrong. What's the specific error message and request ID req_xxx ?
Let me check what I can get from the response
@dire barn SubscriptionIds created will work?
sure
Thanks so two different scenarios:
Subscription added for a customer already exists on stripe: Subscription ID--> sub_1M7zDFIXPl35VUO685O89H8d
Payment intent status is requires_confirmation
In the second scenario: If the customer is not already available on stripe (We created a new customer) like for subscription [sub_1M7zIIIXPl35VUO60ro2dmTo] got the status payment_method_reqired
ok well let's do one at a time
sub_1M7zDFIXPl35VUO685O89H8d cool, so you created that. So the next step is
- Send the client secret of the first invoice created for the subscription to TerminalJS.
- Using terminal.[collectPaymentMethod]
and also, you need to process the payment
you seem to have skipped that part in your explanation above
Yes & sorry for that
i.e. needing to do await terminal.processPayment(paymentIntent);
again, I have no idea if this will work or if it's meant to work, we don't document this as being possible(using Terminal to start a subscription) I think
but anyway, if you try it, what happens?
So after sending the subscription invoice --> PaymentIntent --> clientSecret calling [collectPaymentMethod] & getting the paymentintent object back.
I don't know what ' & getting the paymentintent object back.' refers to
to be clear, you can't just use collectPaymentMethod to get a card and send it your backend server and use it there, that's not what it's for
๐
it's a step as part of processing a payment with the reader, you always call terminal.processPayment after calling collectPaymentMethod
Thanks, Yes using the same for one-time payment where we don't need subs.
I was having some issues while doing that earlier so removed the step I believe. Checking that now.
it wil probably fail because the PaymentIntent doesn't have card_present in the payment_method_types
and it looks like you can't change that, so there doesn't seem to be a way to have that work, you can't pay the invoice from the subscription using Terminal.
Yes I believe that was what happening.
Yes I was getting that exception ๐ฆ
so you could maybe do a one-off Terminal PaymentIntent, and then when that succeeds, you create a subscription, with a trial period to skip the first payment, as kind of a hack
Haha yes that was the alternate I was thinking of
you'd also need to make sure the generated_card thingy is saved to the customer properly so future payments work
The only problem was when someone will check the subscription it will be one invoice short.
So was not going that way. Anyway, though this seems to be the only workaround so might have to do that.
Thanks for all the help. Going to do that now.
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
No that's all for now. Thanks again