#Benjamin Carrera
1 messages · Page 1 of 1 (latest)
So you created this Subscription sub_1Mu3sZBgFLsOrGBL16qhqPGJ with a trial, hence it doesn't need a Payment Method and doesn't create the PaymentIntent yet, that's why you have payment_intent = null here
You have a pending_setup_intent instead and you would need to let your customer confirm this SetupIntent to collect their payment info during the trial
so what can be an example of this?
You can expand the pending_setup_intent instead of latest_invoice.payment_intent
I am getting this error:
Invalid value for stripe.confirmCardSetup intent secret: value should be a client secret of the form ${id}secret${secret}. You specified: seti_1Mu4MnBgFLsOrGBL0Bqjq2F9.
It's because you are passing in a SetupIntent Id. You need the SetupIntent secret
What do you get by expanding pending_setup_intent? You should take the secret inside what is expanded
on the response from the api I get
"pending_setup_intent": "seti_1Mu3sZBgFLsOrGBL4Ua4PHHn",
You need to expand it
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
On the expand parameters here, instead of latest_invoice.payment_intent, pass pending_setup_intent
ok
now I am using:
$subscription->pending_setup_intent->client_secret
but still getting the error:
Missing value for stripe.confirmCardSetup intent secret: value should be a client_secret string.
You don't pass any value to it?
confirmCardSetup is a frontend method, there is a step you need to pass the SetupIntent secret from backend to frontend. Which value have you passed there?
for the frontend confirmCardSetup Im passing the value $subscription->pending_setup_intent->client_secret from this response
stripe.confirmCardSetup(billing.clientSecret, { //
payment_method: {
card: cardNumber,
billing_details: {
"address": {
"city": billing.city,
"country": 'US',
"line1": billing.address,
"line2": billing.addressTwo,
"postal_code": billing.zipcode,
"state": billing.state
},
name: name,
},
}
}).then((result) => {
$("#loader").hide();
console.log(result);
if(result.error) {
$('#show-error div').html("Payment failed: " + result.error.message);
$('#show-error').show();
} else {
// Redirect the customer to their account page
//$('#messages').html('Success! Redirecting to your account.');
window.location = "register-thankyou.html";
}
});
Have you logged the billing.clientSecret above and double check it's the same value you received by seti_1Mu4UABgFLsOrGBLmVrYsOyO_secret_NfPISt5sXnHP2hJIe51ND1VRuXV46g7?
yes here is the billing object
address
:
"Address Test"
addressTwo
:
"address 2"
city
:
"LA"
clientSecret
:
"seti_1Mu4byBgFLsOrGBLbcPF4CuA_secret_NfPQfFDZLBO13scV09sgTUyLnVaEl0t"
name
:
"test"
state
:
"CA"
zipcode
:
"90001"
That looks good to me. Any can you screenshot the error?