Documentation
¶
Index ¶
- type Client
- func (c *Client) Cancel(ctx context.Context, request *squaregosdk.CancelPaymentsRequest, ...) (*squaregosdk.CancelPaymentResponse, error)
- func (c *Client) CancelByIdempotencyKey(ctx context.Context, request *squaregosdk.CancelPaymentByIdempotencyKeyRequest, ...) (*squaregosdk.CancelPaymentByIdempotencyKeyResponse, error)
- func (c *Client) Complete(ctx context.Context, request *squaregosdk.CompletePaymentRequest, ...) (*squaregosdk.CompletePaymentResponse, error)
- func (c *Client) Create(ctx context.Context, request *squaregosdk.CreatePaymentRequest, ...) (*squaregosdk.CreatePaymentResponse, error)
- func (c *Client) Get(ctx context.Context, request *squaregosdk.GetPaymentsRequest, ...) (*squaregosdk.GetPaymentResponse, error)
- func (c *Client) List(ctx context.Context, request *squaregosdk.ListPaymentsRequest, ...) (*core.Page[*squaregosdk.Payment], error)
- func (c *Client) Update(ctx context.Context, request *squaregosdk.UpdatePaymentRequest, ...) (*squaregosdk.UpdatePaymentResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...option.RequestOption) *Client
func (*Client) Cancel ¶
func (c *Client) Cancel( ctx context.Context, request *squaregosdk.CancelPaymentsRequest, opts ...option.RequestOption, ) (*squaregosdk.CancelPaymentResponse, error)
Cancels (voids) a payment. You can use this endpoint to cancel a payment with the APPROVED `status`.
func (*Client) CancelByIdempotencyKey ¶ added in v1.1.0
func (c *Client) CancelByIdempotencyKey( ctx context.Context, request *squaregosdk.CancelPaymentByIdempotencyKeyRequest, opts ...option.RequestOption, ) (*squaregosdk.CancelPaymentByIdempotencyKeyResponse, error)
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.
func (*Client) Complete ¶
func (c *Client) Complete( ctx context.Context, request *squaregosdk.CompletePaymentRequest, opts ...option.RequestOption, ) (*squaregosdk.CompletePaymentResponse, error)
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`.
func (*Client) Create ¶
func (c *Client) Create( ctx context.Context, request *squaregosdk.CreatePaymentRequest, opts ...option.RequestOption, ) (*squaregosdk.CreatePaymentResponse, error)
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.
func (*Client) Get ¶
func (c *Client) Get( ctx context.Context, request *squaregosdk.GetPaymentsRequest, opts ...option.RequestOption, ) (*squaregosdk.GetPaymentResponse, error)
Retrieves details for a specific payment.
func (*Client) List ¶
func (c *Client) List( ctx context.Context, request *squaregosdk.ListPaymentsRequest, opts ...option.RequestOption, ) (*core.Page[*squaregosdk.Payment], error)
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.
func (*Client) Update ¶
func (c *Client) Update( ctx context.Context, request *squaregosdk.UpdatePaymentRequest, opts ...option.RequestOption, ) (*squaregosdk.UpdatePaymentResponse, error)
Updates a payment with the APPROVED status. You can update the `amount_money` and `tip_money` using this endpoint.