We have the below use case as part of adding commerce capabilities inside our app -
1. Taking in the credit card info only once from the user and create a stripe customer object
2. Get the token for completing a checkout using customer id (stripe platform's one) and complete the checkout using the token
2'. Somehow pass the customer id info to Shopify Storefront completing the checkout API and complete the checkout.
Would be great if someone can advise whether 2 or 2' is possible using Shopify storefront API?
The Storefront API has the checkoutCompleteWithTokenizedPaymentV2 mutation, which you can see utilized here. With that you could generate a Stripe Token to use, I'm not sure Stripe Customer IDs work though
As the guide notes, you will need to be a sales channel app and be given access to payment processing before this mutation can be used: https://help.shopify.com/en/api/guides/sales-channel-sdk/getting-started#request-payment-processing
Thanks for the reply. One follow-up question I have -
So, you are saying that using Storefront API we cannot leverage Stripe Customer Id to complete a checkout? Which means that we need the user to punch-in the credit card details every time a checkout is initiated if using Storefront API? Is that right?
Hmm, if I'm going off documentation you should be able to. I'm going to work on getting you a clear answer. I'm referring to the note here: https://help.shopify.com/en/api/guides/sales-channel-sdk/completing-a-payment#integrate-stripe-with-...
If you've already tokenized the customer's credit card and created a customer in your Stripe platform account, then you can send the
customerid from your platform account instead of sending the card information.
So you can use the Stripe customer ID when creating the Stripe token, which you will use as input into the mutation. Referring to this documentation on Stripe's end: https://stripe.com/docs/api/tokens/create_card
You'll see that both card and customer are optional, where in your case you would make use of customer (which is the customer ID), where you would then receive a Stripe token in the response. Note that this requires Stripe Connect to be set up on your Stripe account.