Re: How to get a shopify_payments_account_id without creating a checkout?

How to get a shopify_payments_account_id without creating a checkout?

richardmherndon
Shopify Partner
1 0 0

I'm developing a sales channel that will use Stripe Elements to tokenize credit cards before sending the Stripe token to Shopify to process the payment (basically exactly what's laid out in this walkthrough). Stripe's JS clients require that you pass in an account ID (the Shopify-provided shopify_payments_account_id) at initialization, rather than passing it in as an argument in the individual tokenization calls.

If possible, I'd love to be able to initialize a Stripe client in my client-side code without having to create a checkout object in Shopify beforehand, as this slows down load times and creates a resource that I don't know if I'll end up needing until the user actually ends up checking out. So, two questions:

  1. Is it possible to get a store's shopify_payments_account_id programmatically without creating a checkout resource? 
  2. Does a given store's shopify_payments_account_id value ever change? Or would it be safe to, say, create a single empty checkout when that store authenticates with our sales channel for the first time, just to retrieve the payments account ID, and then persist and reuse that ID indefinitely? 

Really appreciate any help folks can offer! Would be great if this was documented somewhere in Shopify's docs, but I am pretty sure I haven't seen it anywhere.

Reply 1 (1)

Jakeyd
Shopify Partner
11 1 2

Did you ever manage to solve this? Would love to know how to obtain the ID without the checkout API.