question

msargent avatar image
msargent asked msargent answered

REST API - How to retrieve owner or merchant phone number?

Hi,

How can I get an owner or merchant phone number from the /v3/merchants/ endpoint?

When using this endpoint:
GET /v3/merchants/{mId}?expand=owner

I'm able to get Owner Name and Owner Email. In PHP after I receive the data and decode the JSON I store it in $merchant_data. Then I access it like this:
$merchant_data['owner']['name'] 
$merchant_data['owner']['email']

I've tried just accessing the top level phoneNumber but that comes up empty:
$merchant_data['phoneNumber']

I've also tried getting address { phoneNumber } like so:
GET /v3/merchants/{mId}?expand=owner.address
$merchant_data['address']['phoneNumber']

This also comes up empty.

When looking at the sandbox Clover Dashboard it looks like what I need is under my test merchant > Setup > Business Information > Phone Number but I don't know how to access it.
REST APIMerchant
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

zgreathouse avatar image
zgreathouse Deactivated answered
The endpoint you are looking for is the following:
GET /v3/merchants/{mId}?expand=address

Please review our RestAPI reference here:
https://sandbox.dev.clover.com/api_docs/#!/merchants/GetMerchant

Please review our api documentation on expanding hidden fields here: https://docs.clover.com/build/web-api/#field_expansion
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

msargent avatar image
msargent answered
Oops, changing this:
GET /v3/merchants/{mId}?expand=owner.address
To this:
GET /v3/merchants/{mId}?expand=owner,address
solved my problem.

Thanks for pointing me back to the docs. I mistakingly used the delimiter for multiple levels of field expansion (.) instead of just multiple fields (,)
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community