[][src]Crate paypal

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.

ApplicationContext

Used to customize the payment flow page.

CreditCard

A credit card

CreditCardToken

A credit card in token representation.

FundingInstrument

Data about a credit card.

LinkDescription

A struct containing a url and some metadata.

ListPaymentResponse

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.

RedirectUrls

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

TransactionAmount

A currency-aware representation of an amount of money

Enums

FailureReason

The reason code for a payment failure.

NormalizationStatus

The address normalization status. Returned only for payers from Brazil.

PayerStatus

The status of a Payer

PaymentIntent

The type of payment that is created

PaymentMethod

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 and secret, 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.