Closed lgs closed 3 years ago
I've been unable to reproduce this. Can you share your environment and which test cards you're using?
Other that previous bug report "System information" the environment is subscription-use-cases/fixed-price-subscriptions in the Node server with this .env:
mem@basenode:~/STRIPE/subscription-use-cases/fixed-price-subscriptions/server/node$ cat .env
# Stripe keys
STRIPE_PUBLISHABLE_KEY=pk_test_NEtUxxxxxxxxxxxxxxxxxxxxxxx
STRIPE_SECRET_KEY=sk_test_3xiExxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
STRIPE_WEBHOOK_SECRET=whsec_PxhRxxxxxxxxxxxxxxxxxxxxxxx
# Stripe key for React front end
REACT_APP_STRIPE_PUBLISHABLE_KEY=pk_test_NEtUxn2GukTvS4vjHGlns2qn
# Billing variables
BASIC=price_0IZYyQ5gXfqfp2ceebNDb3AF
PREMIUM=price_0IZZ045gXfqfp2cerU6PpFMw
# Environment variables
STATIC_DIR=../../client/vanillajs
my current package.json (after pulling your last commit 8567a88865):
lsoave@basenode:~/STRIPE/subscription-use-cases/fixed-price-subscriptions/server/node$ cat package.json
{
"name": "subscriptions-with-fixed-prices",
"version": "1.0.0",
"description": "A Stripe sample implementing cards for subscriptions with fixed prices.",
"main": "server.js",
"scripts": {
"server": "node server.js",
"reactClient": "cd ../../client/react && npm start",
"startReact": "concurrently \"npm run reactClient\" \"npm run server\"",
"startVanillajs": "npm run server",
"start": "npm run server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "stripe-demos",
"license": "ISC",
"dependencies": {
"autoprefixer": "^9.7.6",
"body-parser": "^1.19.0",
"concurrently": "4.1.2",
"cookie-parser": "^1.4.5",
"dotenv": "^8.0.0",
"express": "^4.17.1",
"postcss-cli": "^7.1.1",
"stripe": "^7.4.0"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^2.1.2"
}
}
I used both the example test card: 4242424242424242 here the result:
lsoave@basenode:~/STRIPE/subscription-use-cases/fixed-price-subscriptions/server/node$ npm start
> subscriptions-with-fixed-prices@1.0.0 start
> npm run server
> subscriptions-with-fixed-prices@1.0.0 server
> node server.js
Node server listening on port http://localhost:4242!
(node:64670) UnhandledPromiseRejectionWarning: Error: Invalid status: must be one of active, past_due, unpaid, incomplete, incomplete_expired, or trialing
at Function.generate (/home/lsoave/STRIPE/subscription-use-cases/fixed-price-subscriptions/server/node/node_modules/stripe/lib/Error.js:52:16)
at IncomingMessage.<anonymous> (/home/lsoave/STRIPE/subscription-use-cases/fixed-price-subscriptions/server/node/node_modules/stripe/lib/StripeResource.js:168:39)
at Object.onceWrapper (events.js:420:28)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1223:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:64670) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:64670) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
and the test card that requires SCA: 4000002500003155 here the result:
(node:64670) UnhandledPromiseRejectionWarning: Error: Payment for this subscription requires additional user action before it can be completed successfully. Payment can be completed using the PaymentIntent associated with `subscription.latest_invoice`. Additional information is available here: https://stripe.com/docs/billing/subscriptions/overview#requires-action
at Function.generate (/home/lsoave/STRIPE/subscription-use-cases/fixed-price-subscriptions/server/node/node_modules/stripe/lib/Error.js:50:16)
at IncomingMessage.<anonymous> (/home/lsoave/STRIPE/subscription-use-cases/fixed-price-subscriptions/server/node/node_modules/stripe/lib/StripeResource.js:168:39)
at Object.onceWrapper (events.js:420:28)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1223:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
(node:64670) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
Okay thanks. We'll need to dig in. It seems like it might be related to the very old API version (2013-02-13) used for those requests. One improvement would be for the version to be explicitly set to latest in the sample.
I've just pushed a commit: https://github.com/stripe-samples/subscription-use-cases/commit/c6c3e406831c82e67a2f8fc1257cf8a4398233a2
Can you try that to see if that's the issue?
It looks now it has an Express dependency and I get Error: Cannot find module 'express'
but after installing Express npm i express
it works !
Both with 4242424242424242 and SCA: 4000002500003155
Okay cool. Thanks for the update, @lgs!
Bug report
Subscription process hangs forever. In the browser I see:
Describe the bug
The
npm run start
return the followingTo Reproduce
Just follow the official README
Expected behavior
Working REAME
Screenshots
If applicable, add screenshots to help explain your problem.
System information