#plark_best-practices

1 messages ¡ Page 1 of 1 (latest)

south sandBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1262365101114265630

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

true laurelBOT
#

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.

light sundial
#

Can you share the code you're using the initialise Stripe.js and the Express Checkout Element

keen field
#

This is server-side:
const functions = require("firebase-functions/v1");
const stripe = require("stripe")(process.env.KEY3);
const express = require("express");
// const bodyParser = require('body-parser');
const cors = require("cors");
const app = express();
app.use(cors());
app.use(express.json());
app.post("/create-intent", async (req, res) => {
try {
const intent = await stripe.paymentIntents.create({
amount: (+req.body.quantity * +req.body.price * 100),
currency: req.body.currency,
});
res.json({client_secret: intent.client_secret});
catch (error) {
console.error("Error creating payment intent:", error);
res.status(500).json({error: "Failed to create payment intent"});
}
});
exports.app = functions.https.onRequest(app);

#

This is client-side:
const stripe = Stripe(pkTEST);
const appearance = { }
const options2 = {
buttonHeight: 50,
layout:{
overflow: 'never'
},
}
const elements = stripe.elements({
mode: 'payment',
amount: 250,
currency: 'aud',
appearance,
})
const expressCheckoutElement = elements.create('expressCheckout', options2)

#

is this useful?

light sundial
#

Can you share a pi_xxx ID

keen field
#

What is that?

#

/where do i find it?

light sundial
#

It'll be in the intent response of this call:

      amount: (+req.body.quantity * +req.body.price * 100),
currency: req.body.currency,
 });```
keen field
#

Sorry for so response

light sundial
#

You don't seem to be using Connect from what you've shared, so the original link you shared is irrelevant

keen field
#

const paymentMethodDomain = await stripe.paymentMethodDomains.create({
domain_name: 'example.com',
});

Is it this line?

#

Is my server side supposed to have that?

#

I thought i'd otherwise verified the domain for apple pay (e.g uploaded the merchant id)

light sundial
light sundial
#

(if you share some kind of object ID from your account I can check all of this)

keen field
#

Hm. OK, so assuming I have uploaded the apple-developer-merchantid-domain-association file and got the domain registered (I can share a screenshot of the verified page if helpful) - is there naything else it could be?

#

In the stripe dashboard, in the payment method domains, if I filter by 'verified' in Apple verification, my domain remains in the list

#

I may check it doesn't have anything to do with using a test key

#

thanks

light sundial
#

As I said, if you can share an object ID or your account ID I can probably tell you the exact issue

#

Right now I'm just guessing based on limited info

keen field
#

here is the account id: acct_1PRBdZHbz90rWyEA

light sundial
#

And the domain where Apple Pay doesn't load?

keen field
#

hmm interesting

#

(but this stripe error shows on the live site as well)

light sundial
#

In which case you need to use a tunnel like ngrok so your localhost is actually accessible for Apple to verify and you can upload the files to that 'server'

light sundial
#

I see no recent live API activity on acct_1PRBdZHbz90rWyEA

#

So I guess you have a different account in live mode or some kind of Connect setup

keen field
#

A different account in live mode. Damn, this is getting complicated

#

'complicated' may not be the right word

light sundial
#

I'm just guessing, only you really know if that is the case

#

But as I said there's no live API requests on the account denoting activity on the 'live site' like you said

keen field
#

ah, perhaps that's because there test keys are still in the code.

#

i mean on the live site, but still using the test keys still

#

(i'm going to have to suspend this shortly unfortunately)

#

thank you for your help so far

light sundial
#

What's the 'live' site domain?

#

I can see that irkle.co is unverified with Apple Pay in test mode