We are building a custom solution for a client, and are seeking to create Shopify subscription-based membership logic. To accomplish this, we are trying to allow customers through the standard Shopify Checkout, and capture their payment method. Additional things to note, we have already cleared access to the payment_method API scopes, and are using the GraphQL Admin API.
We are making the assumption that a payment method is attached to their user object upon checkout, but we are returning an empty array in the payment methods.
{
"data":{
"customer":{
"id":"gid:\/\/shopify\/Customer\/53***0",
"email":"***",
"paymentMethods":{
"edges":[]
}
}
}
...
}
The goal is to use the payment method and attach it to a subscription contract, with the customer able to view and manage their payment method directly on the subscription via a custom portal.
Additionally, when we test manually creating and attaching a payment_method to a customer, that works, however retrieving the customerPaymentMethod does not provide any information regarding the card itself.
{
"data": {
"customerPaymentMethod": {
"id": "gid://shopify/CustomerPaymentMethod/604***d61",
"instrument": {},
"customer": { "id": "gid://shopify/Customer/54**0" }
}
}
...
}
Questions are:
- Where can we find payment methods from checkout?
- Can a customer have multiple stored payment methods?
- When we are able to retrieve a payment method, we cannot pull any information (last 4, exp, etc), as the customerPaymentMethod.instrument is not showing any information.