Struct stripe::CreatePaymentLink
source · [−]pub struct CreatePaymentLink<'a> {Show 15 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 expand: &'a [&'a str],
pub line_items: Vec<CreatePaymentLinkLineItems>,
pub metadata: Option<Metadata>,
pub on_behalf_of: Option<&'a str>,
pub payment_method_types: Option<Vec<CreatePaymentLinkPaymentMethodTypes>>,
pub phone_number_collection: Option<CreatePaymentLinkPhoneNumberCollection>,
pub shipping_address_collection: Option<CreatePaymentLinkShippingAddressCollection>,
pub subscription_data: Option<CreatePaymentLinkSubscriptionData>,
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.
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_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.
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
.
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
sourceimpl<'a> CreatePaymentLink<'a>
impl<'a> CreatePaymentLink<'a>
sourcepub fn new(line_items: Vec<CreatePaymentLinkLineItems>) -> Self
pub fn new(line_items: Vec<CreatePaymentLinkLineItems>) -> Self
Examples found in repository?
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
sourceimpl<'a> Clone for CreatePaymentLink<'a>
impl<'a> Clone for CreatePaymentLink<'a>
sourcefn clone(&self) -> CreatePaymentLink<'a>
fn clone(&self) -> CreatePaymentLink<'a>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<'a> Debug for CreatePaymentLink<'a>
impl<'a> Debug for CreatePaymentLink<'a>
sourceimpl<'a> Serialize for CreatePaymentLink<'a>
impl<'a> Serialize for CreatePaymentLink<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for CreatePaymentLink<'a>
impl<'a> Send for CreatePaymentLink<'a>
impl<'a> Sync for CreatePaymentLink<'a>
impl<'a> Unpin for CreatePaymentLink<'a>
impl<'a> UnwindSafe for CreatePaymentLink<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more