Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

How to Associate Checkout when click login? #132

Open

Description

I built a website using js-buy-sdk, and then I created checkout with the following

const client = Client.buildClient({
  domain,
  storefrontAccessToken: token
})
client.checkout.create()

then i got a webURL and navigate to the checkout Page

1615968891(1)

then i click Login to navigate my store page to login and Associate Checkout

there is a problem:

How do I get the checkoutId from the login link(xx.com/account/login?checkout_url=https://xxx.com/861536322/checkouts/46e3d1ec037401fad36db2fe880f7be8?key=b6b5dc0043e84a20b846a3ab1b3ffdc7&step=contact_information) to do the following:

It doesn't look like the key(b6b5dc0043e84a20b846a3ab1b3ffdc7) is the checkoutId

graphQLClient.send(gql(graphQLClient)`
    mutation checkoutCustomerAssociateV2($checkoutId: ID!, $customerAccessToken: String!) {
      checkoutCustomerAssociateV2(checkoutId: $checkoutId, customerAccessToken: $customerAccessToken) {
        checkout {
          id
        }
        checkoutUserErrors {
          code
          field
          message
        }
        customer {
          id
        }
      }
    }
  `, { checkoutId, customerAccessToken })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions