Create an invoice

    Learn how to create an invoice and bill a customer.

    This guide describes how to create an invoice and collect payment. Invoices provide an itemized list of goods and services rendered, which includes the cost, quantity, and taxes. You can also use them as a tool to collect payment.

    Businesses that aren’t subscription based but still need to send invoices to their customers commonly use one-off invoices. For example, a consulting business might send invoices for the time and resources that each consultation uses.

    The Stripe Dashboard is the most common way to create one-off invoices. You can automate this process if you integrate with the API. Click the tab below for the flow you want to follow.

    1 Create an invoice Dashboard

    To create an invoice in the Stripe Dashboard:

    1. Navigate to the Create an invoice page.
    2. Select + Add new customer and fill out the Name, Account email, and Description fields.
    3. Click Add customer.
    4. Enter an item description and price.
    5. Click Send invoice.
    6. Verify the email address in the Send to field and then click Send invoice again. The address is autofilled using the customer’s email but you can modify it if you want to use a test email address.

    Creating an invoice with the Dashboard.

    This guide describes how to create an invoice and collect payment. Invoices provide an itemized list of goods and services rendered, which includes the cost, quantity, and taxes. You can also use them as a tool to collect payment.

    Businesses that aren’t subscription based but still need to send invoices to their customers commonly use one-off invoices. For example, a consulting business might send invoices for the time and resources that each consultation uses.

    The Stripe Dashboard is the most common way to create one-off invoices. You can automate this process if you integrate with the API. Click the tab below for the flow you want to follow.

    1 Set up Stripe Server-side

    Use our official libraries for access to the Stripe API from your application:

    # Available as a gem sudo gem install stripe
    # If you use bundler, you can add this line to your Gemfile gem 'stripe'
    # Install through pip pip install --upgrade stripe
    # Or find the Stripe package on http://pypi.python.org/pypi/stripe/
    # Install the PHP library via Composer composer require stripe/stripe-php
    # Or download the source directly: https://github.com/stripe/stripe-php/releases
    /* For Gradle, add the following dependency to your build.gradle and replace {VERSION} with the version number you want to use from - https://mvnrepository.com/artifact/com.stripe/stripe-java or - https://github.com/stripe/stripe-java/releases/latest */ implementation "com.stripe:stripe-java:{VERSION}"
    <!-- For Maven, add the following dependency to your POM and replace {VERSION} with the version number you want to use from - https://mvnrepository.com/artifact/com.stripe/stripe-java or - https://github.com/stripe/stripe-java/releases/latest --> <dependency> <groupId>com.stripe</groupId> <artifactId>stripe-java</artifactId> <version>{VERSION}</version> </dependency>
    # For other environments, manually install the following JARs: # - The Stripe JAR from https://github.com/stripe/stripe-java/releases/latest # - Google Gson from https://github.com/google/gson
    # Install via npm npm install --save stripe
    # Install stripe-go go get -u github.com/stripe/stripe-go
    // Then import the package import ( "github.com/stripe/stripe-go/v71" )
    # Install via dotnet dotnet add package Stripe.net dotnet restore
    # Or install via NuGet PM> Install-Package Stripe.net

    2 Create a customer Server-side

    The Customer object represents the customer purchasing your product and is required for creating an invoice.

    curl https://api.stripe.com/v1/customers \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d name="jenny rosen" \ -d email="jenny.rosen@example.com" \ -d description="My First Test Customer (created for API docs)"
    # Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' customer = Stripe::Customer.create({ name: 'jenny rosen', email: 'jenny.rosen@example.com', description: 'My First Test Customer (created for API docs)', })
    # Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' customer = stripe.Customer.create( name='jenny rosen', email='jenny.rosen@example.com', description='My First Test Customer (created for API docs)', )
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $customer = \Stripe\Customer::create([ 'name' => 'jenny rosen', 'email' => 'jenny.rosen@example.com', 'description' => 'My First Test Customer (created for API docs)' ]);
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; Map<String, Object> params = new HashMap<String, Object>(); params.put("name", "jenny rosen"); params.put("email", "jenny.rosen@example.com"); params.put("description", "My First Test Customer (created for API docs)"); Customer.create(params);
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const customer = await stripe.customers.create({ name: 'jenny rosen', email: 'jenny.rosen@example.com', description: 'My First Test Customer (created for API docs)', });
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.CustomerParams{ Name: stripe.String("jenny rosen"), Email: stripe.String("jenny.rosen@example.com"), Description: stripe.String("My First Test Customer (created for API docs)"), } cus, _ := customer.New(params)
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new CustomerCreateOptions { Name = "jenny rosen", Email = "jenny.rosen@example.com", Description = "My First Test Customer (created for API docs)", }; var service = new CustomerService(); service.Create(options);

    This returns a Customer object:

    { "id": "cus_GBV60HKsE0mb5v", "object": "customer", "address": null, "balance": 0, "created": 1590632384, "currency": "usd", "default_source": null, "delinquent": false, "description": "My First Test Customer (created for API docs)",
    See all 46 lines "discount": null, "email": null, "invoice_prefix": "373D533", "invoice_settings": { "custom_fields": null, "default_payment_method": null, "footer": null }, "livemode": false, "metadata": {}, "name": null, "phone": null, "preferred_locales": [], "shipping": null, "sources": { "object": "list", "data": [], "has_more": false, "url": "/v1/customers/cus_GBV60HKsE0mb5v/sources" }, "subscriptions": { "object": "list", "data": [], "has_more": false, "url": "/v1/customers/cus_GBV60HKsE0mb5v/subscriptions" }, "tax_exempt": "none", "tax_ids": { "object": "list", "data": [], "has_more": false, "url": "/v1/customers/cus_GBV60HKsE0mb5v/tax_ids" }, "tax_info": null, "tax_info_verification": null }

    After creating the customer, store the id value in your database so you can use it later. For example, the next step uses the customer ID to create an invoice.

    3 Create the invoice Server-side

    Creating invoices using the API requires a customer and at least one invoice item. When you create the invoice, the invoice items are automatically added.

    # Using the customer ID returned in step 2 curl https://api.stripe.com/v1/invoiceitems \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_4fdAW5ftNQow1a \ -d price=price_CBb6IXqvTLXp3f curl https://api.stripe.com/v1/invoices \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -d customer=cus_4fdAW5ftNQow1a \ -d auto_advance=true
    # Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' Stripe::InvoiceItem.create({ customer: 'cus_4fdAW5ftNQow1a', price: 'price_CBb6IXqvTLXp3f', }) invoice = Stripe::Invoice.create({ customer: 'cus_4fdAW5ftNQow1a', auto_advance: true, # auto-finalize this draft after ~1 hour })
    # Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' stripe.InvoiceItem.create( customer='cus_4fdAW5ftNQow1a', price='price_CBb6IXqvTLXp3f', ) stripe.Invoice.create( customer='cus_4fdAW5ftNQow1a', auto_advance=True # auto-finalize this draft after ~1 hour )
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); \Stripe\InvoiceItem::create([ 'customer' => 'cus_4fdAW5ftNQow1a', 'price' => 'price_CBb6IXqvTLXp3f', ]); \Stripe\Invoice::create([ 'customer' => 'cus_4fdAW5ftNQow1a', 'auto_advance' => true, /* auto-finalize this draft after ~1 hour */ ]);
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; Map<String, Object> invoiceItemParams = new HashMap<String, Object>(); invoiceItemParams.put("customer", "cus_4fdAW5ftNQow1a"); invoiceItemParams.put("price", "price_CBb6IXqvTLXp3f"); InvoiceItem.create(invoiceItemParams); Map<String, Object> invoiceParams = new HashMap<String, Object>(); invoiceParams.put("customer", "cus_4fdAW5ftNQow1a"); invoiceParams.put("auto_advance", true); // auto-finalize this draft after ~1 hour Invoice.create(invoiceParams);
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const invoiceItem = await stripe.invoiceItems.create({ customer: 'cus_4fdAW5ftNQow1a', price: 'price_CBb6IXqvTLXp3f', }); const invoice = await stripe.invoices.create({ customer: 'cus_4fdAW5ftNQow1a', auto_advance: true, // auto-finalize this draft after ~1 hour });
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" params := &stripe.InvoiceItemParams{ Customer: stripe.String("cus_4fdAW5ftNQow1a"), Price: stripe.String("price_CBb6IXqvTLXp3f"), } item, _ := invoiceitem.New(params) invParams := &stripe.InvoiceParams{ Customer: stripe.String("cus_4fdAW5ftNQow1a"), AutoAdvance: stripe.Bool(true), } inv, _ := invoice.New(invParams)
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var options = new InvoiceItemCreateOptions { Customer = "cus_4fdAW5ftNQow1a", Price = "price_CBb6IXqvTLXp3f", }; var service = new InvoiceItemService(); service.Create(options); var invoiceOptions = new InvoiceCreateOptions { Customer = "cus_4fdAW5ftNQow1a", AutoAdvance = true, }; var invoiceService = new InvoiceService(); invoiceService.Create(invoiceOptions);

    To simplify the example, auto_advance is set to true. This means Stripe automatically finalizes the invoice after a few hours, making the invoice ready for payment. In test mode, emails are not sent but you can verify the invoice was created by checking the Invoices section of the Dashboard. The invoice will have a Scheduled status until it’s automatically finalized.

    If you set auto_advance to false, you can continue to modify the invoice until you finalize it. You can finalize a draft invoice using the Dashboard by sending it to the customer or paying it. You can also use the finalize API:

    curl https://api.stripe.com/v1/invoices/:id/finalize \ -u sk_test_4eC39HqLyjWDarjtT1zdp7dc: \ -X POST
    # Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' invoice = Stripe::Invoice.finalize_invoice('in_18jwqyLlRB0eXbMtrUQ97YBw')
    # Set your secret key. Remember to switch to your live secret key in production! # See your keys here: https://dashboard.stripe.com/account/apikeys stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc' invoice = stripe.Invoice.finalize_invoice('in_18jwqyLlRB0eXbMtrUQ97YBw')
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys \Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); $invoice = \Stripe\Invoice::retrieve('in_18jwqyLlRB0eXbMtrUQ97YBw'); $invoice->finalizeInvoice();
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys Stripe.apiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; Invoice invoice = Invoice.retrieve("in_18jwqyLlRB0eXbMtrUQ97YBw"); invoice.finalizeInvoice();
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys const stripe = require('stripe')('sk_test_4eC39HqLyjWDarjtT1zdp7dc'); const invoice = await stripe.invoices.finalizeInvoice('in_18jwqyLlRB0eXbMtrUQ97YBw');
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys stripe.Key = "sk_test_4eC39HqLyjWDarjtT1zdp7dc" inv, _ := invoice.FinalizeInvoice("in_18jwqyLlRB0eXbMtrUQ97YBw", nil)
    // Set your secret key. Remember to switch to your live secret key in production! // See your keys here: https://dashboard.stripe.com/account/apikeys StripeConfiguration.ApiKey = "sk_test_4eC39HqLyjWDarjtT1zdp7dc"; var service = new InvoiceService(); service.FinalizeInvoice("in_18jwqyLlRB0eXbMtrUQ97YBw");

    Optional Changing payment settings

    Collecting payments for one-off invoices is commonly done by sending an email to customers. The emails include a link to a payment page hosted by Stripe where customers can enter their payment details. See the hosted invoice page documentation for a list of supported payment methods. You can also collect payment automatically but that requires collecting payment information from customers.

    When using the API, collection_method is automatically set to charge_automatically. This means Stripe automatically charges the customer’s payment method on file. If the charge fails, Stripe automatically retries the payment.

    Alternatively, you can set collection_method to send_invoice. This sends an email to the customer so they can initiate payment. When you use send_invoice you also have to specify days_until_due or due_date.

    Optional Customizing invoices

    There are several ways to customize invoices. These options allow you to add your own branding and to modify your invoices so that they comply in the jursidictions that you operate it in.

    See also

    Congratulations! You’ve created an invoice on Stripe. Next, you might want to learn more about the invoicing workflow or how to add taxes.

    Was this page helpful?

    Feedback about this page?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.

    On this page