Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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
3 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
171 21 44

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
171 21 44

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
Community Manager
3108 344 889

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