[−][src]Struct paypal_rs::Client
Represents a client used to interact with the paypal api.
Fields
client: Client
Internal http client
sandbox: bool
Whether you are or not in a sandbox enviroment.
auth: Auth
Api Auth information
Implementations
impl Client
[src]
pub async fn create_order<'_>(
&'_ self,
order: OrderPayload,
header_params: HeaderParams
) -> Result<Order, Box<dyn Error>>
[src]
&'_ self,
order: OrderPayload,
header_params: HeaderParams
) -> Result<Order, Box<dyn Error>>
Creates an order. Supports orders with only one purchase unit.
pub async fn update_order<'_, S: Display>(
&'_ self,
id: S,
intent: Option<Intent>,
purchase_units: Option<Vec<PurchaseUnit>>
) -> Result<(), Box<dyn Error>>
[src]
&'_ self,
id: S,
intent: Option<Intent>,
purchase_units: Option<Vec<PurchaseUnit>>
) -> Result<(), Box<dyn Error>>
Updates an order with the CREATED or APPROVED status. You cannot update an order with the COMPLETED status.
Only replacing the existing purchase units and intent is supported right now.
Note: You can only update the intent from Authorize to Capture
More info on what you can change: https://developer.paypal.com/docs/api/orders/v2/#orders_patch
pub async fn show_order_details<'_, S: Display>(
&'_ self,
order_id: S
) -> Result<Order, Box<dyn Error>>
[src]
&'_ self,
order_id: S
) -> Result<Order, Box<dyn Error>>
Shows details for an order, by ID.
pub async fn capture_order<'_, S: Display>(
&'_ self,
order_id: S,
header_params: HeaderParams
) -> Result<Order, Box<dyn Error>>
[src]
&'_ self,
order_id: S,
header_params: HeaderParams
) -> Result<Order, Box<dyn Error>>
Captures payment for an order. To successfully capture payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response.
pub async fn authorize_order<'_, S: Display>(
&'_ self,
order_id: S,
header_params: HeaderParams
) -> Result<Order, Box<dyn Error>>
[src]
&'_ self,
order_id: S,
header_params: HeaderParams
) -> Result<Order, Box<dyn Error>>
Authorizes payment for an order. To successfully authorize payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response.
impl Client
[src]
pub fn new<S: Into<String>>(client_id: S, secret: S, sandbox: bool) -> Client
[src]
Returns a new client, you must get_access_token afterwards to interact with the api.
Examples
let clientid = std::env::var("PAYPAL_CLIENTID").unwrap(); let secret = std::env::var("PAYPAL_SECRET").unwrap(); let mut client = paypal_rs::Client::new( clientid.as_str(), secret.as_str(), true, ); client.get_access_token().await.unwrap();
pub async fn get_access_token<'_>(&'_ mut self) -> Result<(), Box<dyn Error>>
[src]
Gets a access token used in all the api calls.
pub fn access_token_expired(&self) -> bool
[src]
Checks if the access token expired.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,