pub struct CheckoutPreferences { /* private fields */ }
Expand description
Preferences to create your checkout.
[notification_url
] is optional, but highly recommended way to receive payment updates.
[available_payment_methods
] is used to restrict payment options, and can be used with the
set_available_payment_methods
builder.
Implementations§
Source§impl CheckoutPreferences
impl CheckoutPreferences
pub fn new( order_number: String, products: Vec<YapayProduct>, ) -> Result<Self, SDKError>
Sourcepub fn set_available_payment_methods<PM>(self, methods: &[PM]) -> Selfwhere
PM: AsPaymentMethod,
pub fn set_available_payment_methods<PM>(self, methods: &[PM]) -> Selfwhere
PM: AsPaymentMethod,
Restricts payment methods to those used on methods
parameter.
§Usage
use std::num::NonZeroU8;
use yapay_sdk_rust::checkout::CheckoutPreferences;
use yapay_sdk_rust::common_types::{AsPaymentMethod, PaymentCreditCard, YapayProduct};
let product = YapayProduct::new(
"sample".to_string(),
"a sample product".to_string(),
NonZeroU8(1).unwrap(),
10_f64,
);
let preferences = CheckoutPreferences::new("order_number".to_string(), vec![product])
.unwrap()
.set_available_payment_methods(&[PaymentCreditCard::payment_methods_all()]);
// now you can only pay with credit cards
pub fn set_notification_url<U>(self, url: U) -> Result<Self, SDKError>where
U: IntoUrl,
Sourcepub fn set_process_url<U>(self, url: U) -> Result<Self, SDKError>where
U: IntoUrl,
pub fn set_process_url<U>(self, url: U) -> Result<Self, SDKError>where
U: IntoUrl,
Sets the url_process
, which will redirect the user after payment.
This is the standard way of redirecting, it doesn’t matter if the transaction failed, or was
a success.
You can use this to trigger a response to your server that the user has finished a payment, and now needs to wait for a definitive response.
pub fn to_form(self, token: &str) -> String
Trait Implementations§
Source§impl Clone for CheckoutPreferences
impl Clone for CheckoutPreferences
Source§fn clone(&self) -> CheckoutPreferences
fn clone(&self) -> CheckoutPreferences
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CheckoutPreferences
impl Debug for CheckoutPreferences
Source§impl Default for CheckoutPreferences
impl Default for CheckoutPreferences
Source§fn default() -> CheckoutPreferences
fn default() -> CheckoutPreferences
Returns the “default value” for a type. Read more
Source§impl PartialEq for CheckoutPreferences
impl PartialEq for CheckoutPreferences
Source§impl Serialize for CheckoutPreferences
impl Serialize for CheckoutPreferences
Source§impl Validate for CheckoutPreferences
impl Validate for CheckoutPreferences
Source§impl<'v_a> ValidateArgs<'v_a> for CheckoutPreferences
impl<'v_a> ValidateArgs<'v_a> for CheckoutPreferences
impl StructuralPartialEq for CheckoutPreferences
Auto Trait Implementations§
impl Freeze for CheckoutPreferences
impl RefUnwindSafe for CheckoutPreferences
impl Send for CheckoutPreferences
impl Sync for CheckoutPreferences
impl Unpin for CheckoutPreferences
impl UnwindSafe for CheckoutPreferences
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more