#snackdex
1 messages · Page 1 of 1 (latest)
Hello! No, not as described. You wouldn't create a Payment Intent in that scenario. Instead you would create the Susbcription and add a one-time payment to it using add_invoice_items: https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items
Then you can use the Payment Intent the Invoice for the first Subscription Period generates with the PaymentSheet.
is the invoice item field relevant only when it relates to the subscription?
in my scenario they are completely unrelated: purchasing a piece of candy and a membership subscription
The candy would show up as a separate line item on the Subscription's first Invoice, and would not show up again after that.
Typically add_invoice_items is used in scenarios like this, where the things you're adding are not part of the Subscription itself.
oh sweet!
so just to make sure i follow:
- front end makes a backend call to my api, sending the candy id and the membership subscription id that they want to purchase
- my api creates a stripe subscription and adds the piece of candy as an invoice item
- then what i get back from that i can pass it to my payment sheet? (and the total would include the subscription + the invoice items)
Yep, that's it in a nutshell.
You'll get back a Subscription, and you can expand latest_invoice.payment_intent to get to the Payment Intent.
awesome. thank you so much
Happy to help!