Expand description
A crate that serves to abstract away the network aspect of interfacing with paypal. Created by nikos
Creating a payment is done using the create_payment
function.
let token = paypal::get_token("my_id", "my_secret")?;
let amount = TransactionAmount {
currency: "USD".to_string(),
total: "100.00".to_string()
};
let new_payment = payment::new(
&token.access_token,
"mysite.com/whooyoupaid",
"mysite.com/nooyoufailed",
PaymentMethod::Paypal,
PaymentIntent::Sale,
vec![Transaction { amount }],
)?;
Modules§
- error
- Possible ways that a paypal request can fail
Structs§
- Address
- Represents an address.
- Application
Context - Used to customize the payment flow page.
- Credit
Card - A credit card
- Credit
Card Token - A credit card in token representation.
- Funding
Instrument - Data about a credit card.
- Link
Description - A struct containing a url and some metadata.
- List
Payment Response - Returned when listing all payments in the system.
- Payer
- A paypal account that can be charged.
- Payment
- A single payment in PayPal’s system, either completed or not.
- Redirect
Urls - Struct containing urls where the users is redirected after visiting the paypal site.
- Transaction
- A single transaction in paypals system. A payment consists of zero or more transactions
- Transaction
Amount - A currency-aware representation of an amount of money
Enums§
- Failure
Reason - The reason code for a payment failure.
- Normalization
Status - The address normalization status. Returned only for payers from Brazil.
- Payer
Status - The status of a Payer
- Payment
Intent - The type of payment that is created
- Payment
Method - Represents one of the ways paypal is able to process payments.
- State
- Represents the state of a payment.
Functions§
- execute
- Finalizes charging of a previously constructed payment. This usually comes after the payment has been created and approved by the customer.
- get_
token - This function uses your
client id
andsecret
, and creates a bearer token that you must use to get access to the paypal endpoints - list
- Returns a list of all transactions made using the account that corresponds to the provided bearer token.
- new
- Use this endpoint to create a new payment.
You can obtain a new bearer token using the
get_token
function provided.