Shopify / mobile-buy-sdk-ios

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.
MIT License
452 stars 199 forks source link

How to get cardVaultUrl #1053

Closed RuchiMakadia closed 4 years ago

RuchiMakadia commented 4 years ago

I am currently using 3.7.0 SDK, I am stuck in API cardClient.vault.

I am trying to get token from below code as per mention in the document

 let settings: Storefront.PaymentSettings
        let cardClient: Card.Client = Card.Client()

        let task = cardClient.vault(creditCard, to: settings.cardVaultUrl) { (token, error) in
            token
        } 

getting error when in code settings.cardVaultUrl

Constant 'settings' used before being initialized

I find it to write like

Storefront.PaymentSettings()

something like

Card.Client()

but not work please help me Where am I supposed to get that URL from? Thank in advance.

dbart01 commented 4 years ago

The GraphQL query you're looking for is this:

{
  shop {
    paymentSettings {
      cardVaultUrl
    }
  }
}
RuchiMakadia commented 4 years ago

Thank you