where is CustomerCreditCard?

davidfii
New Member
5 0 0

I am trying to access this object: https://shopify.dev/docs/admin-api/graphql/reference/customers/customercreditcard  via graphql, but I don't know where it is. It doesn't appear to be in the Order object, nor the Order's Customer object, nor the Order's Transaction object.

In fact, I don't see any "Types that return X" section on this api docs page.

Any help would be appreciated, thanks!

Replies 9 (9)

davidfii
New Member
5 0 0

Okay I think I found a way to get to it via https://shopify.dev/docs/admin-api/graphql/reference/customers/customerpaymentmethod  , and then via instrument but when I make the query:

 

{ orders(first: 10) { edges { node { id name customer { email firstName paymentMethods(first: 10) { edges { node { instrument } } } } } } } }

 

 

I get "Access denied for paymentMethods field." But according to the api doc link above, that object should be accessible if the read_customers access scope is enabled, which it is. I am able to get customer name and email address if I only query email and firstName.

Any help would be appreciated, thanks!

Kevin_A
Shopify Staff
318 42 61

Hey @davidfii 

These fields are only for our new subscription APIs and require a specific permission. If this is for a subscription app, make sure you have requested access in your partner dashboard. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

davidfii
New Member
5 0 0

Thanks Kevin,

No, this is an order-based app. I need to access the expiryMonth and expiryYear for a customer's credit card per-order. Is that not possible?

Kevin_A
Shopify Staff
318 42 61

Hey @davidfii 

I would normally suggest the order transaction endpoint (https://shopify.dev/docs/admin-api/rest/reference/orders/transaction) for specific payment details but I don't believe you will be able to pull expiry date info from there. I don't believe there is any endpoint that will share secure card details like the expiry date, CVV, or credit card number. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Kevin_A
Shopify Staff
318 42 61

Hey @davidfii 

Actually, I spoke too soon! I just tested using the order transaction endpoint and we do list the "exp_month" and "exp_year" as parameters nested under "payment_method_details". 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

davidfii
New Member
5 0 0

Great thanks Kevin! I just tested it on an order transaction and I see the exp info there.

Thanks for your help 🙂

davidfii
New Member
5 0 0

One last question @Kevin_A , I see in https://shopify.dev/docs/admin-api/rest/reference/orders/transaction that the field I found the exp_month/year data in is the `receipt` field. The API docs says the contents "depends on which gateway the shop is using." Does this mean the data structure is different depending on if it is, say, a Visa or Mastercard? Will I need custom code to reach into the data structure for each one? I'm not sure what "gateway" means here.

Thanks!

Kevin_A
Shopify Staff
318 42 61

Hey @davidfii 

You are correct, it is possible that the data structure/availability might change a bit depending on which gateway was used. My best suggestion here would be to try and test against multiple gateways to get a better idea of what you will see. 

Kevin_A | Solutions Engineer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

agarric
Shopify Partner
7 0 11

I have requested access in my partner dashboard for both the Subscriptions API, gotten it approved by Shopify, added the new scopes to my app and updated the permissions on the dev store its installed to, but I'm still getting 

"message":"Access denied for paymentMethods field."