#Marco Túlio Rocha - Invoices

1 messages · Page 1 of 1 (latest)

obsidian hazel
#

Hi. Subscriptions generate invoices to collect payment. Could you describe the process you are trying to achieve?

random fractal
#

I want to create invoice in signature format, where the customer will receive this invoice by email

obsidian hazel
#

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.

random fractal
#

using the "stripe.subscriptions.create" method?

obsidian hazel
#

Okay

  1. Does the subscription already exist or are you creating that too?
random fractal
#

I'm creating this flow, by the api

obsidian hazel
#

Is this the final step in your application or are you designing your integration currently?

random fractal
#

final step, I have already created the products, customers, prices

ember mortar
#

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!

random fractal
#

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?

ember mortar
#

Yep you set that when you create the Price

random fractal
#

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?

ember mortar
#

That should generate the subscription, yep!

random fractal
#

the stripe platform automatically triggers the charge by email to the customer?

#

I'm not receiving 😢

ember mortar
random fractal
#

I'm not receiving 😢

ember mortar
#

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.

random fractal
#

hummm, ok

#

thks

#

you are the best support in the world

#

👑

ember mortar
#

❤️

#

Yep exacltly

#

And I'd recommend deleting that message as this is a public server and folks can see that email address

random fractal
#

ok

#

I'm not receiving 😢

ember mortar
#

Can you provide me the Subscription ID that you created? It will look like sub_xxxxx

random fractal
#

sub_1Kbsb5FlcWt5R0WyvbA0IkRl

ember mortar
#

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.

random fractal
#

after 1h it sends ?

ember mortar
#

Yes but you can finalize it manually to send it immediately

random fractal
#

oks

ember mortar
random fractal
#

the "stripe.subscriptions.create" does not return the id_invoice, how do I?

#

latest_invoice ??

ember mortar
#

It will be in the latest_invoice

#

yep

random fractal
#

ok

ember mortar
#

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?

random fractal
#

function return

#

any other steps?

#

sub_1KbszFFlcWt5R0WyXoW7nzyS

ember mortar
#

Did you receive the invoice?

random fractal
#

no

ember mortar
#

Hrmm give me a moment

random fractal
#

ok

ember mortar
#

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 🙂

random fractal
#

ok

#

Can I remove the "finalizeInvoice"

#

?

ember mortar
#

Yep

#

When you send it should finalize it as well if I remember correctly

random fractal
#

so it hasn't arrived yet

ember mortar
#

It will take a moment before it arrives