CreateInvoice

Struct CreateInvoice 

Source
pub struct CreateInvoice { /* private fields */ }
Expand description

This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you finalize the invoice, which allows you to pay or send the invoice to your customers.

Implementations§

Source§

impl CreateInvoice

Source

pub fn new() -> Self

Construct a new CreateInvoice.

Source

pub fn account_tax_ids(self, account_tax_ids: impl Into<Vec<String>>) -> Self

The account tax IDs associated with the invoice. Only editable when the invoice is a draft.

Source

pub fn application_fee_amount( self, application_fee_amount: impl Into<i64>, ) -> Self

A fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner’s Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees documentation.

Source

pub fn auto_advance(self, auto_advance: impl Into<bool>) -> Self

Controls whether Stripe performs automatic collection of the invoice. If false, the invoice’s state doesn’t automatically advance without an explicit action. Defaults to false.

Source

pub fn automatic_tax( self, automatic_tax: impl Into<CreateInvoiceAutomaticTax>, ) -> Self

Settings for automatic tax lookup for this invoice.

Source

pub fn automatically_finalizes_at( self, automatically_finalizes_at: impl Into<Timestamp>, ) -> Self

The time when this invoice should be scheduled to finalize (up to 5 years in the future). The invoice is finalized at this time if it’s still in draft state.

Source

pub fn collection_method( self, collection_method: impl Into<InvoiceCollectionMethod>, ) -> Self

Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. Defaults to charge_automatically.

Source

pub fn currency(self, currency: impl Into<Currency>) -> Self

The currency to create this invoice in. Defaults to that of customer if not specified.

Source

pub fn custom_fields( self, custom_fields: impl Into<Vec<CustomFieldParams>>, ) -> Self

A list of up to 4 custom fields to be displayed on the invoice.

Source

pub fn customer(self, customer: impl Into<String>) -> Self

The ID of the customer who will be billed.

Source

pub fn days_until_due(self, days_until_due: impl Into<u32>) -> Self

The number of days from when the invoice is created until it is due. Valid only for invoices where collection_method=send_invoice.

Source

pub fn default_payment_method( self, default_payment_method: impl Into<String>, ) -> Self

ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription’s default payment method, if any, or to the default payment method in the customer’s invoice settings.

Source

pub fn default_source(self, default_source: impl Into<String>) -> Self

ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription’s default source, if any, or to the customer’s default source.

Source

pub fn default_tax_rates( self, default_tax_rates: impl Into<Vec<String>>, ) -> Self

The tax rates that will apply to any line item that does not have tax_rates set.

Source

pub fn description(self, description: impl Into<String>) -> Self

An arbitrary string attached to the object. Often useful for displaying to users. Referenced as ‘memo’ in the Dashboard.

Source

pub fn discounts(self, discounts: impl Into<Vec<DiscountsDataParam>>) -> Self

The coupons and promotion codes to redeem into discounts for the invoice. If not specified, inherits the discount from the invoice’s customer. Pass an empty string to avoid inheriting any discounts.

Source

pub fn due_date(self, due_date: impl Into<Timestamp>) -> Self

The date on which payment for this invoice is due. Valid only for invoices where collection_method=send_invoice.

Source

pub fn effective_at(self, effective_at: impl Into<Timestamp>) -> Self

The date when this invoice is in effect. Same as finalized_at unless overwritten. When defined, this value replaces the system-generated ‘Date of issue’ printed on the invoice PDF and receipt.

Source

pub fn expand(self, expand: impl Into<Vec<String>>) -> Self

Specifies which fields in the response should be expanded.

Source

pub fn footer(self, footer: impl Into<String>) -> Self

Footer to be displayed on the invoice.

Source

pub fn from_invoice( self, from_invoice: impl Into<CreateInvoiceFromInvoice>, ) -> Self

Revise an existing invoice. The new invoice will be created in status=draft. See the revision documentation for more details.

Source

pub fn issuer(self, issuer: impl Into<CreateInvoiceIssuer>) -> Self

The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.

Source

pub fn metadata(self, metadata: impl Into<HashMap<String, String>>) -> Self

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.

Source

pub fn number(self, number: impl Into<String>) -> Self

Set the number for this invoice. If no number is present then a number will be assigned automatically when the invoice is finalized. In many markets, regulations require invoices to be unique, sequential and / or gapless. You are responsible for ensuring this is true across all your different invoicing systems in the event that you edit the invoice number using our API. If you use only Stripe for your invoices and do not change invoice numbers, Stripe handles this aspect of compliance for you automatically.

Source

pub fn on_behalf_of(self, on_behalf_of: impl Into<String>) -> Self

The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the Invoices with Connect documentation for details.

Source

pub fn payment_settings( self, payment_settings: impl Into<CreateInvoicePaymentSettings>, ) -> Self

Configuration settings for the PaymentIntent that is generated when the invoice is finalized.

Source

pub fn pending_invoice_items_behavior( self, pending_invoice_items_behavior: impl Into<CreateInvoicePendingInvoiceItemsBehavior>, ) -> Self

How to handle pending invoice items on invoice creation. Defaults to exclude if the parameter is omitted.

Source

pub fn rendering(self, rendering: impl Into<CreateInvoiceRendering>) -> Self

The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.

Source

pub fn shipping_cost( self, shipping_cost: impl Into<CreateInvoiceShippingCost>, ) -> Self

Settings for the cost of shipping for this invoice.

Source

pub fn shipping_details( self, shipping_details: impl Into<RecipientShippingWithOptionalFieldsAddress>, ) -> Self

Shipping details for the invoice. The Invoice PDF will use the shipping_details value if it is set, otherwise the PDF will render the shipping address from the customer.

Source

pub fn statement_descriptor( self, statement_descriptor: impl Into<String>, ) -> Self

Extra information about a charge for the customer’s credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default statement_descriptor will be set to the first subscription item’s product’s statement_descriptor.

Source

pub fn subscription(self, subscription: impl Into<String>) -> Self

The ID of the subscription to invoice, if any. If set, the created invoice will only include pending invoice items for that subscription. The subscription’s billing cycle and regular subscription events won’t be affected.

Source

pub fn transfer_data(self, transfer_data: impl Into<TransferDataSpecs>) -> Self

If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice’s charge.

Source§

impl CreateInvoice

Source

pub async fn send<C: StripeClient>( &self, client: &C, ) -> Result<<Self as StripeRequest>::Output, C::Err>

Send the request and return the deserialized response.

Source

pub fn send_blocking<C: StripeBlockingClient>( &self, client: &C, ) -> Result<<Self as StripeRequest>::Output, C::Err>

Send the request and return the deserialized response, blocking until completion.

Trait Implementations§

Source§

impl Clone for CreateInvoice

Source§

fn clone(&self) -> CreateInvoice

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreateInvoice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CreateInvoice

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Serialize for CreateInvoice

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StripeRequest for CreateInvoice

Source§

type Output = Invoice

The data returned from the eventual API call.
Source§

fn build(&self) -> RequestBuilder

Convert the struct into library-agnostic data that can be used by compatible clients to make API calls.
Source§

fn customize(&self) -> CustomizableStripeRequest<Self::Output>

Convert to a builder allowing per-request customization.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more