#mahi_96911

1 messages · Page 1 of 1 (latest)

dreamy bronzeBOT
hasty pagoda
#

hi there!

#

how are you accepting payment in your app? with the PaymentSheet or something else?

limber burrow
#

own design card payment

hasty pagoda
#

but what are you using exactly then? Payment Element, Card Element, Checkout Session... ?

#

can you share a link to the documentation you are following?

limber burrow
#

first

STPAPIClient.shared.publishableKey = self.response1?.reponseData.paymentdata.api_id

next

STPAPIClient.shared.createPaymentMethod(with: paymentMethodParams) { (paymentMethod, error) in

in this success i could call
main = clieent secret
let paymentHandler = STPPaymentHandler.shared()
paymentHandler.handleNextAction(forPayment: main , with: self, returnURL: nil) { status, paymentIntent, handleActionError in

limber burrow
#

extension StripePopupVC: STPAuthenticationContext {

func authenticationPresentingViewController() -> UIViewController {
    return self
}
#

above delegate open the secure page but not closed automatically

#

how to close automatically the secure page

proven kindle
#

you have to register a custom URL scheme in your app, use that in the returnUrl to the SDK function, and set up a function in your AppDelegate to handle the scheme, to have the redirect be automatic

limber burrow
#

i have register custom url in app info

#

in my app delegate :

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        let stripeHandled = StripeAPI.handleURLCallback(with: url)
        if (stripeHandled) {
            
            print("111")
            return true
        } else {
            print("222")
            // This was not a Stripe url – handle the URL normally as you would
        }
        return false
    }
    
    func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
        if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
            if let url = userActivity.webpageURL {
                let stripeHandled = StripeAPI.handleURLCallback(with: url)
                if (stripeHandled) {
                    print("333")
                    return true
                } else {
                    print("444")
                    // This was not a Stripe url – handle the URL normally as you would
                }
            }
        }
        return false
    }
#

above is correct or wrong

proven kindle
#

you don't pass returnUrl though, you pass nil

limber burrow
proven kindle
#
        paymentHandler.handleNextAction(forPayment: main , with: self, returnURL: nil)

that should be returnURL:"my-app-scheme://payment-complete" for instance.

proven kindle
limber burrow
#

sure i will check

#

in return url only i pass my bundle id its enough

proven kindle
#

no

limber burrow
#

instead of?

proven kindle
#

not sure what you're asking?

limber burrow
#

any sample return url

proven kindle
#

well I posted one just above

#

but like there's no sample, you have to set this up

#

then assuming you created that as e.g "my-app-scheme" then you pass a returnUrl like :"my-app-scheme://payment-complete" for instance"

limber burrow
#

okay, Thank you