#Marco Túlio Rocha - Invoices
1 messages · Page 1 of 1 (latest)
Hi. Subscriptions generate invoices to collect payment. Could you describe the process you are trying to achieve?
I want to create invoice in signature format, where the customer will receive this invoice by email
I want to create invoice in signature format
I'm not sure what this means but you can create invoices that are emailed to your customers. Both through the Dashboard and via the API.
using the "stripe.subscriptions.create" method?
Okay
- Does the subscription already exist or are you creating that too?
I'm creating this flow, by the api
The diagram on this page does a good job of explaining how the various elements go together to bill a user for a subscription
https://stripe.com/docs/billing/subscriptions/overview
And the details on how invoices work for subscriptions are here: https://stripe.com/docs/billing/invoices/subscription
Is this the final step in your application or are you designing your integration currently?
final step, I have already created the products, customers, prices
Hi there! Stepping in for @obsidian hazel as he needs to step away. Give me a sec to catch up
Great, if you already have your products/customers/prices set up then you would just create the Subscription itself using https://stripe.com/docs/api/subscriptions/create and this will generate the invoice(s) for that Subscription automatically.
I recommend testing this out to see what it is like!
The price specified is set to type=recurring but this field only accepts prices with type=one_time.
Do I change this in the product registration?
Yep you set that when you create the Price
I'm following these steps
1 ) stripe.products.create()
2 ) stripe.prices.create()
3 ) stripe.customers.create()
4 ) stripe.subscriptions.create()
5) ???
Would you have anything else?
That should generate the subscription, yep!
the stripe platform automatically triggers the charge by email to the customer?
I'm not receiving 😢
If you use the send_invoice collection_method (https://stripe.com/docs/api/subscriptions/create#create_subscription-collection_method) for your Subscription then yes Stripe will email your customers a link to pay
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I'm not receiving 😢
This is in testmode, yes?
We only send testmode invoices to the email associated with your account so as not to spam emails. Try setting the email of your customer to the email used to login to your account.
❤️
Yep exacltly
And I'd recommend deleting that message as this is a public server and folks can see that email address
Can you provide me the Subscription ID that you created? It will look like sub_xxxxx
sub_1Kbsb5FlcWt5R0WyvbA0IkRl
Ah okay
The invoice hasn't finalized yet
So it hasn't been sent
The invoice will stay in draft for 1 hour unless you finalize it manually
This is so you can add invoice items to it if you so desire.
after 1h it sends ?
Yes but you can finalize it manually to send it immediately
oks
You can do this in the Dashboard or via https://stripe.com/docs/api/invoices/finalize
the "stripe.subscriptions.create" does not return the id_invoice, how do I?
latest_invoice ??
ok
Sorry, I forgot to mention that when you finalize an invoice we default to auto_advance: false if you don't set it explicitly. This means we won't send it automatically until you are ready. Can you do the same thing but set auto_advance: true in your finalization request?
Did you receive the invoice?
no
Hrmm give me a moment
ok
Ugh apparently I am misremembering and with the finalize endpoint we won't send the invoice immediately. Sorry about that. Can you change your code to use the send invoice endpoint after you create the subscription instead of the finalize endpoint: https://stripe.com/docs/api/invoices/send
My bad 🙂
so it hasn't arrived yet
It will take a moment before it arrives