Shopify / Shopify/shopify-app-template-node

Request bill payment and if merchant decline payment till merchant still able to use App further

Open
#1,321 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1k
Forks
434
PR merge metrics
No merged PRs in 30d

Description

app.get(
shopify.config.auth.callbackPath,
shopify.auth.callback(),
// Request payment if required
async (req, res, next) => {
const session = res.locals.shopify.session;
console.log("session: ", session);
const hasPayment = await shopify.api.billing.check({
session,
plans: ['My App Charge', "Multiple LineItems Plan", "Starter"],
// plans: ['My App Charge', 'Starter'],
isTest: true,
});

console.log("hasPayment: ", hasPayment);
if (hasPayment) {      
  next();
} else {
  res.redirect(
    await shopify.api.billing.request({
      session,
      plan: 'Starter',
      isTest: true,
    }),
  );
}

},
// Load the app otherwise
shopify.redirectToShopifyOrAppRoot(),
);

I tried to implement app billing at the time of app installation for app billing and if the merchant declined merchant still able to use the application but It shouldn't .

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the auth callback route using shopify.config.auth.callbackPath and the billing.check/request calls shown in the issue. Trace the declined-payment path and verify how shopify.redirectToShopifyOrAppRoot handles it; done means a merchant who declines the requested plan cannot continue using the app.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.