Hello.
We have a custom-made shopify app that is integrated into our store.
Our custom app, allows customers to enter their new credit card details, from which we create a payment method on stripe and then attempt to associate that stripe payment method to the shopify subscription contract. We have some customers that haven’t been able to switch their payment method because of the error “Payment method token is invalid”, and we’re unsure what is happening.
I’ll try to summarize everything we’re doing up until that error is caught:
- A customer interacts with our store, and performs a checkout, buying product(s) that require recurring payments. By this point, we are still using the shopify payments connector, so everything works fine here.
- The customer now wishes to update their payment method. For example, the old credit card has expired / has no funds, so they need to update. They interact with our custom app, where they have a form where they can enter the new card details (number, CCV, etc).
- When this happens, our custom app does the following:
3.1. Create a new token on stripe using the stripe js library (Stripe JS Reference)
3.2. Create a new customer on stripe (Create a customer | Stripe API Reference)
3.3. Create a new payment method on shopify using the graphql API customerPaymentMethodRemoteCreate. The input payload is:
{
"customerId": <shopify customer id>,
"remoteReference": {
"stripePaymentMethod": {
"customerId": <customer id from stripe that was created on step 3.2>,
"paymentMethodId": <card id that was created on step 3.1>
}
}
}
3.4. Associate the payment method to the shopify subscription contract with the graphql API subscriptionDraftUpdate. The input payload for this one is:
{
paymentMethodId: <shopify payment method id from step 3.3>
}
For some customers, step 3.4 is throwing the error “Payment method token is invalid”.
I’ve already reached out to stripe support which told that our store is using the “Legacy connector” with stripe, but I’m not really sure what this means.
What can we do here?
Also, is this the correct way to update payment methods on a subscription contract to a shopify payment?
I see that shopify also has the mutation customerPaymentMethodCreditCardCreate, but I have no idea how do we get the param “sessionId”, nor what does it represent.
Any help here would be seriously appreciated.