#dbugger_best-practices

1 messages ยท Page 1 of 1 (latest)

cosmic oreBOT
#

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

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

hybrid pikeBOT
winter sparrow
#

Hello

languid acorn
#

Hello @winter sparrow , nice to meet you

winter sparrow
#

If you want to send a link out (like over email) then you want to work with Payment Links

#

Checkout Sessions and PaymentIntents are for when a customer would be on your website and in your checkout flow

winter sparrow
languid acorn
#

Yeah, well. I was looking at the example on how to use Payment Links

const paymentLink = await stripe.paymentLinks.create({
  line_items: [
    {
      price: 'price_1MoC3TLkdIwHu7ixcIbKelAC',
      quantity: 1,
    },
  ],
});

It seems like a Price ID is needed, but the users of my platform do not necessarily have their products/services listed in Stripe. It could be something as simple as an artist that made a particular painting, and wants to send the invoice to the buyer.

winter sparrow
#

Yeah you'll have to define a Price to represent the amount to charger. You can create that Price just before creating the Payment Link but it is required.

languid acorn
#

Mmm... isn't there a simpler way to do that? Something like (pseudo-code)

const {url} = stripe.easyPayment.create({
    amount: 123,
    description: "foo",
    currency: "usd"
})
winter sparrow
#

Sure you can do that if they are on your site in your checkout flow

#

But no, not to return a URL that you then send out

languid acorn
#

How then?

#

PaymentIntents?

winter sparrow
#

Yes you would use PaymentIntents if you build a custom flow (where you collect payment methods using Elements)

#

Or Checkout Sessions if you want to use our hosted checkout page

languid acorn
#

But with Checkout Session I also have to create a Price ID, no?

winter sparrow
languid acorn
#

I see. In any case, the Price ID is created. And I assume that this information is tracked by my account, no?

#

Because I wanted to stay completely out of the payment between my users and their clients

winter sparrow
#

I'm not sure exactly what you mean by that, but overall it sounds like you want to use Stripe Connect here with Standard Accounts and you would create the Prices and Checkout Sessions direclty on the Connected Accounts -- nothing exists on your platform in this case.

languid acorn
#

Yes, in my site I have a "Connect with Stripe" button, that gives me an Account ID, that is saved in the DB

stripe.accounts.create({ type: "standard" })

#

So basically, I was hoping that I could just create a payment link, assign it to the invoice, and just display it when the user sees the invoice

#

And storing as little data as possible of this transaction

#

since i want to stay out of it as much as possible

winter sparrow
#

You can create Invoices directly, which do come with a Hosted Payment Page as well

#

That would be another alternative here

languid acorn
#

Make it as direct as possible, between the user and his client

winter sparrow
#

But wasn't aware initially you wanted to use Invoices

languid acorn
#

Ah, no. Invoicing is the service I offer ๐Ÿ˜„

winter sparrow
#

Ah

languid acorn
#

My Saas is an invoicing system for small businesses and freelancers

#

LIke this (fake data)

#

So basically, I wanted to offer the possibility to create payment links, that the user could send to their clients via email

#

But the whole payment thing should happen directly between the user and his client

winter sparrow
#

How will they see that screenshot? Is that hosted on your site?

languid acorn
#

It is basically a website kinda like Xero

winter sparrow
#

Okay well yeah the best thing to do here is still use Payment Links. There are no limits on the amount of Prices nor Payment Links, so you basically are going to want to just create a Price with the corresponding value of the Invoice and then create a Payment Link for that Price.

#

That is really the only way to send out a URL like you are trying to do

#

All the other flows we provide (other than our own Invoicing product), expect the customer to be on your website in order to pay at that time.

#

Actually, I suppose the workaround would be for you to send out your own link in the email which then directs them to a payment page on your own site

#

That works too

#

And would not require a Payment Link

languid acorn
#

I would rather that the payment would be a Stripe checkout, since it inspires more trust to the buyer, than anything that I can design

#

I guess I will have to create Price IDs for them. Shame.

#

I wanted to avoid creating as many "db entries" as possible, to make my code as simple as possible ๐Ÿ˜›

#

But if it cant be helped, then it cant be helped

winter sparrow
#

Yeah as I said above there is no limit on Prices

#

So you don't really have to store them in your database if you don't want to

languid acorn
#

Can I create inline prices also with Payment Links? Or only with Checkout sessions?

winter sparrow
#

No, only Checkout Sessions. Payment Links are designed for a one-to-many use-case.

languid acorn
#

Anyway, I guess that answers my question!

winter sparrow
#

๐Ÿ‘

languid acorn
#

Thanks for your help, mate

#

๐Ÿซ‚

winter sparrow
#

Sure thing

languid acorn
#

Take care ๐Ÿ‘‹