Skip to main content
The Refunds API allows you to refund payments, either in full or partially. You can refund card payments or record refunds for cash or external payments.

Client Methods

List Refunds

Retrieves a list of refunds for the account making the request.
client.Refunds.List(ctx context.Context, request *square.ListRefundsRequest) (*square.ListPaymentRefundsResponse, error)
request
*square.ListRefundsRequest
Request parameters for listing refunds
response
*square.ListPaymentRefundsResponse
The list of payment refunds
request := &square.ListRefundsRequest{
    BeginTime: square.String("2024-01-01T00:00:00Z"),
    EndTime: square.String("2024-12-31T23:59:59Z"),
    SortOrder: square.String("DESC"),
    LocationID: square.String("location_id"),
    Limit: square.Int(10),
    SortField: square.ListPaymentRefundsRequestSortFieldCreatedAt.Ptr(),
}

response, err := client.Refunds.List(context.TODO(), request)
if err != nil {
    log.Fatal(err)
}

Refund Payment

Refunds a payment. You can refund the entire payment amount or a portion of it. You can use this endpoint to refund a card payment or record a refund of a cash or external payment.
client.Refunds.RefundPayment(ctx context.Context, request *square.RefundPaymentRequest) (*square.RefundPaymentResponse, error)
request
*square.RefundPaymentRequest
required
Request parameters for refunding a payment
response
*square.RefundPaymentResponse
The refund details
request := &square.RefundPaymentRequest{
    IdempotencyKey: "9b7f2dcf-49da-4411-b23e-a2d6af21333a",
    AmountMoney: &square.Money{
        Amount: square.Int64(int64(1000)),
        Currency: square.CurrencyUsd.Ptr(),
    },
    AppFeeMoney: &square.Money{
        Amount: square.Int64(int64(10)),
        Currency: square.CurrencyUsd.Ptr(),
    },
    PaymentID: square.String("R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY"),
    Reason: square.String("Customer requested refund"),
}

response, err := client.Refunds.RefundPayment(context.TODO(), request)
if err != nil {
    log.Fatal(err)
}

Get Refund

Retrieves a specific refund using the refund_id.
client.Refunds.Get(ctx context.Context, request *square.GetRefundsRequest) (*square.GetPaymentRefundResponse, error)
RefundID
string
required
The unique ID for the desired PaymentRefund.
response
*square.GetPaymentRefundResponse
The refund details
request := &square.GetRefundsRequest{
    RefundID: "refund_id",
}

response, err := client.Refunds.Get(context.TODO(), request)
if err != nil {
    log.Fatal(err)
}

Key Concepts

Refund Types

  • Linked Refunds: Refunds tied to a specific Square payment. The payment_id field is required.
  • Unlinked Refunds: Refunds not tied to a Square payment (e.g., cash refunds). Requires unlinked=true, destination_id, and location_id.

Partial Refunds

You can refund a portion of a payment by specifying an AmountMoney less than the original payment amount. The refund amount cannot exceed the payment total minus any previously completed refunds.

Refund Status

Refunds can have the following statuses:
  • PENDING: The refund is being processed
  • COMPLETED: The refund has been completed
  • REJECTED: The refund was rejected
  • FAILED: The refund failed

Learn More

Build docs developers (and LLMs) love