#alan95-PI

1 messages · Page 1 of 1 (latest)

copper phoenix
#

heya @manic fiber! if you log what is in ad.stripeToken just before creating the PaymentIntent, what do you get?

manic fiber
#

Hi, thanks for reaching out

#

i get the payment_method id

#

that s my backend code

#

in the front end, i just create the payment_method and sent it and store it on a DB

#

and in another screen, when the ad is approved gets the payment_,method id from the db and calls the create payment_intent

copper phoenix
#

yep, but what is the value of ad.stripeToken?

#

cause it looks like there may not be a value being passed in

manic fiber
#

this is the value stripeToken: 'pm_1JpjSgJSu99yKMzQKvz48OSp'

#

thats coming from the logs

#

the main issue is that all the payments show as incomplete

copper phoenix
#

alright, gimme a second to take a closer look with this PaymentMethod

manic fiber
#

ok thanks

copper phoenix
#

is this the PaymentIntent - pi_3JpjUwJSu99yKMzQ0Sqgu0yY?

manic fiber
#

let me check

#

yes

#

i set the confirm : true on the create paymentIntent

#

and is showing as incomplete

copper phoenix
manic fiber
#

Ley me see

#

how could that be ?

copper phoenix
#

i think tracing / logging to see where things are not being passed in would probably be where you want to start

manic fiber
#

i even tried to updated the payment_mehthod before calling the create_paymentIntent

#

this is the data I have

#

this is from my DB, the stripeToken is the reponse from here : https://api.stripe.com/v1/payment_methods updateAdStatus ~ ad {
id: 44,
uuid: '218f79be-205e-46ba-8178-be99d6cff3b4',
firstName: 'alan eduardo m',
lastName: 'medina silva',
email: 'alanmedina437@gmail.com',
phone: '(523)318-6541',
stripeToken: 'pm_1JpjSgJSu99yKMzQKvz48OSp',
altText: 'auto confirm test 3',
linkTo: 'https://google.com',
imgUri: '1635469253053.png',
active: true,
finalPrice: 2875,
rejectedCancelMotive: null,
startDate: 2021-10-28T05:00:00.000Z,
endDate: 2022-04-28T05:00:00.000Z,
createdAt: 2021-10-29T01:00:53.352Z,
updatedAt: 2021-10-29T01:00:53.352Z,
AdCategoryId: 2,
AdLocationId: 3,
CompanyId: 5,
TimeRangeId: 1
}

#

then I created the paymentIntent and got this

#

id: 'pi_3JpjUwJSu99yKMzQ0Sqgu0yY',
object: 'payment_intent',
amount: 2875,
amount_capturable: 0,
amount_received: 0,
application: null,
application_fee_amount: null,
canceled_at: null,
cancellation_reason: null,
capture_method: 'automatic',
charges: {
object: 'list',
data: [],
has_more: false,
total_count: 0,
url: '/v1/charges?payment_intent=pi_3JpjUwJSu99yKMzQ0Sqgu0yY'
},
client_secret: 'pi_3JpjUwJSu99yKMzQ0Sqgu0yY_secret_JGDj0WSC5nJPGBDbal6VHCqdn',
confirmation_method: 'automatic',
created: 1635469390,
currency: 'usd',
customer: 'cus_KUiwHMAKTPe1i1',
description: null,
invoice: null,
last_payment_error: null,
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: null,
payment_method_options: {
card: {
installments: null,
network: null,
request_three_d_secure: 'automatic'
}
},
payment_method_types: [ 'card' ],
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'requires_payment_method',
transfer_data: null,
transfer_group: null
}

#

this is how im creating it const paymentIntent = await stripe.paymentIntents.create({
amount: ad.finalPrice,
currency: 'usd',
payment_method_types: ['card'],
customer: customer.id,
payment_method : paymentMethod.id,
confirm : true
});

copper phoenix
#

it's difficult for me to advise any further since you're going to need to trace/log what's happening at each step of your code

manic fiber
#

actually updating the payment_method did the trick

#

thanks a lot for your help, really enlightend me

#

have a good day

copper phoenix
#

glad to help!