Termina Refunds

Hi

I am processing Terminal Refund using Go SDK. All payments was done through card present but when I am getting below error when I am performing Terminal Refunds.

For all successful payment transaction, I am getting this error.

package exampleimport (
    client "github.com/square/square-go-sdk/client"
    option "github.com/square/square-go-sdk/option"
    square "github.com/square/square-go-sdk"
    context "context"
    terminal "github.com/square/square-go-sdk/terminal"
)func do() () {
    client := client.NewClient(
        option.WithBaseURL(
            square.Environments.Production,
        ),
        option.WithToken(
            "Etests",
        ),
    )
    client.Terminal.Refunds.Create(
        context.TODO(),
        &terminal.CreateTerminalRefundRequest{
            IdempotencyKey: "cbe242fb-2425-4d37-86d7-0293fc7206bd",
            Refund: &square.TerminalRefund{
                DeviceID: "device:xxxxx",
                PaymentID: "testY",
                Reason: "Test",
                AmountMoney: &square.Money{
                    Amount: square.Int64(
                        17,
                    ),
                    Currency: square.CurrencyUsd.Ptr(),
                },
            },
        },
    )
}


{
“errors”: [
{
“code”: “BAD_REQUEST”,
“detail”: “Payment does not support card present refunds. Use the Refunds API to refund this payment. Refunds API - Square API Reference”,
“category”: “INVALID_REQUEST_ERROR”
}
]
}

what could be the issue ?

:waving_hand: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Troubleshoot the Payments API
Refunds API
Retrieve Refunds

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

The error message indicates that you’re trying to refund a card-present payment using the Terminal API, which is not supported. For card-present payments, you should use the Refunds API instead. The Terminal API is used for refunding payments that were originally processed through a Square Terminal device.

In your case, since the original payment was processed as a card-present transaction (not through a Square Terminal), you should use the Refunds API’s RefundPayment endpoint to process the refund.

Replace your Terminal Refunds API call with a call to the Refunds API. Make sure to provide the necessary parameters such as the payment ID and the amount to be refunded.

This answer was reviewed by @Bryan-Square.

Thanks Bryan.

Just curios here.. I have physical square terminal with me and I did original transaction through this terminal , will it not consider as Terminal Transaction ? what’s the difference between card-present transaction vs square terminal transaction ?

A transaction that takes place on a Terminal is considered a card-present payment as long as it’s not keyed in. I’d imagine that a Square Terminal transaction would mean the same just different wording. Is there something in our documentation that confused you? If so what’s the link to the documentation? :slight_smile: