#pratikco - test clocks

1 messages · Page 1 of 1 (latest)

kind latchBOT
wise dirge
#

Hey there

obtuse kestrel
#

Hi

#

what is the minimum period of time i can give free trial to

wise dirge
#

Yep so you can set trial_end to any timestamp you want

#

There is no minimum

#

Any timestamp in the future from the creation timestamp

obtuse kestrel
#

ohh ok got you means, subscription_data = {
trial_end : time_stamp
} like this right?
but what will be the format of timestamp?

wise dirge
#

It is a UNIX timestamp

obtuse kestrel
#

ok got it thanks

#

can you pls give me one example

wise dirge
#

Of a UNIX timestamp?

obtuse kestrel
#

yeah

wise dirge
#

To convert

#

Manually

#

To see what it would look like

obtuse kestrel
#

thanyou so much

wise dirge
#

Sure thing

obtuse kestrel
#

I am getting this error

wise dirge
#

Hmm that shouldn't be the case afaik

#

Can you drop me that request ID?

#

That is in the error

obtuse kestrel
#

req_gRjG5YWvxJUAvS

lime tundra
#

Hello! I'm taking over and catching up...

#

The error message on that request is accurate. The timestamp you specified is only about five hours from now, which is less than the minimum of two days required.

obtuse kestrel
#

actually i want to test if free trail code work or not

#

if i give min 2 days then i have to wait for 2 days to check if its working or not

lime tundra
obtuse kestrel
#

got it thanks

obtuse kestrel
#

when making a session to create payment I am not creating any customer, but in response from stripe I am getting a customer id I think stripe is creating it for me but the thing is whenever user stop the subscription and after some month he resumes it, do I need to use same customer id or no need

#

do you think I should store customer id of strip to customer table for use?

lime tundra
#

You should use the same Customer ID, yes.

#

Customers in Stripe are required for Subscriptions, and they're designed to represent your customers. Using them will make a lot of things easier, like keeping track of activity over time for a given person.

obtuse kestrel
#

ok got it, You are expert in it thanks

#

you from? cant we talk personal i guess

lime tundra
#

Not sure I understand?

obtuse kestrel
#

you from, I mean your country

lime tundra
#

I'm in the United States.

obtuse kestrel
#

oh ok and work for strie?

#

stripe?

lime tundra
#

Yep!

obtuse kestrel
#

ohh nice

#

can you please tell me how to create customer and pass it into payment session

lime tundra
#

When you say "payment session" are you referring to a Checkout Session?

obtuse kestrel
#

yep

lime tundra
obtuse kestrel
#

hey I didn't find any attribute to provide customer_id in payment session in this link

#

like customer_id : 232323723

lime tundra
#

What do you mean?

#

That link should take you to this:

obtuse kestrel
#

checkout_session = stripe.checkout.Session.create(
payment_method_types=["card"],
line_items=[
{
"price": price["id"],
"quantity": 1,
}
],
metadata={
"user_id": request.user.id,
"art_price": art_price,
"amount": amount,
},
mode="subscription",
success_url='http://127.0.0.1:8000/success' + "?session_id={CHECKOUT_SESSION_ID}",
cancel_url='http://127.0.0.1:8000/failed/',
subscription_data=subscription_data,

)

my code is like this, from that link I am not clear where to provide customer id details

lime tundra
#

You add it in the list of options you provide.

#

So you would add something like customer=customerID in there.

obtuse kestrel
#

I written a code for free trial successfully with your help, but
if event['type'] == 'checkout.session.completed': this event will not trigger for free trial session?

lament zinc
#

👋 I'm hopping in since rubeus needs to head out soon - I believe that event would still be triggered with a free trial. are you seeing otherwise?

obtuse kestrel
#

Hi I created one user and assigned 2-day free trial to it now I want to check what will happen after 2 days, to that particular user account can i check it?

lament zinc
#

What specifically do you want to check?

obtuse kestrel
#

after 2 days stripe will make payment from that account and it will trigger payment event on webhook so that my code will run in that event and user get some credit credited to their account, so I want to check will this work or not

#

should I explain it propely again?

lament zinc
obtuse kestrel
#

yeah, but I want to test this with this particular customer only which I just created and assign a trial trial to it, can I do it?

#

If I use clock I will get this option in which i have to add new user, But I only want to test with my one particular user which I create by my backend

lament zinc
#

Yeah with test clocks you can't add them to exisitng customers, you'd have to create the customer with the test clock from the start, and then use that customer in a checkout session

obtuse kestrel
#

yeah, so there is no way to check existing user

lament zinc
#

Correct - there is no way to use test clocks with an existing customer that does not already have a test clock

obtuse kestrel
#

ok thanks for letting me know