#sushbhat-clientSecret
1 messages · Page 1 of 1 (latest)
I am passing this way clientSecret: 'pi_3LRwjqJ9HSJXUod00PpbJw1W_secret_7KWhFVkTQuFoToC86onjiQIxP',
ya tried changing it to double quotes etc no luck
fyi I am trying to integrate into angular app
We might need your code around the part passing that value
sure
const { error } = await this.stripe.confirmCardPayment({
clientSecret: 'pi_3LRwjqJ9HSJXUod00PpbJw1W_secret_7KWhFVkTQuFoToC86onjiQIxP',
data: {
// Make sure to change this to your payment completion page
return_url: "http://localhost:3001",
payment_method: {
billing_details: {
address: {
city: 'd',
country: 'i',
line1: null,
line2: null,
postal_code: 576100,
state: 't'
},
email: 'abc@qxyz.com',
name: 'abc',
phone: null
}
}
}
});
that looks correct
you sure your console refers to this block of code?
Btw you are using confirmCardPayment, which is an old method for Card Element. You have PaymentElement which is newer component
Don't have an Angular one but here is PaymentElement https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
I am using this declare var Stripe: stripe.StripeStatic;
it doesn't seem to have a confirmPayment
here is the list of supported methods:
That's weird. What version are you using?
"@types/stripe-v3": "^3.1.27"
"@stripe/stripe-js": "^1.34.0",
these 2 I have included
Hi @candid sigil I'm taking over this thread
Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Not able to make any request yet
just hardcoded payment intent id
i mean client secret
when I click on confirm payment this error shows up
Ah, you don't need to pass the param name clientSecret
So your code should be something like
'pi_3LRwjqJ9HSJXUod00PpbJw1W_secret_7KWhFVkTQuFoToC86onjiQIxP',
{
// Make sure to change this to your payment completion page
return_url: "http://localhost:3001/",
payment_method: {
...
https://stripe.com/docs/js/payment_intents/confirm_card_payment you can find example code here
changed it to this
const clientSecret = 'pi_3LRwjqJ9HSJXUod00PpbJw1W_secret_7KWhFVkTQuFoToC86onjiQIxP';
const { error } = await this.stripe.confirmCardPayment({
clientSecret,
data: {
// Make sure to change this to your payment completion page
return_url: "http://localhost:3001",
payment_method: {
billing_details: {
address: {
city: 'Hyderabad',
country: 'India',
line1: null,
line2: null,
postal_code: 576100,
state: 'Telengana'
},
email: 'sushbhat@qti.qualcomm.com',
name: 'Sushant',
phone: null
}
}
}
still same error
Change await this.stripe.confirmCardPayment({ to await this.stripe.confirmCardPayment(
And also remove the additional trailing brace
got it
now its fine
but seeing this error
Uncaught (in promise): IntegrationError: Missing value for confirmCardPayment: payment_method.card should be an object or element.
IntegrationError: Missing value for confirmCardPayment: payment_method.card should be an object or element.
do I need to pass card, isn't it already part of payment intent
Usually you need to get a reference of the cardElement and pass it to card param, as what the example code shows.
By doing that, Stripe.js will automatically create a PaymentMethod from the cardElement, and attach it to the PaymentIntent.
https://stripe.com/docs/payments/card-element and I'd suggest you to follow this guide in your integration.
I am currently not creating a card element but paymentelement
const paymentElement = this.elements.create("payment");
paymentElement.mount("#payment-element");
Then you should use confirmPayment (https://stripe.com/docs/js/payment_intents/confirm_payment) instead of confirmCardPayment
but unfortunately this method is not found on angular stripe library, so had to use this method
in pure javascript I had done something like this
const { error } = await stripe.confirmPayment({
elements,
confirmParams: {
// Make sure to change this to your payment completion page
return_url: "http://paas-env.eba-ftcpihnm.us-west-2.elasticbeanstalk.com/public/paymentStatus.html",
payment_method_data: {
billing_details: {
address: {
city: 'Hyderabad',
country: 'India',
line1: null,
line2: null,
postal_code: 576100,
state: 'Telengana'
},
email: 'sushbhat@qti.qualcomm.com',
name: 'Sushant',
phone: null
}
}
}
});
and this works
the confirmCardPayment method requires a cardElement so it doesn't work with PaymentElements.
so on angular whats the recommended way of integration? any suggestions?
currently using this declare var Stripe: stripe.StripeStatic;
"@stripe/stripe-js": "^1.34.0",
"@types/stripe-v3": "^3.1.27"
https://github.com/richnologies/ngx-stripe/blob/main/projects/ngx-stripe/src/lib/services/stripe.service.ts#L152 I found a method called confirmPayment in ngx-stripe
oh great, let me try this