#jhonsalazer-subscription-elements
1 messages ยท Page 1 of 1 (latest)
Hi ๐ Card Element flows are typically built directly on Payment Intents, so you'll want to look into this flow that leverages our Tax Calculation API to incorporate tax calculations into your flow:
https://stripe.com/docs/tax/custom
Ah ok
Thanks!
I have other questions
How can do to relation product catalog with my connected account (seller in my paltform) ?
Can you elaborate on what you mean by that? If you're referring to associating a Payment Intent to a Price/Product object, that isn't supported by default and you would need to build custom functionality to achieve that. You would need to use a higher level object to leverage prebuilt associations with Price/Product objects (such as Subscriptions, Invoices, Checkout Sessions, Payment Links)
No, I have a lot seller with connected account, so When I create a product I woud like to associate product with connected account
You probably want to leverage metadata on the Payment Intent to add your own tracking information then:
https://stripe.com/docs/api/payment_intents/object#payment_intent_object-metadata
metadata is a field on most of our objects, and allows you to store information on Stripe objects that is important to your flows:
https://stripe.com/docs/api/metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes, but you're using a Card Element integration, right? Those use Payment Intents.
No no, I use checkout session for now
but this flow is independent of the checkout session, the product catalog is just crud, right?
so what i would like know how many product my seller has wiith id 1 , id 2, id 3, etc
no, payment, no checkout, no subscriptions
Sorry, still trying to grasp what you're saying. You want to count how many Products your Connected Account have?
I would like to know the inventory of the products through the connected account.
yes
Oh, then you list the Products for your Connected Accounts. Using this endpoint:
https://stripe.com/docs/api/products/list
and this approach to make the request for your Connected Account:
https://stripe.com/docs/api/connected-accounts
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, but my problem is in the time the create product how can I associate product with my connected account (seller ) ?
I need more details. Are you trying to create these Products on your Connected Accounts, or are you trying to create them on your Platform account with some way for you to know they are associated with a Connected Account?
I'm trying to create product on my Platform account, but I need to associate with a Connected Account (sellers)
Gotcha, that isn't a prebuilt concept. If a Product exists on your Platform, then in Stripe that Product is associated with your Platform. Since it sounds like you want to store custom data on an object for your own tracking purposes, it's a good time to look at metadata, but this time on the Product object.
ok, Thanks a lot! ๐
Any time!
I have other questions
I have connected acount "Fantasia y Amigos"
I see that I have availability to create a product in a connected account in the user interface.
How can I do the same with productcs API?
๐ stepping in here as toby needs to step away
You make requests on your Connected Accounts by using the Stripe Account Header. See: https://stripe.com/docs/connect/authentication
Sure thing
other question
I need to add shipping price in my subscription with payment intent with stripe element
how can I add shipping price, add 2 subscription with differents price same recurring ?
Yeah you would handle shipping as its own line item
In addition to that, I have to add the tax value
tax value is calculate in real time
how can I add de price when subsctipions has been created ?
๐ข
Not sure what you mean by all that, really. You can apply tax rates to a Subscription if you are calculating taxes yourself
I use stripe element
but to retrieve payment intent, fist I have to create subscription
because tax rate is calcuate in user interface when subscriptions has been credated in default_incomplete status
If you need to calculate while collecting the PaymentMethod and before creating the Subscription then you want the deferred intent flow: https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=subscription
ok, thanks
but I don't know how can I add the tax value ?
do need I create other price and add a new item line ?
You can either add a new line item or you can add the tax rate to an already-created line item
Up to you
do you have documentacion about this add the tax rate to an already-created line item ?
Basically you just use https://stripe.com/docs/api/subscriptions/create#create_subscription-items-tax_rates which I linked above and shows you the API parameter to pass your tax rate
Also, is there a reason you aren't using Stripe Tax?
Seems like that would solve a lot of headache here
Yes, I use Stripe tax rate api
When I call to tax rate api, the api return tax value, so the idea is send the value to backend and add new item line , is correct ?
Create a Tax Rate object and add that object to the line item, yes.
I was using Calculation api to calculate tax value
You mean you use a third party API?
no no, Stripe Calculation
so, I should to call calculation api and after call Create a tax rate with this value and attach a Line item ?
Oh you are already using Stripe Tax, but you don't need to do that separately at all when creating a Subscription
We handle that all for you
All you need to do is set automatic_tax.enabled: true
here. ?
.setAutomaticTax( SubscriptionCreateParams.AutomaticTax.builder().setEnabled(true).build() )
but I would like yo show the tax value to my customer before to do checkout button (before create subscription, payment intent, etc)
Yep that is the correct place. And to show the amount beforehand you use the Preview Upcoming Invoice endpoint: https://stripe.com/docs/api/invoices/upcoming
No
My use case is: When customer selected a product y choice a price motnhly (example) and client enter his address, the user interface should show him the tax value before the client acept the final price
so the client agree then will do click en checkout button and then I should create subscription wiht product price, shipping price and tax value price preview
it's similary to checkout session, checkout session to show you the tax value before you subscribe to product, right?
The idea is similary
Yes the above endpoint is exactly how you do that
Did you read the description there?
It literally creates a preview so you can show the customer the amount that they will be charged once you actually create the Subscription
If you use subscription_items and don't pass subscription with that endpoint then it simulates as if a new Subscription was created
I don't understand
๐ข
I need create 2 subscription ?
one to show and other to process real payment ?
it;s a bit durty this process
Using the upcoming Invoice API endpoint doesn't actually create a Subscription
It simulates as if one was created based on the details you input
Then it returns you a response with data as if an Invoice was created even though it wasn't actually created
That allows you to show a UI to your customer of what they will pay if they actually start a Subscription
Then, when they actually hit your "pay" button, you do actually create the Subscription
uhmm ah ok
but you shared me Retrieve an upcoming invoice
That seems to recover, not to create.
No, as I explained above, it will give you the response for a new Subscription if you don't input the subscription parameter when you use that endpoint
I'd recommend pausing and testing it out
That is really the best way to understand how this stuff works
I understand the idea but your explanation of HOW I don't understand it with this example
InvoiceUpcomingParams params = InvoiceUpcomingParams.builder().setCustomer("cus_NeZwdNtLEOXuvB").build(); Invoice invoice = Invoice.upcoming(params);
its imposible simulate all input calling this endpoint ...
it seems strange to me
its imposible simulate all input calling this endpoint ...
What does that mean?
What input does it not contain?
you said:
It simulates as if one was created based on the details you input
Yes. So you put your line_items in subscription_items for instance
my customer enter, debit card , address, product price, etc
Yep and there are parameters like customer_details for that
do you have example code to understand you ?
with this line:
InvoiceUpcomingParams params = InvoiceUpcomingParams.builder().setCustomer("cus_NeZwdNtLEOXuvB").build(); Invoice invoice = Invoice.upcoming(params);
I don't understand
No I don't think we have a full example code snippet of this. You as the developer need to be able to work with our API and try things out. The API reference can guide you on the necessary parameters and you can also look at our Java Class definitions via https://stripe.dev/stripe-java/allclasses-index.html if you need further specifics on those classes.
should I just completed to cuustomer detail ?
You should input things like the address you are collecting from the Customer into customer_details, yes.
ok, with this I could recovery de final tax value to show the UI to my customer
Yep
Ok, Thanks so much!
Sure thing
I use the api
It was very useful
I have other questions
Y need add diferentes method payment to my customer
I have a payment method list in my UI
Hi ๐
I'm stepping in as my colleague had to go.
How do I create a payment method for my client and after recovery automatically configure it when creating the subscription?
Okay so you have the UI that allows your customer to create a new payment method, correct?
Yes, to my shipping address also.
Are you using Setup Intents?
Yes, first I create a subscription with default incomplete status and recovery secret to send to my UI and checkout the subscription with stripe element
Sorry, does this subscription have a setup intent or a payment intent? Does it start with a free trial?
payment intent
Does it start with a free trial? --> No
it's to sell product no services
Okay so you are using a payment intent and collect the payment method when your customer pays the first invoice, correct?
Im using this link
Okay so in that case you have the Payment Method before you create the Subscription
That means you can either set it as the default payment method when creating the Subscription, or you can set is as the default on the Customer
Ok
but if my customer wants create other payment method in my UI (in other time), how can I create this ?
In that case you would use Setup Intents to save the Payment Method to your customer. You could use the same UI but with a Setup Intent. We describe this flow here: https://stripe.com/docs/payments/save-and-reuse
this documentation is to ubscription mode ?
becasue my flow is all subscription model
if my customer wants create other payment method in my UI (in other time)
To me, you were asking about customers creating new payment methods outside of the Subscription
in addition, I use stripe element to checkout flow
You can do that just fine.
.setMode(SessionCreateParams.Mode.SETUP)
You asked how to let customers save a new Payment Method, this is one way you can do that without charging them.
I used to use checkout session to create subscription flow
I'm confused
ohhh I saw
Yup! Using this the customer can save the card to their record
If you want to make it the new default card you would listen to the setup_intent.succeeded webhook event. That would have the ID of the Customer and the Payment Method so you could make the latest payment method the new default
If the customer wants delete... ?
You would need to implement something to do that, but it is possible
You would detach the payment method: https://stripe.com/docs/api/payment_methods/detach
Ohhh thanks a lot!
I have other question
In my marketplace the customer can choice a diferentes product with diferente recurring price
For example
Product 1 $10 weekly
product 2 $20 Monthly
so, in my UI (resume screen) How can I do create multiple subscriptions for one element card to diferentes recurring ?
following example
I should create subscription 1 $ 10 weekly and subscription 2 $20 monthly
You could not use the UI to automatically create multiple subscriptons. You would need to create the second subscription on your server, using the same Customer and Payment Method details from the first one
So the first subscription shoud create incomplete status, right? ...until the customer confirm payment
the second subscription I should create with other status? I should charge it directly
You would wait until the first subscription is active, then create the second one. That way you know you have a valid payment method
subscription is active and invoice paid event arrive, right ?
Sure you can use those
Sure thing, you too! ๐