Re: Get the "CPF/CNPJ" field from API Shopify

Get the "CPF/CNPJ" field from API Shopify

Presence
Visitor
1 0 5

Hi. I'm trying to get the "CPF/CNPJ" field from API Shopify, but I cannot do it. This field stores the "Document ID" in Brazil. When I get a order using Orders Endpoint, this field doesn't return. How can I get this information?

Replies 9 (9)

reynierhdez
Shopify Partner
1 0 0

Same problem here. Any updates?

mfcss
Explorer
66 6 28

I also have this issue, same for South Korea. Any suggestions?

 

JohnAl
Shopify Partner
1 0 0

+1 .. 

reginaldoboeke
Shopify Partner
2 0 0

same problem here...

VBlancoPR
Shopify Partner
2 0 2

In case anyone is still looking for this, you need to fetch the order information from the GraphQL API, and the tax id for Brazil or South Korea is within the 

 

You would get something like this for Brazil CPF/CNPJ:

"localizationExtensions": {
    "nodes": [
        {
            "countryCode": "BR",
            "purpose": "SHIPPING",
            "title": "CPF/CNPJ",
            "value": "000.000.000-00"
        }
    ]
},

 

And for the South Korean PCC:

"localizationExtensions": {
    "nodes": [
        {
            "countryCode": "KR",
            "purpose": "SHIPPING",
            "title": "Personal Customs Code",
            "value": "P000000000000"
        }
    ]
},

 

majulucato
Shopify Partner
1 0 1

Thank you @VBlancoPR ‌😁‌ I was searching for this for so long.

sibeliusseraphi
Visitor
2 0 0

what GraphQL query? can I use the payment app graphql for this ?

VBlancoPR
Shopify Partner
2 0 2

Not sure about the Payments app API, cause I haven't used that API, but the LocalizationExtension object is part of the order information which is available in the Admin apps API.

MarcilioSouza
Shopify Partner
1 0 1

For those who need to search for the CPF/CNPJ via GraphQL, this is the query:

 

query { order(id: ""gid://shopify/Order/00000000000"" ) { name,
localizationExtensions(first:10){ nodes { purpose, countryCode, title, value } } } }


If you're using the C# lib for Shopify GraphQL:

var result = ShopifyGraphQL.Net.Factories.GraphServiceFactory
                                .CreateGraphService("https://storename.myshopify.com/admin/api/2024-07/graphql.json", Token)
                                .PostAsync(@"query { order(id: ""gid://shopify/Order/000000000000"" ) { name,
                                    localizationExtensions(first:10){ nodes { purpose, countryCode, title, value } } } }")
                                .Result;