Get payments endpoint

im wondering if a payment retrieved with GET /payments/{payment_id} will always return the cardholder_name

this is the example given here in the api reference for the endpoint: GET /v2/payments/{payment_id} - Square API Reference

image

the card_details object shows that the cardholder_name should be returned, as seen in the CardPaymentDetails object in the api reference

however, in sandbox testing i have done with test cards with names associated with them, the cardholder name is never returned

is there a special condition where the cardholder_name field is always returned, how can i ensure the endpoint always returns this field?

:wave: 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

Sandbox Payments
Test in the Sandbox
Create a Card on File and a Payment

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 cardholder_name field in the card_details object of a Payment is not always returned. This field is optional and is only included in the response if the cardholder’s name was provided at the time of the payment. If the cardholder’s name was not provided or not available during the payment process, this field will not be included in the response. Therefore, there’s no guaranteed way to ensure that the cardholder_name field is always returned in every response.

This answer was reviewed by @Bryan-Square.

1 Like