#Gyan

1 messages ยท Page 1 of 1 (latest)

tribal patrolBOT
next saffron
#

Hello! It's the same API, but it has different results because we return different things depending on whether you use a secret key vs a publishable key

mighty grove
#

got it, i am interested in getting "payment_method_details"

next saffron
#

Yeah I don't think that's someting you'd get client-side (since it's on the charge, and we don't return that client-side)

#

You should be able to find the same info in payment_method though

mighty grove
#

Hmm.. how can i get payment method details then just after the payment? I know we can get more info in the webhook but i need something on the client side to display in the receipt immediately after the payment is made.

#

payment_method is coming as null in the response.

#

Here is the sample response of retrievePaymentIntent() method.

{
"paymentIntent": {
"amount": 100,
"canceledAt": null,
"captureMethod": "Automatic",
"clientSecret": "pi_3NVfU1IoChmUfsNA23lHBruq_secret_GwFpTAGoPZoqesZwuzjWDQQhQ",
"confirmationMethod": "Automatic",
"created": "1689792741000",
"currency": "usd",
"description": "<StripePayments.STPPaymentIntent: 0x7ff34e18e360; stripeId = pi_3NVfU1IoChmUfsNA23lHBruq; amount = 100; canceledAt = nil; captureMethod = Optional("automatic"); clientSecret = <redacted>; confirmationMethod = Optional("automatic"); countryCode = nil; created = 2023-07-19 18:52:21 +0000; currency = usd; description = nil; lastPaymentError = nil; linkSettings = nil; livemode = false; nextAction = nil; paymentMethodId = Optional("pm_1NVfUEIoChmUfsNAtnXgQwsU"); paymentMethod = nil; paymentMethodOptions = Optional(<StripePayments.STPPaymentMethodOptions: 0x600001c45920>); paymentMethodTypes = Optional(["card", "link", "us_bank_account"]); receiptEmail = nil; setupFutureUsage = nil; shipping = nil; sourceId = nil; status = Optional("succeeded"); unactivatedPaymentMethodTypes = []>",
"id": "pi_3NVfU1IoChmUfsNA23lHBruq",
"lastPaymentError": null,
"livemode": false,
"nextAction": null,
"paymentMethod": null,
"paymentMethodId": "pm_1NVfUEIoChmUfsNAtnXgQwsU",
"receiptEmail": null,
"shipping": null,
"status": "Succeeded"
}
}

next saffron
#

The Payment Method ID is right there - "paymentMethodId": "pm_1NVfUEIoChmUfsNAtnXgQwsU",

#

To get the full payment method you'd have to expand it

#

I need to head out, but if you need more help @barren oriole is around and can answer questions

barren oriole
#

๐Ÿ‘‹

#

WIth the PK + PI client_secret you should be able to retrieve the PaymentIntent with the payment_method expanded using expand[]=payment_method
https://stripe.com/docs/expand

I'm not clear on the syntax for this with the react native method, though, trying to find that

Learn how to reduce the number of requests you make to the Stripe API by expanding objects in responses.

#

So you'd need to either retrieve this via your own server or craft a manual API request

mighty grove
#

yes found the same thing

#

okay thanks anyway

barren oriole
#

NP ๐Ÿ‘