#baruco-usage-subs
1 messages · Page 1 of 1 (latest)
Hi there! If you are using metered usage then the first invoice will always be $0 as the customer is charged based on the usage over the period.
So yes, what you are describing is expected for metered.
For licensed usage you specify the quantity when you create the Sub so the initial invoice will not be $0
We talk about the differences here: https://stripe.com/docs/products-prices/pricing-models#usage-based-pricing
Hi @steep axle and thank you! I understand now.
What about the returned status? I get a pending_setup_intent="requires_payment_method" when I run my tests and in the example I followed it doesn't look like anything needs to be done after this...
https://github.com/stripe-samples/subscription-use-cases/tree/master/usage-based-subscriptions
In here they lookup requires_action instead.
Also, they lookup subscription.latest_invoice.payment_intent to check the payment status but it's always null for me...
So when you use metered usage then you use the pending_setup_intent to collect a payment method for renewal charges.
So you grab the client_secret from the pending_setup_intent and pass that to your client
Got it.
What about the requires_payment_method status that's returned in the pending_setup_intent?
Yes that is because you haven't used that SetupIntent to collect a Payment Method yet.
As in.... you haven't confirmed it client-side yet.
OK, so I need the frontend to take that and pass it to the stripe.confirmCardSetup and that's it?
Yep that's right
I assume this doesn't matter if the payment method is for a 3DS card or not
As in, a card that requires 3DS authorization
Sorry, channel got busy.
Using confirmCardSetup will handle 3DS if it is necessary.
And then the card will be set up to be used off session in the future.
Though it is worth noting that a bank can request 3DS any time they want... even if the card was set up previously, so you should always be prepared to bring your customer back on-session to complete 3DS for a payment if necessary.
Np, and thank you.
In such a case the bank requires 3DS, will I be aware of that through a webhook or something?
On a different note, I'm writing tests for my backend which is written in GO.
Can I do a "confirm card setup" through the Go SDK? including 3DS perhaps? Is that possible?
I'm just wondering whether I should consider a test flow ending with requires_payment_method as a success or there could be more to it...
You'll want to listen for setup_intent.requires_action and payment_intent.requires_action Events for bringing your customer back to auth 3DS
Can I do a "confirm card setup" through the Go SDK? including 3DS perhaps? Is that possible?
We have docs on Go for most API requests. Can you be more specific?
I'd prefer to have an E2E test without including the frontend section which is written in JS.
I am able to create a paymentmethod with the 4242 4242.... card or any other card, send the payment method ID to the function, make sure it's working and get a subscription in the response.
The subscription holds a pending_setup_intent entry with the client_secret which as I understand it in a production environment and a real user flow I would use it to confirm the card with Stripe Elements on the client side (JS).
However, in my testing environment I'd like to do the same thing, but through Go, not JS.
So I want to know if it's possible and how to do so if it is.
That's possible I think. Without a list of all the exact calls you are making I can't say with certainty though. I would recommend checking through the API reference and selecting Go from the languages to see if everything you're trying to do can be done.
I think it can be, so long as you're not doing anything client-side, but again: I'm not sure without knowing every function call that you make currently.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So just to more clear, I have a product and a single price with "metered - graduated" pricing.
The test goes like this:
I create a payment method and keep the id
I create a customer with customers.new and give the payment method parameter the payment method id create earlier
I create a a subscription for the product I have and the customer I just created
I return the subscription object that was created.
From here, I have the pending_setup_intent entry in the subscription with a status of requires_payment_method, and I'd like to do whatever I need to do on the go client side to make sure the status changes to succeeded and that's what I'm missing.
Everything you described seems possible with GO. There's no GO client library on the Stripe side, though. It's all server-side. Anything done on the client-side has to be done on your own or in addition to stripe.js as far as I can tell
OK, I saw a possibility to run setpuintents.Confirm() from the GO library, do you think that's enough?