Saving payment method for customer so I can create a subscription contact

Solved

Saving payment method for customer so I can create a subscription contact

SC_Jay
Shopify Partner
2 0 0

So I am making a subscription app. I need it so that when an order is created and the user is not subscribed a subscription contract is created for them, this process requires the customer to have a payment method, to get this I use:

{
      customer(id: $customerID) {
      firstName
        paymentMethods(first: 5) {
          edges {
            node {
              id
            }
          }
        }
      }
    }
I was testing this on my development store with a fresh account but payment methods is blank, even after completing the checkout. I need to know if when a checkout is completed the paymentMethod is saved, if not do I have to handle this myself and how can I do this. Many Thanks in advance I have been stuck on this for hours 

 

Accepted Solution (1)

Brian_S
Shopify Partner
160 21 39

This is an accepted solution.

Payment methods aren't going to be saved unless the customer checks out with an item in their cart that has a selling plan (ie unless they have purchased a subscription) 

Brian Singer
CTO & Cofounder of Subscription Service - Awtomic

View solution in original post

Replies 2 (2)

Brian_S
Shopify Partner
160 21 39

This is an accepted solution.

Payment methods aren't going to be saved unless the customer checks out with an item in their cart that has a selling plan (ie unless they have purchased a subscription) 

Brian Singer
CTO & Cofounder of Subscription Service - Awtomic
Liam
Shopify Staff
2807 310 805

Thanks for solving this Brian!!

Liam | Developer Advocate @ 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