Unlock Precise Customer Data with Shop SDK Lead Capture’s Rich Authorization Requests

Shop SDK lead capture now supports Rich Authorization Requests, letting apps ask for specific customer fields like phone number or birthdate during onboarding. Learn what changed, who it impacts, and how to implement the new flow step‑by‑step.

Unlock Precise Customer Data with Shop SDK Lead Capture’s Rich Authorization Requests
6 sections

Shopify’s latest developer update brings a powerful new capability to the Shop SDK: Rich Authorization Requests (RAR) for lead capture. With RAR, your app can request exactly the profile fields it needs—phone number, birthdate, given name, or family name—directly during the authorization flow, and you can mark each field as required or optional. This post breaks down the change, explains who needs to pay attention, and provides a practical, code‑first guide to get you shipping today.

What changed

Lead capture now accepts a new attribute called attributes.authorizationDetails. It expects a serialized JSON array that describes the data types your app wants and whether each is mandatory. The schema looks like this:

javascript

const authorizationDetails = JSON.stringify([

{

type: 'urn:shopify:shop_app:data-sharing:v1',

datatypes: [

{name: 'phone_number', required: true},

{name: 'birthdate', required: false},

],

},

]);

When you pass this string to the lead‑capture constructor, Shopify presents the user with a consent screen that asks for any missing values. Required fields must be filled; optional ones can be skipped. If the user declines the whole authorization, the onComplete callback will not include a shopConsentToken, and your app should handle that case gracefully.

Who is affected

The change is scoped to apps that use the Shop SDK lead‑capture flow. If you already integrate lead capture, nothing breaks—RAR is opt‑in. However, if you want to collect richer data (e.g., a customer’s birthdate), you’ll need to add the new attribute and, on the server side, have a client secret and a trusted backend to exchange the shopConsentTokenfor actual user data via the Shop Partners API.

How to implement Rich Authorization Requests

  • Add the authorizationDetails attribute when you instantiate the lead‑capture widget. If you also need the user’s identifier and email, set attributes.scopeto "shop_app:oauth" as shown in the official guide.
  • Handle onComplete – The event will contain a shopConsentTokenif the user approved. Send that token to your server; the client‑side event never includes the actual field values.
  • Exchange the token – On your server, call the fetchTokensForUser mutation on the Shop Partners API. The response includes the authorized fields (phone_number, birthdate, etc.) or null for any optional field the user skipped.
  • Update the store’s customer record – If the authorized phone number is new, you can write it back to the store’s customer via the standard customer update endpoint. Note that names are not overwritten; they remain as Shopify stores them.
  • Error handling – If the user declines, onComplete omits the token. If your JSON payload is malformed, the lead‑capture flow will fire onError with the code "invalid_authorization_details". Make sure to validate the JSON before sending it.
  • Testing and validation

    Before you push to production, run through four scenarios:

  • Successful authorization – All required fields are provided, token received, server exchange succeeds.
  • Optional field skipped – Verify the server returns null for that field and your UI handles the missing value.
  • User declines – Ensure your onComplete logic does not crash when the token is absent.
  • Malformed JSON – Send an incorrectly formatted authorizationDetails string and confirm onError fires with "invalid_authorization_details".
  • Testing in a development store with the Shop SDK sandbox mode will give you fast feedback.

    Action checklist for developers

  • [ ] Serialize the desired data fields into the authorizationDetails JSON array.
  • [ ] Add the attribute to your lead‑capture init call.
  • [ ] Include scope "shop_app:oauth" if you need the user’s email or identifier.
  • [ ] Implement onComplete logic to forward the shopConsentToken to a secure backend.
  • [ ] Use the fetchTokensForUser mutation to retrieve the authorized data.
  • [ ] Update the store’s customer record only for fields you’re allowed to change.
  • [ ] Add error handling for declined authorizations and malformed payloads.
  • [ ] Run the four test scenarios listed above.
  • [ ] Deploy and monitor the lead‑capture flow for any unexpected consent failures.
  • Conclusion & next steps

    Rich Authorization Requests give you granular control over the data you need, improve the user experience by surfacing only the missing pieces, and keep your app compliant with Shopify’s consent model. By following the steps above, you can upgrade your existing lead‑capture integration with minimal risk and start delivering richer, more personalized experiences for merchants and their customers.

    Ready to try it out? Open your development store, add the new attribute, and watch the consent screen adapt in real time. If you hit any snags, the Shopify Dev Forums and the Lead Capture documentation are great places to ask questions.

    Happy building!

    Tags
    Sources

    Related Articles

    Variants Managed Directly on the Product Page: What Shopify Merchants Need to Know

    Variants Managed Directly on the Product Page: What Shopify Merchants Need to Know

    Shopify’s latest update moves variant management onto the product page, letting merchants edit, search, filter, and bulk‑edit variants without switching screens. Learn who’s affected, how to enable it, and what developers should consider.

    October 29, 20265 min
    Waiving Outstanding Order Balagues: What Shopify Merchants Must Know

    Waiving Outstanding Order Balagues: What Shopify Merchants Must Know

    Shopify now lets merchants waive unpaid order balances directly from the order page. Learn what changed, who it affects, how to enable permissions, and how to track write‑offs.

    October 29, 20264 min
    GTIN Autocomplete & Suggestions: Boosting Barcode Accuracy in Shopify Admin

    GTIN Autocomplete & Suggestions: Boosting Barcode Accuracy in Shopify Admin

    Shopify’s Admin now validates barcodes against the GS1 registry, offering real‑time GTIN suggestions, autocomplete, and bulk‑accept tools. Learn what changed, who it impacts, and how to start using the new features today.

    October 29, 20265 min
    Boost Sales with WhatsApp Marketing Automations in Shopify Messaging

    Boost Sales with WhatsApp Marketing Automations in Shopify Messaging

    Shopify now lets merchants launch automated WhatsApp messages for abandoned browse, cart, and checkout events straight from the Messaging dashboard. Learn what’s changed, who needs to act, and how to set up the automations or extend them via the API.

    October 28, 20264 min