#sp_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ 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/1340996627120521306
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
So, I have invoice host url for invoice payment, but it was not getting embed via iframe, and my clients want payment to be done within their app, rather that changing url and going to stripe. How should i tackle this? How can my clients application embed payment UI without dealing with stripe code?
Is it possible that if i host a UI for payment invoice by adding Stripe to React app, would the hosted UI be successfully embed into clients app via iframe?
yes it's not possible to embed the HIP https://docs.stripe.com/invoicing/hosted-invoice-page in an iframe
but you can easily use the underlying payment_intent.client_secret to validate the payment of the Invoice itself
you can read from this section https://docs.stripe.com/invoicing/integration?method=elements#create-invoice-code onwards
so is this solution possible:
You create a central payment UI (a web app using React/Angular/Next.js).
Clients embed your payment UI in an iframe within their app.
Your UI handles payments via Stripe Elements, keeping users inside their app.
Your backend creates a Payment Intent per transaction and sends it to your UI.
After payment, the result is sent back to the client app via postMessage or a redirect.
AFAIK Stripe Elements wouldn't work in an iframe
you need to generate the Stripe Element in their UI directly
so there is no way for embedding invoice payment into their UI, without making them deal with stripe UI?
ok.
and then your code, includes the Stripe.js code and creates the elements etc...
hi! I'm taking over this thread. let me know if you have other questions!
Hi soma, is it possible to pay stripe invocie using stripe api? not using Stripe Element in UI directly or using invoice host url but just using stripe api?
it depends. how do you plan to collect the payment method details exactly?
lets say payment method is card, so using form in UI we can collect card details.
so how are you collecting the card payment details? with Payment Element?
so i am trying to exclude using Stripe Elements, because they would not work in an iframe. So is it possible for me to host UI which make invoice payment using stripe api and my clients application can just embed this UI within their app?
Note Payment Element does work in iframes.
if you want to build your own UI to collect payment information, then your business has to be PCI compliant: https://stripe.com/guides/pci-compliance
So if i host a UI with Payment Element for invoice payment, and ask my clients to embed my hosted UI in their app via iframe, will it work for invoice payment?
yes.
Note- I am creating invoice for express connect account, I believe this won't be any issue
you mean you are creating the invoice directly on the Express account?
via stripe create invoice api for an express connect account
you mean you are using the Stripe-Account header to create the invoice directly on the Express account? https://stripe.com/docs/connect/authentication
if so, we strongly recommend not doing this, since Express account have no ability to manage refunds/disputes
instead you should use Destination Charges
that will create the invoice on the platform, and then automatically transfer some of the funds to the connected account
Stripe-Account header to create the invoice directly on the Express account: YES
so what the flow so far is: create invoice using collection method as send invoice, finalize it and then send it.
invoice = await stripe.Invoice.create_async(
customer=customer_id
auto_advance=False,
collection_method="send_invoice",
stripe_account=account_id
)
should we change our flow?
but i tried refund for express account, and it was working
don't use stripe_account. instead use this: https://docs.stripe.com/api/invoices/create#create_invoice-transfer_data
what you are currently doing is called a Direct Charge. what you should use instead, for Express accounts, is a Destination Charge.
you can learn more about all of this here: https://docs.stripe.com/connect/charges
ok
so we will make above changes, so as flow we are first creating invoice: stripe.Invoice.create_async, then invocie items: stripe.InvoiceItem.create_async, then finalizing it and sending it: stripe.Invoice.finalize_invoice_async and stripe.Invoice.send_invoice_async
other than usinf direct charges there is nothing wrong with invoice creation flow right?
yes seems correct to me
ok
Hi vanya, i have a final question that is for creating express connect account for business type company, i am using stripe.Account.create_async for account creation and stripe.Account.create_person_async for adding account representative details. Does this flow looks fine?
Are you running into any issues with it?
Happy to help. Let me know if you have any more questions, or run into issues with this approach.