shopify-app-template-node icon indicating copy to clipboard operation
shopify-app-template-node copied to clipboard

Payment recursive

Open roman-march opened this issue 3 years ago • 12 comments

I have a problem with recursive. Support rejected the app.

Video: https://shopify.click/22-09-58372-51768.webm

error

I think this recursive between auth.js and verify-request.js. We check the payment several times and because of this we get a recursion

I found the problem in this place: https://github.com/Shopify/shopify-app-template-node/blob/0a987b4d3de8c62540b2f4aa6e97ad0261a16e3c/web/middleware/auth.js#L40-L49

https://github.com/Shopify/shopify-app-template-node/blob/0a987b4d3de8c62540b2f4aa6e97ad0261a16e3c/web/middleware/verify-request.js#L37-L45

roman-march avatar Sep 06 '22 07:09 roman-march

I was unable to fix the error. My application was rejected again! The app review team does not even give a chance and immediately rejects. The next review will be in two or three weeks.

roman-march avatar Sep 12 '22 13:09 roman-march

I'm running into the same problem. What did you do to fix the issue?

Davidkle avatar Sep 13 '22 05:09 Davidkle

I tried to remove the part of the code with re-checking the payment. It didn't work :(

roman-march avatar Sep 13 '22 19:09 roman-march

@Davidkle

It's probably an old problem that hasn't been fixed. #687

roman-march avatar Sep 13 '22 19:09 roman-march

I asked the question in the official discord. I recently tested it and it seems to work fine. Maybe it's an issue with their sandbox backend. Previously it did not work both during testing and during app review.

Davidkle avatar Sep 13 '22 20:09 Davidkle

Ok I figured out the problem. It's this block of code in the node template. When running in production and when using development stores, this will always return false even though there is an active subscription. Since there can only be one active subscription, I just look for that and return true instead.

Screen Shot 2022-09-14 at 8 09 55 AM

Davidkle avatar Sep 14 '22 15:09 Davidkle

Davidkle

Did you manage to pass the review? I also detected this issue, so I set a flag to block the development store isTestStore = (shopInfo[0].plan_name == "partner_test" || shopInfo[0].plan_name == "affiliate"). But the review team's plan is "staff" so I still got into this infinite loop. Do you have any suggestion to solve this?

jeff0723 avatar Oct 20 '22 02:10 jeff0723

Yes I got it pass review.

I fetched the store info with

  query GetShopInfo {
    shop {
      name
      plan {
        displayName
        partnerDevelopment
        shopifyPlus
      }
    }
  }

Then used the following logic

    if (shop.plan.partnerDevelopment || shop.plan.displayName === 'affiliate') {
      return true;
    }

Davidkle avatar Oct 20 '22 03:10 Davidkle

I suggest to just remove this line (!isProd || !subscriptions[i].test). It's useless because whenever there are no subscriptions, the hasActivePayment will return false. When there is a subscription, just have to check if the charge name is equal to the subscription's plan name.

jeff0723 avatar Oct 20 '22 05:10 jeff0723

@Davidkle or @jeff0723 Did you manage to get this to work? I've removed the !prod and test part, and finding the first active payment and returning true on that. But i still keep ending up in an infinite loop, where it constantly redirects to /exitframe?shop=shopurl from the Shopify.Utils.getEmbeddedAppUrl() method

madsenmm avatar Oct 25 '22 21:10 madsenmm

@tmmgrafikr I think it is too late to reply, but I could resolve the issue by adding /exitiframe (not exitframe, but exit i frame) to the client side routing

kino-ma avatar Feb 06 '23 09:02 kino-ma

Hi folks, thanks for the discussion here, and sorry for the delayed response.

We've reworked how billing works in the version 6+ of the library so that apps have more control over when billing happens, which should make it easier to set whether a purchase is a test or not.

In addition, we've also improved the exitiframe page so that it can redirect to Shopify addresses - I believe that was the root cause of the problem here. If you're using the template version of /exitiframe, you can use this code to allow going out to Shopify.

I hope this helps! Please let me know if you still have issues with payment on the latest versions.

paulomarg avatar May 03 '23 15:05 paulomarg