Karim Ahmed
Karim Ahmed
Explore posts from servers
CDCloudflare Developers
Created by Karim Ahmed on 7/11/2024 in #workers-help
Issue Integrating Stripe with Cloudflare Workers: Script will never generate a response
I’m encountering an issue while integrating Stripe into my Workers project. Everything works perfectly in my local environment, where I can create Stripe checkout sessions and access the billing portal through an API endpoint that returns the URL for Stripe checkout. However, upon deployment to Cloudflare, sometimes I receive an internal server error with the message that the script never generates a response and sometimes it just works. I’ve tried using both the Stripe SDK for Node.js and direct API calls, but both approaches result in the same error. Here are the code snippets I’ve used: Direct API Call:
const response = await fetch('https://api.stripe.com/v1/billing_portal/sessions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.STRIPE_SECRET_KEY}`,
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
customer: stripeId,
return_url: returnUrl
})
});
const response = await fetch('https://api.stripe.com/v1/billing_portal/sessions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.STRIPE_SECRET_KEY}`,
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
customer: stripeId,
return_url: returnUrl
})
});
Stripe SDK
await stripe.billingPortal.sessions.create({
customer: stripeId,
return_url: fullUrl,
});
await stripe.billingPortal.sessions.create({
customer: stripeId,
return_url: fullUrl,
});
The same issue occurs when creating a checkout session. Has anyone faced a similar issue or have any ideas on how to resolve this? Any help would be greatly appreciated!
4 replies
RRailway
Created by Karim Ahmed on 10/31/2023 in #✋|help
Deploying Django with celery, celery beat and channels
I was trying to deploy a Django project that uses celery and channels, I have tried different Procfile commands and i can't get the server and celery work at the same time
i used this command and only the celery worked and the djagno project didn't
web: celery -A project worker --pool=solo -l INFO & celery -A project beat -l INFO & daphne -b 0.0.0.0 -p $PORT project.asgi:application
6 replies
RRailway
Created by Karim Ahmed on 5/22/2023 in #✋|help
How to cancel Credit-based subscription
I subscribed to a credit-based plan by mistake, and I want to change it to a developer plan, but I can't do this when I hit manage plan I get that I have to pay my billings that I didn't use. so how to change my plan to a developer plan in which I pay for what I use?
16 replies