#arielbo-subs
1 messages · Page 1 of 1 (latest)
hi karbi
Can you clarify? Are you just trying to find out the date/time a subscription has been created?
really the renew time
We provide all those timestamps on the Subscription object - you would just use the unix timestamp and covert it to a readable format to know the date + time (see https://stackoverflow.com/questions/10040291/converting-a-unix-timestamp-to-formatted-date-string)
yes I know about convert this, but please in which parameter or place I see the timestamp of one subscription created
sub_1JkGDkHHulAmiNnDp8sp9jp7 this is my id subs
maybe you can help me please
You said you wanted subscription renewal right?
yes
You can find when the subscirption will next renew at current_period_end
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
what happens is that I want to test the invoice.payment_succeeded event when the second payment occurs
Is this a new question, or is this still related to finding out the renewal time of the subscription?
related
this is the reason by which I need to know the datetime exactly of the 2nd payment
how can I see this parameter current_period_end ?
I see this event "id": "evt_1JkGEdHHulAmiNnDDu2OEuCp",
"object": "event", and not have current_period_end
That's because that's an Invoice event - current_period_end is only on the Subscription
them I will need to recovery subscription right?
$stripe->subscriptions->retrieve(
'sub_1JkGDkHHulAmiNnDp8sp9jp7',
[] ?
with some like this and I see this parameter current_period_end ? right?
Yes, you would have to retrieve the Subscription if you want to know it's next renewal date
please let me see a few minutes
or exist some place in your dashboard to see this data?
Yes, this information is also in the dashboard on the subscription but if this is something you need from your webhook handler you really should just be retrieving it through the API and checking from there
please in which place of dasborad I can see current_period_end please
You just view the subscription in the dashboard and it would show you the dates/times for the current period
Really I would suggest you take a step back and take some time to look through the API reference for Subscriptions and Invoices and also explore the dashboard
maybe is this?
No, it's at the top of the page right next to Current period
could you send me a screanshott and link please?
All you have to do is view the Subscription on the Dashboard - the screenshot you're looking at is from the "Upcoming Invoice" view
What is the question?
I need to know how can I program in php stripe api set default payment
this option
You set the default by updating the Customer and setting invoice_settings.default_payment_method to the Payment Method you want
thanks
I have subscriptions and single payment services, now I am implementing a cart, and I have the scenario of a client who could buy 1 subscriptions and 3 single payment courses, so I wonder if it would be correct and it is possible to charge the total to pay for the 3 services with payment intent?
and then using metadata with information from these three services, using the payment_intent.succeeded webook to create the subscription and enable the services?
You can add the one-off single payment courses to the subscription using add_invoice_items (see https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items)
You can see how to use this here: https://stripe.com/docs/billing/invoices/subscription#first-invoice-extra
That is to say, would you advise me to manage the cart with subscriptions for both single payment items and items with recurring payments?
It really is up to you - there are numerous ways of implementing the same thing in billing and I've already given a recommendation (add the one-off courses to the subscription). If you want to go down a different route that's also fine (you know your business requirements best)
I understand but I more confused, maybe you can give one guide more clear please, maybe if you can tell me the methods more frecuent to do a cart
thank you in advance
What aspect of that are you confused about?
Like karbi said, adding invoice items will accomplish what you want. Do you have a specific question or concern as to how that would work with your integration?
yes please, can I use only payment intent to do a cart ? even to do subscriptions? o always I will need to use subscription object?
A PaymentIntent makes sense for a cart of one-off items
For a cart including a subscription, adding the one-off items to the subscription's invoice would likely be simpler
yo understand me pompey
thank you, but with so many objects, events, parameters, etc. and on top of documents one really gets confused and sometimes a simple answer like the one you give me gives me more security to venture to program something in one sense or another
@scenic pewter that's totally fair but there are hundreds of questions a week in this channel. While we are doing our best to help everyone, it is important that you take the time to design your own application/architecture, think through potential limitations, test things with our API yourself and debug as a developer. Asking us questions is totally fine, we're here to help, but the clearer/concise the question is, the easier it is for everyone
I think I really would like to make the cart with the subscriptions object using this that you tell me about one-off items, please tell me how difficult this will be and if you can guide me in the attempt, I can do it now. (I already create subscriptions with one item but I don't know with many items, I don't know if it is more difficult, for example, I would need each item to have metadata)
I'll keep it in mind
We don't really understand what you are asking unfortunately. Your questions are often vague and mixing Stripe's API/vocabulary and your own so it's really hard to grasp right now. Subscriptions support having more than one price, subscriptions also support being created with one off extra items on the first invoice (see add_invoice_items). But your ask is unclear
Try to always clarify what you mean, it might take a few minutes for you to try and summarize but it also helps you organize your thoughts and maybe give a clear example at the same time. Something like "I sell a monthly box of chocolate you can order for $15.99 but you can also order extra chocolate on the first order and I want to show how to order 2 extra chocolate on top of the monthly box" or whatever you're building. But you do have to do that leg work on your end
Thanks for the advice, I'm going to really take into account a lot of what I learned so far, it was for your help.
Thanks a lot for listening to the feedback! Now with that in mind, did my example above match what you were trying to do?
You should see the Subscription as the "attempt to pay" so it isn't really a "cart" that you modify over time as the user shops. That logic is something you build yourself in your system and when the customer is ready to pay you create their Subscription so that we create their first invoice and charge them (or they pay client-side).
This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Hello!
Hi! What's your question?
I have about 40,000 products, most of them one-time payment and others are monthly or annual subscriptions, and I don't want to create these products in stripe. For this reason I don't want to use subscription object or stripe checkout but rather payment intent api.
Now I would like to know if I can use payment intent object api to sell these two types of products in a cart, do you understand me?
or maybe need more context, please feel free to ask me more details to help me more
We strongly recommend you use Stripe Subscriptions for recurring payments. You don't have to create every Product and Price in Stripe ahead of time, you can specify the details when you create the Subscription using this API: https://stripe.com/docs/api/subscriptions/create#create_subscription-items-price_data
Does that solve the issue of not wanting to create the Products and Prices up-front in Stripe?
I imagine creating the cart with the products selected by the customer with a single payment intent that contains the total amount paid for all the services, both single payment and subscriptions, but I wonder if with paymentintent I could charge recurringly.
let me see
Payment Intents alone do not support recurring payments. You can use them for recurring payments based on a recurring payment system you build on your end, but that is not recommended.
why is not recommended?
I can think of an alternative, pay attention please, could I create a subscription from a successful payment.intent?
Several reasons: recurring payments need to be properly identified as such when processing to avoid declines, which our Subscription system handles for you. Our Subscriptions system also has a huge amount of work put into it to handle things like prorations, cancelation, reliable recurring payments, Invoices, and a lot more.
could I create a subscription from a successful payment.intent
No, that's not how Payment Intents or Subscriptions work.
Subscriptions generate Invoices, and Invoices generate Payment Intents. Payment Intents are a low-level object designed to capture a single payment. You can use them directly to capture a single payment, but that's all they do.
yes is its a good service
To put it another way, you can think of these objects like this:
Subscriptions handle the mechanics/scheduling of recurring payments
Invoices handle several line items, record keeping, and other details for a specific payment (like a monthly payment for a Subscription)
Payment Intents handle collecting a single amount of money from a method of payment
Payment Intents alone have no concept of multiple line items, taxes, recurring billing, etc. All they do is collect one specific amount (the total) from a method of payment.
If you want to use your own recurring billing system instead of Stripe Subscriptions you can, but it's going to be a lot harder, take a lot more time, and you'll probably run into several unforeseen problems along the way.
With this explanation you understand your system better, I ask assuming that I already have the payment through payment intent, can I create a subscription and its invoice that have the first month paid?
On the other hand, if you use Stripe Subscriptions, we take care of a ton of things for you so you can focus more on your own business rather than building a recurring billing system.
assuming that I already have the payment through payment intent, can I create a subscription and its invoice that have the first month paid?
That's not how Stripe works. You can create a Customer object in Stripe, attach a Payment Method to that Customer, and then you can reuse that Customer/Payment Method combination for future payments. Those future payments can be one-off Payment Intents or Subscription payments.
Does that make sense?
At this moment I use and have develop stripe subscriptions without a cart for recurrente services and in separate payment.intent api to one time services, and I know is subscription is better have many advantages, my problem is when I try develop a cart with a mix of products and in with stage enable subscriptions
What specific problems are you having?
In your experience, the creation of the Customer / Payment Method for future payments combination and of course the creation of the subscription, could I do it when I listen to an event in the webhook?
At this moment I have a cart for example with this products:
- service A. ebook 1 0 USD one time payment
- service B. course 20 USD one time payment
- service C. subscripcion a month to software x 50 USD recurring payment
Total price: 80 USD
Button PAY: 80 USD
got this far, now I have these ideas in mind:
give a few secs to write good please
You can do that with add_invoice_items when creating the Subscription: https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items
So you would create a Subscription for the $50 recurring payment, then add the $10 and $20 as one-time payments that would show up on the first Invoice.
ok now I have the ideas,
got this far, now I have these ideas in mind:
-
create a payment intent and collect the 80 USD, and in metadata save a json with the order data, that is, of each product sold, and then enable the services by listening to the payment.intent.success event but here I am concerned about how it could create subscription for service C.
-
create a super subscription that has all these products but I don't want to create the 40,000+ products and their prices, nor do I want them to be saved in stripe, because they are dynamic and increase every time.
Do you understand how confused I am? and i got stuck so i want to move in the right direction to program
in this case the products 10 $ us and 20 $ us will be created automatically in stripe? or do I need to previously create them?
You do not need to previously create them, you can specify the Price and Product data inline when you make the request using add_invoice_items.price_data: https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items-price_data
Actually, you would need to create the Product ahead of time, but not the Price.
you can specify the Price and Product data inline really? if so then this would be the best practical solution
In other words, who would have to create generic products without price: 1. ebooks and 2. courses? and then inline put the price?
So you would create Products ahead of time in Stripe for "Software A", "Ebook B", and "Course C". Then, when creating the Subscription, you can specify dynamic prices and reference the Product IDs. The Products only need to be created once and can be reused many times with dynamic Prices.
this make sense for me
thanks for your patience Rubeus
well maybe you have some docs or tutorial to do some like this or just I read more this https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items-price_data
Just to confirm, in this solution scenario, I would believe that subscription service C would be charged recurring month to month while services A and B only once, correct?
That's correct, yep.
You would specify the Service C as a recurring Price in items.price_data when creating the Subscription: https://stripe.com/docs/api/subscriptions/object#subscription_object-items
A and B would be specified in add_invoice_items.price_data as one-time payments that will be included on the first Invoice the Subscription generates: https://stripe.com/docs/api/subscriptions/create#create_subscription-add_invoice_items
⭐ arielbo-subs
thank you rubeus you are the best, let me know how can I check this chat again? or maybe you can send me to my email
We can't send this chat to your email, but this thread will stay here. If it's archived you can still access it using the thread interface in Discord. You can also copy and paste the info you want to save or take screenshots.
ok. why your are put a start in this thread?
I wanted to indicate to my teammates that this thread should remain open for a while in case you have followup questions.
thank you, now I program this solution please remain open maybe I need some help to do this project
you have a lot of patience and you know how to listen and that is wise, just like your colleagues who guided me on how to present a problem and ask more structured questions
We won't keep the thread overnight, but at least we'll try to keep threads ongoing throughout the day.
Let us know when you have resolved an issue too and in that case we can archive (we won't keep it for weeks)
You're welcome to ask more questions, I'm here for a while and I'll archive at the end of my day. There are way too many threads a day to keep them all open unfortunately, but we can try to not archive too quickly when you're still talking to us
thank you in advance to all team
like this:
$subscription = $stripe->subscriptions->create([
'customer' => 'cus_123',
'items' => [[
'price_data' => [
'unit_amount' => 5000,
'currency' => 'usd',
'product' => 'prod_456',
'recurring' => [
'interval' => 'month',
],
],
]],
]);
is correct ?
@scenic pewter have you tried? Like did you run that code, check the subscription in the Dashboard, confirmed it's what you want, etc.?
not yet
Please, try your code first before asking us! We can help you debug if you're stuck but you can't share every line of code for our review, it's just faster to run the code
But really you should be creating your product/prices upfront in the Dashboard and use those prices instead of price_data