#literatelapellabel_code
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- literatelapellabel_best-practices, 1 hour ago, 16 messages
- literatelapellabel_webhooks, 5 days ago, 27 messages
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1247881929483751495
đ Have more to share? Add details, code, screenshots, videos, etc. below.
hi there!
have you read this link? https://docs.stripe.com/security/guide#content-security-policy
Yes, however the docs for a stripe app suggest that it can communicate with stripe APIs out of the box, as do the example apps on github
hum... can you share the exact error message you get?
App.tsx:24 Refused to connect to 'https://api.stripe.com/v1/account' because it violates the following Content Security Policy directive: "connect-src http://localhost:* localhost:*".
This is previewing an app, that was uploaded via the stripe cli
Please share the full manifest and the code where you initialise stripeApi
import stripe from "stripe";
const stripeApi = new stripe(
"sk_test_51ODFpKC1cjgvLQaL6YWdXYLrqDWuIJ9YrWLPBjrB6xb765fwOg0UZkkXFofUyKhj8afWGxXMIsPvuLpjzBcG9Sx600TBdm8QA4",
{
apiVersion: "2023-08-16",
}
);
{
"id": "ai.hudson.install-webhooks",
"version": "0.0.1",
"name": "Webhooks Example App",
"icon": "",
"permissions": [],
"ui_extension": {
"views": [
{
"viewport": "stripe.dashboard.drawer.default",
"component": "App"
}
],
"actions": [],
"content_security_policy": {
"connect-src": null,
"image-src": null,
"purpose": ""
}
}
}
To clarify, you're making that call from the React code not some backend you've built?
yes, in App.tsx I'm attempting to fetch the user email, and for now just display it in the drawer
Longer tem, I want to check my own backend, if that email is registered but for now I jsut want to be able to fetch it
I think it may be an issue with how you're initialising the Stripe client, specifically you need to pass the httpClient param:
import {createHttpClient, STRIPE_API_KEY} from '@stripe/ui-extension-sdk/http_client';
import Stripe from 'stripe';
const stripe = new Stripe(STRIPE_API_KEY, {
httpClient: createHttpClient()
})
That yields
Argument of type '{ httpClient: StripeAppsHttpClient; }' is not assignable to parameter of type 'StripeConfig'.
Property 'apiVersion' is missing in type '{ httpClient: StripeAppsHttpClient; }' but required in type 'StripeConfig'
Is it possible I have the incorrect version of stripe dependency? curernt is "stripe": "^13.4.0"
What is the actual code you used?
import {createHttpClient, STRIPE_API_KEY} from '@stripe/ui-extension-sdk/http_client';
import Stripe from "stripe";
const stripeApi = new Stripe(STRIPE_API_KEY, {
httpClient: createHttpClient()
})
Apologies if this is frustrating for you, I really appreciate the support
Hmm, that's just a TS error I think? Code should be fine
You can just pass apiVersion to the config has to silence it (like you were)
Thank you, I'm now getting perms error which I can sort but it is making valid request
Yes you'll likely need to update app manifest: https://docs.stripe.com/stripe-apps/reference/permissions
connected_account_read