Struct stripe::PaymentLink
source · [−]pub struct PaymentLink {Show 24 fields
pub id: PaymentLinkId,
pub active: bool,
pub after_completion: PaymentLinksResourceAfterCompletion,
pub allow_promotion_codes: bool,
pub application_fee_amount: Option<i64>,
pub application_fee_percent: Option<f64>,
pub automatic_tax: PaymentLinksResourceAutomaticTax,
pub billing_address_collection: PaymentLinkBillingAddressCollection,
pub consent_collection: Option<PaymentLinksResourceConsentCollection>,
pub customer_creation: PaymentLinkCustomerCreation,
pub line_items: List<CheckoutSessionItem>,
pub livemode: bool,
pub metadata: Metadata,
pub on_behalf_of: Option<Expandable<Account>>,
pub payment_intent_data: Option<PaymentLinksResourcePaymentIntentData>,
pub payment_method_types: Option<Vec<PaymentLinkPaymentMethodTypes>>,
pub phone_number_collection: PaymentLinksResourcePhoneNumberCollection,
pub shipping_address_collection: Option<PaymentLinksResourceShippingAddressCollection>,
pub shipping_options: Vec<PaymentLinksResourceShippingOption>,
pub submit_type: PaymentLinkSubmitType,
pub subscription_data: Option<PaymentLinksResourceSubscriptionData>,
pub tax_id_collection: PaymentLinksResourceTaxIdCollection,
pub transfer_data: Option<PaymentLinksResourceTransferData>,
pub url: String,
}
Expand description
The resource representing a Stripe “PaymentLink”.
For more details see https://stripe.com/docs/api/payment_links/object
Fields
id: PaymentLinkId
Unique identifier for the object.
active: bool
Whether the payment link’s url
is active.
If false
, customers visiting the URL will be shown a page saying that the link has been deactivated.
after_completion: PaymentLinksResourceAfterCompletion
allow_promotion_codes: bool
Whether user redeemable promotion codes are enabled.
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.
application_fee_percent: Option<f64>
This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner’s Stripe account.
automatic_tax: PaymentLinksResourceAutomaticTax
billing_address_collection: PaymentLinkBillingAddressCollection
Configuration for collecting the customer’s billing address.
consent_collection: Option<PaymentLinksResourceConsentCollection>
When set, provides configuration to gather active consent from customers.
customer_creation: PaymentLinkCustomerCreation
Configuration for Customer creation during checkout.
line_items: List<CheckoutSessionItem>
The line items representing what is being sold.
livemode: bool
Has the value true
if the object exists in live mode or the value false
if the object exists in test mode.
metadata: 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.
on_behalf_of: Option<Expandable<Account>>
The account on behalf of which to charge.
See the Connect documentation for details.
payment_intent_data: Option<PaymentLinksResourcePaymentIntentData>
Indicates the parameters to be passed to PaymentIntent creation during checkout.
payment_method_types: Option<Vec<PaymentLinkPaymentMethodTypes>>
The list of payment method types that customers can use.
When null
, Stripe will dynamically show relevant payment methods you’ve enabled in your payment method settings.
phone_number_collection: PaymentLinksResourcePhoneNumberCollection
shipping_address_collection: Option<PaymentLinksResourceShippingAddressCollection>
Configuration for collecting the customer’s shipping address.
shipping_options: Vec<PaymentLinksResourceShippingOption>
The shipping rate options applied to the session.
submit_type: PaymentLinkSubmitType
Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button.
subscription_data: Option<PaymentLinksResourceSubscriptionData>
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: PaymentLinksResourceTaxIdCollection
transfer_data: Option<PaymentLinksResourceTransferData>
The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
url: String
The public URL that can be shared with customers.
Implementations
sourceimpl PaymentLink
impl PaymentLink
sourcepub fn list(
client: &Client,
params: &ListPaymentLinks<'_>
) -> Response<List<PaymentLink>>
pub fn list(
client: &Client,
params: &ListPaymentLinks<'_>
) -> Response<List<PaymentLink>>
Returns a list of your payment links.
sourcepub fn create(
client: &Client,
params: CreatePaymentLink<'_>
) -> Response<PaymentLink>
pub fn create(
client: &Client,
params: CreatePaymentLink<'_>
) -> Response<PaymentLink>
Creates a payment link.
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);
}
sourcepub fn retrieve(
client: &Client,
id: &PaymentLinkId,
expand: &[&str]
) -> Response<PaymentLink>
pub fn retrieve(
client: &Client,
id: &PaymentLinkId,
expand: &[&str]
) -> Response<PaymentLink>
Retrieve a payment link.
sourcepub fn update(
client: &Client,
id: &PaymentLinkId,
params: UpdatePaymentLink<'_>
) -> Response<PaymentLink>
pub fn update(
client: &Client,
id: &PaymentLinkId,
params: UpdatePaymentLink<'_>
) -> Response<PaymentLink>
Updates a payment link.
Trait Implementations
sourceimpl Clone for PaymentLink
impl Clone for PaymentLink
sourcefn clone(&self) -> PaymentLink
fn clone(&self) -> PaymentLink
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 Debug for PaymentLink
impl Debug for PaymentLink
sourceimpl Default for PaymentLink
impl Default for PaymentLink
sourcefn default() -> PaymentLink
fn default() -> PaymentLink
Returns the “default value” for a type. Read more
sourceimpl<'de> Deserialize<'de> for PaymentLink
impl<'de> Deserialize<'de> for PaymentLink
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Object for PaymentLink
impl Object for PaymentLink
sourceimpl Serialize for PaymentLink
impl Serialize for PaymentLink
Auto Trait Implementations
impl RefUnwindSafe for PaymentLink
impl Send for PaymentLink
impl Sync for PaymentLink
impl Unpin for PaymentLink
impl UnwindSafe for PaymentLink
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>
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