How do you create Stripe Invoices through API

Hi,

I have been working for days on trying to work out the best way to go about accepting payments for my setup. Initial had a custom checkout cart and users entered the credit card details and payment was received through stripe and that process worked (apart from not being able to display errors).

But I stuck! I prefer all payment entry etc to be handles on Stripe side. We have projects that users can pay for, but they need to have an invoice sent to them for tax purposes.

The projects are created dynamically on our DB.

I am thinking now maybe Stripe Invoices is the better way to go for this scenerio?

I have a button on the App front end and links to the stripe Server Action below.
No output is generated and I am not sure why? I have put same data in first for testing.

Can anyone assist and see where I am going wrong?

I have replaced the customer id with a test one on Stripe cus_Lb########.

There’s probably 10 different ways you can approach this in Stripe but I think the payment link approach is most like what you need. This involves creating payment links with the API, using a generic product description and create a price specifically to each customer for their selection of services.

https://stripe.com/docs/payments/payment-links/api

**I would seriously advise using the Stripe API directly with API actions (curl,POST/form) instead of Wappler’s wrappers - it’s actually much simpler and more flexible - and there’s only two calls required. **

STEP 1.
Create a generic product description and product_id in Stripe UI (“Your selection”)

STEP 2
https://api.stripe.com/v1/prices
Creates a price_id for your product selection. You do this for every customer’s basket of products - one final price link URL per customer is required in each case:

STEP 3
https://api.stripe.com/v1/payment_links
Create a payment link for this price_id

The _link is a stripe URL (api.data.url) you provide to your customer for fulfilment.

1 Like