#Marroco - client secret
1 messages ยท Page 1 of 1 (latest)
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
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
You can grab the client secret from this setupintent: https://stripe.com/docs/api/subscriptions/object#subscription_object-pending_setup_intent
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
Creating a sub with a trial creates a setupintent, which will be visible in the above field on the sub
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Then you can use its client secret
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'
Make sure you are using this function instead: https://stripe.com/docs/js/setup_intents/confirm_card_setup
Since it's not a payment intent
sorry instead of what method
this is the snipped of my code and part was copied from stripe checkout
instead of confirmPayment
You're not confirming a payment
You're confirming a setupintent
how can I tranform my paymentElement to a Card Element
or I need to use another UI insted of the checkout UI?
You can use the payment element for this. There's no need to switch to something else
Or would you rather use something else?
no, I would like to stay with the same UI
Yeah PaymentElement works with SetupIntents
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.
Sorry I think I might have sent you the wrong link
My bad
This guide shows you the proper steps: https://stripe.com/docs/payments/save-and-reuse?platform=web
Shows exactly how to use the Payment Element with SetupIntents
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
You can go in the subscriptions section: https://dashboard.stripe.com/test/subscriptions
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
thanks boss works perfectly!
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
you need to look at the payment method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
from there you can retrieve the last 4 digits the way I shared before
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
Hi ๐ I'm stepping in for @proven citrus . Do you have an example request ID I can review?
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
sorry what?
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.
{
"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
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.
req_pOM8vz8M385frQ
The trial period for this subscription is from 7/29 16:07 to 8/28 16:07. That's 30 days