Hello,
After successful payment, I am trying to get details of the card like the card’s last 4 digits, brand and name. I can get the last 4 digits and brand but the name is always blank. I tried tap to pay and also manual card entry for the payment.
NSDictionary<NSString *, id> *paymentDict = onlinePayment.dictionaryRepresentation;
id <SQMPCard> card = onlinePayment.cardDetails.card;
NSString * cardNum = card.last4;
NSString * cardType = paymentDict[@"cardDetails"][@"card"][@"cardBrand"];
NSString * cardName = [card cardholderName];
Am I missing anything here?
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
Build on iOS: In-App Payments SDK
Gift Card Payments
Payment API: Process Online and In-Person Payments
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.
Card holder name will only be present if it was provided when calling CreatePayment
. If you need the card holders name you’ll need to take the customer_id
and call RetrieveCustomer to get the name of the customer. 
So there is no way to get the name from the SDK by
id <SQMPCard> card = onlinePayment.cardDetails.card;
?
I am not using other APIs in the app and only using SDK.
Right, there isn’t any other way to get the customers name with the SDK. You have to call the Customers API to get those details. 
Sorry, but I don’t understand this.
We are not creating customers in Square but just taking payments via Readers like POS. So do we need to implement create customer and then create payment n all? Can you please provide more details?
When a payment is created without an explicit customer assignment, Square attempts to infer the associated customer. First, Square checks the customer_id
field in the corresponding order. If this field isn’t set, Square searches the Customer Directory for a matching profile using payment or related information (such as the billing and shipping address, email address, and payment source). If one cannot be found, Square attempts to create an instant profile. Note that this process is asynchronous and might take some time before customer_id
is added to the payment.
If Square cannot find a matching customer profile and cannot create an instant profile, the customer_id
field of the payment remains unset.
You can have your app collect the customer information and create a customer profile so you’ll have the information. Otherwise some payments may not have a customer_id
. 
Thanks for the explanation.
However, taking the user’s details before payment is not what we want in our app because it will queue up the people and take more time for the whole process.
We just wanted to take payments from readers for a purpose. So I think the last 4 digits are fine to have than the card holder’s name.
One more thing about the Requirements and limitations for SDK doc says:
- You’ve set your Xcode iOS deployment target to iOS 16+.
But my project has iOS 14 deployment target and it’s still working fine. I am able to compile and take payments on production. So what’s the point of iOS deployment target to iOS 16? Will it affect if I have iOS 14?
If it’s working on iOS 14 great! However the stable supported target is iOS 16+. 