#Marroco - client secret

1 messages ยท Page 1 of 1 (latest)

rapid scaffold
#

Are you referring to the PaymentIntent client secret? A payment intent isn't generated when you create a sub with a trial because the first invoice is $0

fleet moth
#

oh ok, so in order to make a checkout form so the customer can put the credit card information and give them a trial

#

how can I do that

#

do I need tyo creater a subs

rapid scaffold
fleet moth
#

sorry so

#

when I create a subscription with the customer id and trial this is going to give me a setupintent id

#

so from that I can get the client secret?

#

or I need to create first setup intent and then send it to the subcrition

#

so it will retrieve me a client secret

rapid scaffold
#

Creating a sub with a trial creates a setupintent, which will be visible in the above field on the sub

#

Then you can use its client secret

fleet moth
#

thanks!

#

hey bro quick thing so I screate sub with trial then I retrieve the setuopintent so I have the client secert

#

and send that to the checkaout

#

I put the credit card but it bounce with this error No such payment_intent: 'seti_1LQtV2BHYS6r19T04BvbeLev'

rapid scaffold
#

Since it's not a payment intent

fleet moth
#

sorry instead of what method

#

this is the snipped of my code and part was copied from stripe checkout

rapid scaffold
#

instead of confirmPayment

#

You're not confirming a payment

#

You're confirming a setupintent

fleet moth
#

how can I tranform my paymentElement to a Card Element

#

or I need to use another UI insted of the checkout UI?

rapid scaffold
#

You can use the payment element for this. There's no need to switch to something else

#

Or would you rather use something else?

fleet moth
#

no, I would like to stay with the same UI

rapid scaffold
#

Yeah PaymentElement works with SetupIntents

fleet moth
#

but when I take out the confirmPayment and use the other

#

const {error} = await stripe.confirmCardSetup(triggerpayment['clientSecret'], {
payment_method: {
card: paymentElement,
billing_details: {
name: 'Jenny Rosen',
},
},
})

#

like this it shows me this error (index):1 Uncaught (in promise) IntegrationError: Invalid value for confirmCardSetup: payment_method.card was payment Element, which cannot be used to create card PaymentMethods.

rapid scaffold
#

Sorry I think I might have sent you the wrong link

#

My bad

#

Shows exactly how to use the Payment Element with SetupIntents

fleet moth
#

Thanks it works

#

one more question

#

I see that the only way I can see in the dashboard if the customer make the trial subscription is if I go inside the customer and see the purchases

#

there. isanother way?

#

because in payments is not registered

rapid scaffold
fleet moth
#

thanks boss works perfectly!

proven citrus
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

fleet moth
#

hey boss quick question, how can I get the last for digits of his credit card

#

So they know what credit card is on file

proven citrus
fleet moth
#

sorry thats givirn mr if is an error

#

I just want to retrierve las 4 digits when they are looking to the account

#

I have customer Id and subscription Id

proven citrus
#

you need to look at the payment method

#

from there you can retrieve the last 4 digits the way I shared before

fleet moth
#

thanks man, is working

#

hey my friend another question

#

when I add 'trial_period_days'=> 30,

#

it only adds 28

#

It always happens with any trial period I setuo go -2 days

undone crater
#

Hi ๐Ÿ‘‹ I'm stepping in for @proven citrus . Do you have an example request ID I can review?

fleet moth
#

sorry what?

undone crater
#

When you create a subscription that is an API request to Stripe. You can find the request ID in your logs in the Stripe dashboard. Those requests help me understand what is going on.

fleet moth
#

{
"payment_behavior": "default_incomplete",
"customer": "cus_M9EB3QzCRWnVma",
"trial_period_days": "30",
"items": {
"0": {
"price": "price_1L33iBBHYS6r19T0PT56o7Oe"
}
},
"expand": {
"0": "latest_invoice.payment_intent"
}
}

#

this is the body it says 30

#

but I just get 28

undone crater
#

Right, okay but that doesn't help me. I need the request ID for the API request where you are passing this data to Stripe.

fleet moth
#

req_pOM8vz8M385frQ

undone crater
#

The trial period for this subscription is from 7/29 16:07 to 8/28 16:07. That's 30 days

fleet moth
#

yep you are right, 30 dรญas, finaliza 28 ago.
I just read bad

#

sorry