pub struct CreatePaymentLink<'a> {
Show 21 fields pub after_completion: Option<CreatePaymentLinkAfterCompletion>, pub allow_promotion_codes: Option<bool>, pub application_fee_amount: Option<i64>, pub application_fee_percent: Option<f64>, pub automatic_tax: Option<CreatePaymentLinkAutomaticTax>, pub billing_address_collection: Option<PaymentLinkBillingAddressCollection>, pub consent_collection: Option<CreatePaymentLinkConsentCollection>, pub customer_creation: Option<PaymentLinkCustomerCreation>, pub expand: &'a [&'a str], pub line_items: Vec<CreatePaymentLinkLineItems>, pub metadata: Option<Metadata>, pub on_behalf_of: Option<&'a str>, pub payment_intent_data: Option<CreatePaymentLinkPaymentIntentData>, pub payment_method_types: Option<Vec<CreatePaymentLinkPaymentMethodTypes>>, pub phone_number_collection: Option<CreatePaymentLinkPhoneNumberCollection>, pub shipping_address_collection: Option<CreatePaymentLinkShippingAddressCollection>, pub shipping_options: Option<Vec<CreatePaymentLinkShippingOptions>>, pub submit_type: Option<PaymentLinkSubmitType>, pub subscription_data: Option<CreatePaymentLinkSubscriptionData>, pub tax_id_collection: Option<CreatePaymentLinkTaxIdCollection>, pub transfer_data: Option<CreatePaymentLinkTransferData>,
}
Expand description

The parameters for PaymentLink::create.

Fields

after_completion: Option<CreatePaymentLinkAfterCompletion>

Behavior after the purchase is complete.

allow_promotion_codes: Option<bool>

Enables user redeemable promotion codes.

application_fee_amount: Option<i64>

The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account.

Can only be applied when there are no line items with recurring prices.

application_fee_percent: Option<f64>

A non-negative decimal between 0 and 100, with at most two decimal places.

This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner’s Stripe account. There must be at least 1 line item with a recurring price to use this field.

automatic_tax: Option<CreatePaymentLinkAutomaticTax>

Configuration for automatic tax collection.

billing_address_collection: Option<PaymentLinkBillingAddressCollection>

Configuration for collecting the customer’s billing address.

consent_collection: Option<CreatePaymentLinkConsentCollection>

Configure fields to gather active consent from customers.

customer_creation: Option<PaymentLinkCustomerCreation>

Configures whether checkout sessions created by this payment link create a Customer.

expand: &'a [&'a str]

Specifies which fields in the response should be expanded.

line_items: Vec<CreatePaymentLinkLineItems>

The line items representing what is being sold.

Each line item represents an item being sold. Up to 20 line items are supported.

metadata: Option<Metadata>

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. Metadata associated with this Payment Link will automatically be copied to checkout sessions created by this payment link.

on_behalf_of: Option<&'a str>

The account on behalf of which to charge.

payment_intent_data: Option<CreatePaymentLinkPaymentIntentData>

A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in payment mode.

payment_method_types: Option<Vec<CreatePaymentLinkPaymentMethodTypes>>

The list of payment method types that customers can use.

Only card is supported. If no value is passed, Stripe will dynamically show relevant payment methods from your payment method settings (20+ payment methods supported).

phone_number_collection: Option<CreatePaymentLinkPhoneNumberCollection>

Controls phone number collection settings during checkout.

We recommend that you review your privacy policy and check with your legal contacts.

shipping_address_collection: Option<CreatePaymentLinkShippingAddressCollection>

Configuration for collecting the customer’s shipping address.

shipping_options: Option<Vec<CreatePaymentLinkShippingOptions>>

The shipping rate options to apply to checkout sessions created by this payment link.

submit_type: Option<PaymentLinkSubmitType>

Describes the type of transaction being performed in order to customize relevant text on the page, such as the submit button.

subscription_data: Option<CreatePaymentLinkSubscriptionData>

When creating a subscription, the specified configuration data will be used.

There must be at least one line item with a recurring price to use subscription_data.

tax_id_collection: Option<CreatePaymentLinkTaxIdCollection>

Controls tax ID collection during checkout.

transfer_data: Option<CreatePaymentLinkTransferData>

The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.

Implementations

Examples found in repository?
examples/payment-link.rs (lines 48-52)
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
async fn main() {
    let secret_key = std::env::var("STRIPE_SECRET_KEY").expect("Missing STRIPE_SECRET_KEY in env");
    let client = Client::new(secret_key);

    // create a new example project
    let product = {
        let mut create_product = CreateProduct::new("T-Shirt");
        create_product.metadata =
            Some([("async-stripe".to_string(), "true".to_string())].iter().cloned().collect());
        Product::create(&client, create_product).await.unwrap()
    };

    // and add a price for it in USD
    let price = {
        let mut create_price = CreatePrice::new(Currency::USD);
        create_price.product = Some(IdOrCreate::Id(&product.id));
        create_price.metadata =
            Some([("async-stripe".to_string(), "true".to_string())].iter().cloned().collect());
        create_price.unit_amount = Some(1000);
        create_price.expand = &["product"];
        Price::create(&client, create_price).await.unwrap()
    };

    println!(
        "created a product {:?} at price {} {}",
        product.name.unwrap(),
        price.unit_amount.unwrap() / 100,
        price.currency.unwrap()
    );

    let payment_link = PaymentLink::create(
        &client,
        CreatePaymentLink::new(vec![CreatePaymentLinkLineItems {
            quantity: 3,
            price: price.id.to_string(),
            ..Default::default()
        }]),
    )
    .await
    .unwrap();

    println!("created a payment link {}", payment_link.url);
}

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

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

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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