skip to Main Content

I am writing a non-embeeded standlone shopify app in react and node.

I am having 3 pricing plans in my app, now I want on select of any plan it should redirect to payment page of shopify

I am able to create a recurring pricing charge by this graphQL Query

const response = await client.query({
    data: `mutation CreateSubscription{
    appSubscriptionCreate(
      name: "${planName}"
      returnUrl: "${returnUrl}"
      test: true
      lineItems: [
        {
          plan: {
            appRecurringPricingDetails: {
              price: { amount: ${planPrice}, currencyCode: USD }
            }
          }
        }
      ]
    ) {
      userErrors {
        field
        message
      }
      confirmationUrl
      appSubscription {
        id
        status
      }
    }
  }
`,
  });

By this my charge is getting created but user is not redirected to the payment page

2

Answers


  1. Chosen as BEST ANSWER

    I got the solution, this api returning a key confirmation_url which is payment url. Frontend can simply redirect to this page for payment gateway


  2. I tried to redirect to the confirmation URL but it doesn’t work,

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search