#kirubakaran - Null client secret

1 messages · Page 1 of 1 (latest)

royal musk
#

Do you have an event ID I could look at?

vapid ice
#

evt_3KWPaaFx11m8e94j1A5O5tza

royal musk
#

The object in the event data has a valid client secret from what I can see

vapid ice
#

"client_secret": null,

#

this is what i got in paymentindent.created webkook

royal musk
#

Here is the object I see when I examine this event

object: {
    id: "pi_xxxx",
    object: "payment_intent",
    allowed_source_types: [
      "card"
    ],
    amount: 100,
    amount_capturable: 0,
    amount_received: 0,
    application: null,
    application_fee_amount: null,
    automatic_payment_methods: 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_xxxx"
    },
    client_secret: "pi_xxxx_secret_xxxxxx",
    confirmation_method: "automatic",
    created: 1645640964,
    currency: "usd",
    customer: "cus_xxxx",
    description: "Invoice F2267445-0006",
    invoice: "in_xxxx",
    last_payment_error: null,
    livemode: true,
    metadata: {},
    next_action: null,
    next_source_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"
    ],
    processing: null,
    receipt_email: null,
    review: null,
    setup_future_usage: null,
    shipping: null,
    source: null,
    statement_descriptor: null,
    statement_descriptor_suffix: null,
    status: "requires_source",
    transfer_data: null,
    transfer_group: null
  }
vapid ice
#

{
"object": {
"id": "pi_3KWPaaFx11m8e94j1jpVmILD",
"object": "payment_intent",
"amount": 100,
"amount_capturable": 0,
"amount_received": 0,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": 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_3KWPaaFx11m8e94j1jpVmILD"
},
"client_secret": null,
"confirmation_method": "automatic",
"created": 1645640964,
"currency": "usd",
"customer": "cus_LBHahZAoIO56eF",
"description": "Invoice F2267445-0006",
"invoice": "in_1KWPaYFx11m8e94jaPYvG3hk",
"last_payment_error": null,
"livemode": true,
"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"
],
"processing": null,
"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 what showing to me

royal musk
#

Hmmmm.... 🤔

vapid ice
#

😩

royal musk
#

The client secret is not intended to persist on you end but be used to authenticate the front-end when using Stripe.js elements. What do you want it for?

vapid ice
#

i am using paymentindent.created to get the client_secret and using it in the stripe element to confirm the payment, as it is returniing as null i cannot able to make payments

royal musk
#

Where are you creating the paymentIntent?

vapid ice
#

i am using this paymentindent.created webkook to get the client_secret

royal musk
#

Okay but when are you creating the paymentIntent?

vapid ice
#

i am not creating paymentindents, i am trying to get the payment indent id and secret_code of invoice created in subscription in connect account

royal musk
#

Webhooks are not intended for that purpose. Client secrets should be sent from the server creating the payment intent to the front-end consuming it. How is your application designed?

vapid ice
#

thats how we used but how can we pay the stripe subscription invoice with our own custopm payment page with stripe emements without client secret

royal musk
#

What I am asking is, how do your server-side and client-side portions of you app communicate?

vapid ice
#

i am seding data using rest api

royal musk
#

I don't think webhooks are an appropriate method for accessing the client_secret

vapid ice
#

then how can i able to get the client secret of the invoice created by stripe subscription

royal musk
wind fjord
#

@vapid ice when your server receives the event, if you need the client_secret you can retrieve the object from the API bfore taking whatever client-side action is needed

vapid ice
#

@wind fjord i am doing that only...but i am receiving null in client_secret in the event

wind fjord
#

yes, you need to explicitly retrieve the object

vapid ice
#

ok ...ca you please give any axample for this

wind fjord
#

If you take a look there, we show an example for each client language

vapid ice
#

yes i have tried this

#

it returning null

wind fjord
#

Do you also use one-time payment intents, or only subscriptions / invoices?

vapid ice
#

i am using both

wind fjord
#

Ok in that case you might want to look at invoice specific events so that you don't unintentionally handle non-invoice payment intents

#

What scenario are you trying to handle?

wind fjord
#

No, I mean the request you make to retrieve the invoice or payment intent object

#

I think it might be worth taking a step back and explaining to me your broader flow here. At a high level, what are you trying to do?

vapid ice
#

I am trying to get the client_secret from paymentindent.created webhooks and i am passing it to stripe element confirm payment api,,,but here i am getting the cleint secret as null,, so i cant able to make any payments as the client_secret is null

wind fjord
#

OK take a step back from that, why do you want to do that?

#

What problem are you trying to solve?

wooden briar
#

hi @wind fjord ..

#

we are using stripe connect in our application

#

to make transaction between our customers...

vapid ice
#

i tried using await stripe.paymentIntents.retrieve("pi_3KWPaaFx11m8e94j1jpVmILD",{stripeAccount :"acct_1Bdd4RFx11m8e94j"})

#

but it also returning client_secret as null

wind fjord
#

@wooden briar Sure but what flow are you using for this? ie, who creates a subscription, how, which invoices are you trying to handle, etc

wooden briar
#

example: user A is our customer..

wind fjord
wooden briar
#

he will create subscription or invoices for user B...

#

user A will connect with stripe using their stripe account..

#

after that they will start create subscription and invoices to their customers..

wind fjord
#

You should see your metadata in the response, in addition to the client secret

vapid ice
#

no...i am not updating

#

do i need to do this

#

await stripe.subscriptions.create({
customer: customer_id,
items: [{ price: price_id }],
collection_method: "send_invoice",
days_until_due: 10
expand: ["latest_invoice.payment_intent"],
}, { stripeAccount: account_id })

#

this is what i am using to create subscription and its invoices are auto generated right?

wind fjord
#

That's another option, yes! But, that is suing "send invoice" to send the user emails to pay on the hosted invoice page. What are you trying to do with the client secret here?

#

If you're trying to build a custom payment flow you should use collection_method=charge_automatically

vapid ice
#

what if i dont't have credit card details by default

wind fjord
#

What do you mean?

vapid ice
#

tried updating paymentindent

#

{
id: 'pi_3KWPaaFx11m8e94j1jpVmILD',
object: 'payment_intent',
amount: 100,
amount_capturable: 0,
amount_received: 0,
application: null,
application_fee_amount: null,
automatic_payment_methods: 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_3KWPaaFx11m8e94j1jpVmILD'
},
client_secret: null,
confirmation_method: 'automatic',
created: 1645640964,
currency: 'usd',
customer: 'cus_LBHahZAoIO56eF',
description: 'Invoice F2267445-0006',
invoice: 'in_1KWPaYFx11m8e94jaPYvG3hk',
last_payment_error: null,
livemode: true,
metadata: { testkey: 'testvalue' },
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' ],
processing: null,
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
}

wind fjord
#

I'd be better able to help if you could describe your overall expected flow. I think you're questions are too narrowly focused and aren't really addressing your bigger objective.

vapid ice
#

still getting client_secreat as null

wind fjord
#

OK, interesting. Let me look into this.

wind fjord
#

@vapid ice @wooden briar Is this something new you're building, or an existing integration that stopped working?

#

ie, is this changed behaviour to you, or something you discovered during development?

wind fjord
#

OK we found that this is different than it was recently, still investigating