stripe / stripe-ios

Stripe iOS SDK
https://stripe.com
MIT License
2.08k stars 976 forks source link

[BUG] Issue with payment_intent confirm API Request #3928

Closed praakash closed 3 weeks ago

praakash commented 1 month ago

I am reaching out for assistance regarding an issue I am facing with the Stripe SDK in our application. Specifically, we are encountering difficulties when attempting to use the payment_intent confirm API request to process payments.

let task = URLSession.shared.dataTask(with: request) { data, response, error in

        guard let data = data else {
            print(String(describing: error))
            return
        }

        do {

            if let DictConvert = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
                print("dict::\(DictConvert)")
           }
           dict::{   
              “last_payment_error” = “<null>“;
               “latest_charge” = “<null>“;

using third party library network debugger actually this gives response like

{ "error" : { "payment_intent" : { "payment_method_configuration_details" : null, "canceled_at" : null, "source" : null, "capture_method" : "automatic", "livemode" : true, "shipping" : null, "status" : "requires_payment_method", "object" : "payment_intent", "last_payment_error" : { "decline_code" : "insufficient_funds", "code" : "card_declined", "message" : "Your card has insufficient funds.", } } } I want print actual error message

porter-stripe commented 3 weeks ago

Hi @praakash it looks like you are making API requests directly to the Stripe API. This repo contains the mobile SDK that provides native APIs interacting with Stripe. Please see our docs to learn more: https://docs.stripe.com/payments/accept-a-payment