#mboras_api

1 messages ยท Page 1 of 1 (latest)

timber mangoBOT
#

๐Ÿ‘‹ 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/1370089509819121714

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

visual goblet
#

?

rich vessel
visual goblet
#

sec to check

#

do I have to have stripe customer id for invoices, since I don't have that

These are one time payments where some users haven't even used stripe ever before in my app

#

so my requirements are:

  • I'll send to user via email CTA to pay for reservation 10days before reservation and I would love that link to work 7 or 8 days from when it is created
  • User can't kill that link somehow going in checkout (or whatever) and cancelling it
  • I'll send reminder 5days before and 3days before
  • If user doesn't pay 2 days before reservation I'll kill that link/checkout or whatever

NOTE:

  • One-time payment
  • My users are not stripe customers and most of them are guests

I am looking at the options:

  • checkout
  • payment links
  • now you mentioned invoices

What is the best option here?

rich vessel
#

If it were me, I'd likely use Invoicing. If there are fixed prices, you could use Payment Links. You could also just have a link in your email to a Checkout implementation on your site.

Any of those would work.

visual goblet
#

There won't be fixed prices so I'll kill that option.

I am lazy to implement checkout on my website, I like stripe checkout hahaha

Is it possible to have CTA in my email that triggers my function on backend that will return session url and navigate user to that url so that CTA will always work?

#

Also another q:

  • can Invoicing work without having customer_id?
rich vessel
#

I'm not saying implement your own checkout, I'm saying use Stripe Checkout on your website, and send your customer a link to that URL in the email.

Invoicing does not work without a Stripe Customer object, no. Why do you not want to create a Customer object?

visual goblet
#

aaah I understand. And then click on that CTA will lead user to my website where they'll have PAY CTA that will generate checkout session. Nice solution.

I'm also thinking about something like this, so user doesn't even have to go to my website

export const generateCheckoutLinkTesting = region('europe-west2').https.onRequest(
(req, res) =>
cors({ origin: true })(req, res, async () => {
try {

    // Generate a new Checkout session
    const domain = getDomain();
    const session = await stripe.checkout.sessions.create(
      {
        mode: 'payment',
        line_items: [
          {
            price_data: {
              currency: 'eur',
              product_data: {
                name: 'Booking Payment',
                description: `Booking ID: ${'test'}`,
              },
              unit_amount: 50 * 100, // Convert to cents
            },
            quantity: 1,
          },
        ],
        success_url: `${domain}`,
        cancel_url: `${domain}`,
        metadata: {
          bookingIds: JSON.stringify(['test']),
        },
        allow_promotion_codes: true,
      },
      { stripeAccount: 'acct_1Ogwc8D1yapNytkY' },
    );

    console.log('Session created', JSON.stringify(session, null, 2));
    console.log('Session URL', session.url);
    if (!session.url) {
      return res.status(500).send('Error generating payment link');
    }

    // Redirect the user to the Stripe Checkout URL
    return res.redirect(session.url);
  } catch (e) {
    console.error('Error generating payment link:', e);
    return res.status(500).send('Error generating payment link');
  }
}),

);

#

Invoicing does not work without a Stripe Customer object, no. Why do you not want to create a Customer object?

  • I don't want to create customer since my app is stripe connect platform where users will pay to different stripe connected accounts and I am passing in all requests stripeAccount (acct_xxx). That means if I have one user that has paid to 4 different connected accounts, I'll have to create 4 customers for him and store in my db 4 his customer ids for different connected accounts?
rich vessel
#

Checkout Sessions expire in 24 hours so you can't pre-generate one - you just need something in the URL that lets your server side code get the details it needs for that particular checkout - does that make sense?

#

What made you choose direct charges here? What type of Connected Accounts are you using?

visual goblet
#

Yeah, I'm thinking to send in PAY NOW CTA in email url like <a
href="https://YOUR-FUNCTION-URL/generatePaymentLink?bookingId={{bookingId}}"

Then this function above will be called and user will be redirected to checkout. Like that I'll always have good checkout link in email right?

What made you choose direct charges here?

  • I don't understand question good here, can you please elaborate? These are one time payments for bookings and I have already webhook that has logic for checkout.session.completed and that's the reason why I want checkout
  • Standard connected accounts are all of them right now
rich vessel
#

Right, that will work as long as your app has a handler for that URL.

If they're all Standard Accounts, then direct charges make sense. ๐Ÿ™‚

visual goblet
#

nice

#

sorry for little late reply didn't see your answer

#

tnx for your help @rich vessel

rich vessel
#

Of course - you're welcome! ๐Ÿ™‚