#Benjamin Carrera

1 messages · Page 1 of 1 (latest)

dusky hollyBOT
grave moat
#

here is the requesr

fading jungle
#

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

grave moat
#

so what can be an example of this?

fading jungle
#

You can expand the pending_setup_intent instead of latest_invoice.payment_intent

grave moat
#

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.

fading jungle
#

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

grave moat
#

on the response from the api I get
"pending_setup_intent": "seti_1Mu3sZBgFLsOrGBL4Ua4PHHn",

fading jungle
#

You need to expand it

#

On the expand parameters here, instead of latest_invoice.payment_intent, pass pending_setup_intent

grave moat
#

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.

fading jungle
#

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?

grave moat
#

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";
}
});

fading jungle
#

Have you logged the billing.clientSecret above and double check it's the same value you received by seti_1Mu4UABgFLsOrGBLmVrYsOyO_secret_NfPISt5sXnHP2hJIe51ND1VRuXV46g7?

grave moat
#

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"

fading jungle
#

That looks good to me. Any can you screenshot the error?

grave moat
#

I think the problem is cache

#

let me check

#

yes is working now

#

thank you very much for your help