D
Deno

help

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

Wwedman10/24/2023
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
DAHDeno AI Helper10/24/2023
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. 🦕
Kkrml10/25/2023
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
Wwedman10/25/2023
Thank you for your answer! I made it work this morning using https://esm.sh/stripe@14.1.0

Looking for more? Join the community!