wedmaniac
wedmaniac•15mo ago

How do I import the stripe SDK into my fresh.js project

Hi there! How do I import the stripe SDK into my fresh.js project? Im struggling with my deno.json file and how to initialize the SDK in a typescript file
3 Replies
Deno AI Helper
Deno AI Helper•15mo ago
I'm sorry, but the documentation does not provide specific information on how to import the Stripe SDK into a Fresh.js project. However, I can provide some general advice on how to import modules in Deno, which Fresh.js is built on. In Deno, you can import modules directly from URLs. For example, if the Stripe SDK was available at a certain URL, you could import it like this:
import * as stripe from "https://url-to-stripe-sdk/mod.ts";
import * as stripe from "https://url-to-stripe-sdk/mod.ts";
However, please note that this is a general way of importing modules in Deno and may not apply directly to the Stripe SDK as the documentation does not provide specific information on this. As for the deno.json file, it's used to configure your Deno project. You can specify compiler options and import maps in this file. For example, if you're using JSX in your project, you can specify the JSX compiler options like this:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "https://esm.sh/preact"
}
}
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "https://esm.sh/preact"
}
}
Again, this is a general example and may not apply directly to your use case with the Stripe SDK. If you're having trouble, it might be helpful to check the Stripe SDK documentation for any Deno-specific instructions, or to ask for help in a community forum or on a site like Stack Overflow. 🦕
krml
krml•15mo ago
You might have a look at the saaskit project. We use stripe as a payment provider there. It is imported in the deno.json via a npm import: https://github.com/denoland/saaskit/blob/main/deno.json How it is then implemented you can find here: https://github.com/denoland/saaskit/blob/main/utils/stripe.ts
wedmaniac
wedmaniacOP•15mo ago
Thank you for your answer! I made it work this morning using https://esm.sh/stripe@14.1.0

Did you find this page helpful?