#literatelapellabel_code

1 messages ¡ Page 1 of 1 (latest)

sharp adderBOT
dense swanBOT
#

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.

sharp adderBOT
#

👋 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.

remote oracle
#

hi there!

rose bloom
#

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

remote oracle
#

hum... can you share the exact error message you get?

rose bloom
#
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

nimble raptor
#

Please share the full manifest and the code where you initialise stripeApi

rose bloom
#
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": ""
    }
  }
}
nimble raptor
#

To clarify, you're making that call from the React code not some backend you've built?

rose bloom
#

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

nimble raptor
#

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()
})
rose bloom
#

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"

nimble raptor
#

What is the actual code you used?

rose bloom
#

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

nimble raptor
#

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)

rose bloom
#

Thank you, I'm now getting perms error which I can sort but it is making valid request

nimble raptor
#

connected_account_read