#sssakama

1 messages · Page 1 of 1 (latest)

hearty groveBOT
surreal lily
#

hello! you will receive a setup_intent.succeeded event which you would be able to find the payment method id

icy crypt
surreal lily
#

is your SetupIntent in succeeded status?

icy crypt
#

Yes, setup_intent succeeded and id was obtained

surreal lily
#

alright, do you have any other questions that i can help with?

icy crypt
#

How do I get the payment method id?

#

Even if I generate setup_intent, I can't get the payment method id.

surreal lily
#

are you listening for the setup_intent.succeeded event on your webhook?

hearty groveBOT
icy crypt
#

webhook is not connecting.

cunning sphinx
#

Hi @icy crypt I'm taking over.

#

Can you tell me more about the webhook connection problem? did you see any error messages?

icy crypt
#

Hi @cunning sphinx
Haven't tried webhooks yet.

Does it mean that you will receive a response via webhook after setting up payment on the payment sheet in the app?

cunning sphinx
#

It depends on what events your webhook endpoint is listening to

icy crypt
cunning sphinx
#

This is not a webhook, this is the return URL to redirect back to your iOS app.

icy crypt
cunning sphinx
#

Based on your earlier discussions with alex. My understanding is that you want to get the payment_method ID from a SetupIntent, and you should listen to setup_intent.succeeded event as Alex suggested.

icy crypt
#

yes i want to get payment_method id from setUpIntent.

Handle the event in this guide you sent me
So, should I listen to the setup_intent.succeeded event?

cunning sphinx
#

Yes you are right

icy crypt
#

I got it!
I understand, thank you!

#

Excuse me, is it a SetupIntent object that can be obtained by linstening the webhook?

cunning sphinx
#

Yes, if you are listening to setup_intent.succeeded event

icy crypt
#

Checking the documentation, the response when creating setup_intent is null for payment_method.
But when I listen on the webhook, does the payment_method come with a value?

{
  "id": "seti_1N3Aw52eZvKYlo2CzhnmSbLw",
  "object": "setup_intent",
  "application": null,
  "automatic_payment_methods": null,
  "cancellation_reason": null,
  "client_secret": "seti_1N3Aw52eZvKYlo2CzhnmSbLw_secret_NooZwYO9j8sTCbAdJ8GFEr1cjb6k5b0",
  "created": 1683002133,
  "customer": "cus_NooZ4zOpmE0gpW",
  "description": null,
  "flow_directions": null,
  "last_setup_error": null,
  "latest_attempt": null,
  "livemode": false,
  "mandate": null,
  "metadata": {},
  "next_action": null,
  "on_behalf_of": null,
  "payment_method": null,
  "payment_method_options": {
    "card": {
      "mandate_options": null,
      "network": null,
      "request_three_d_secure": "automatic"
    }
  },
  "payment_method_types": [
    "card"
  ],
  "redaction": null,
  "single_use_mandate": null,
  "status": "requires_payment_method",
  "usage": "off_session"
}
cunning sphinx
#

The status of this SetupIntent is requires_payment_method and that's why its payment_method is null.

icy crypt
cunning sphinx
icy crypt
#

I see,
requires_payment_method
Finally, the status changes to succeeded. So I can get the payment method id when successful.