pub struct PaymentsApi { /* private fields */ }
Expand description
The Payments API lets developers take and manage payments.
Implementations§
Source§impl PaymentsApi
impl PaymentsApi
pub fn new(config: Configuration, client: HttpClient) -> Self
Sourcepub async fn cancel_payment(
&self,
payment_id: &str,
) -> Result<CancelPaymentResponse, ApiError>
pub async fn cancel_payment( &self, payment_id: &str, ) -> Result<CancelPaymentResponse, ApiError>
Cancels (voids) a payment.
You can use this endpoint to cancel a payment with the APPROVED status
.
Sourcepub async fn cancel_payment_by_idempotency_key(
&self,
body: &CancelPaymentByIdempotencyKeyRequest,
) -> Result<CancelPaymentByIdempotencyKeyResponse, ApiError>
pub async fn cancel_payment_by_idempotency_key( &self, body: &CancelPaymentByIdempotencyKeyRequest, ) -> Result<CancelPaymentByIdempotencyKeyResponse, ApiError>
Cancels (voids) a payment identified by the idempotency key that is specified in the request.
Use this method when the status of a CreatePayment
request is unknown (for example, after
you send a CreatePayment
request, a network error occurs and you do not get a response).
In this case, you can direct Square to cancel the payment using this endpoint. In the
request, you provide the same idempotency key that you provided in your CreatePayment
request that you want to cancel. After canceling the payment, you can submit your
CreatePayment
request again.
Note that if no payment with the specified idempotency key is found, no action is taken and the endpoint returns successfully.
Sourcepub async fn complete_payment(
&self,
payment_id: &str,
body: &CompletePaymentRequest,
) -> Result<CompletePaymentResponse, ApiError>
pub async fn complete_payment( &self, payment_id: &str, body: &CompletePaymentRequest, ) -> Result<CompletePaymentResponse, ApiError>
Completes (captures) a payment.
By default, payments are set to complete immediately after they are created.
You can use this endpoint to complete a payment with the APPROVED status
.
Sourcepub async fn create_payment(
&self,
body: &CreatePaymentRequest,
) -> Result<CreatePaymentResponse, ApiError>
pub async fn create_payment( &self, body: &CreatePaymentRequest, ) -> Result<CreatePaymentResponse, ApiError>
Creates a payment using the provided source.
You can use this endpoint to charge a card (credit/debit card or Square gift card) or record a payment that the seller received outside of Square (cash payment from a buyer or a payment that an external entity processed on behalf of the seller).
The endpoint creates a [Payment] object and returns it in the response.
Sourcepub async fn get_payment(
&self,
payment_id: &str,
) -> Result<GetPaymentResponse, ApiError>
pub async fn get_payment( &self, payment_id: &str, ) -> Result<GetPaymentResponse, ApiError>
Retrieves details for a specific payment
Sourcepub async fn list_payments(
&self,
params: &ListPaymentsParameters,
) -> Result<ListPaymentsResponse, ApiError>
pub async fn list_payments( &self, params: &ListPaymentsParameters, ) -> Result<ListPaymentsResponse, ApiError>
Retrieves a list of payments taken by the account making the request.
Results are eventually consistent, and new payments or changes to payments might take several seconds to appear.
The maximum results per page is 100.
Sourcepub async fn update_payment(
&self,
payment_id: &str,
body: &UpdatePaymentRequest,
) -> Result<UpdatePaymentResponse, ApiError>
pub async fn update_payment( &self, payment_id: &str, body: &UpdatePaymentRequest, ) -> Result<UpdatePaymentResponse, ApiError>
Updates a payment with the APPROVED status.
You can update the amount_money
and tip_money
using this endpoint.