Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eventing framework #4014

Closed
wants to merge 13 commits into from
Closed

Eventing framework #4014

wants to merge 13 commits into from

Conversation

wooj-stripe
Copy link
Collaborator

@wooj-stripe wooj-stripe commented Sep 12, 2024

Summary

Adds an eventing early preview of an eventing framework

Motivation

Analytics access to some events

Testing

Updated existing tests to accmodate for new metrics

Example Integration

Users would need to add @_spi

+ @_spi(MobilePaymentElementEventingBeta) import StripeCore

Add an Observer

+        NotificationCenter.default.addObserver(self,
+                                               selector: #selector(mobilePaymentElementNotification(notification:)),
+                                               name: .mobilePaymentElement, object: nil)

Define a callback function to receive notifications

+    @objc
+    func mobilePaymentElementNotification(notification: NSNotification) {
+        guard let mpeNotification = notification.object as? MobilePaymentElementEvent else {
+            return
+        }
+        print("Notification(eventName): \(mpeNotification.eventName)")
+        print("Notification(metadata): \(mpeNotification.metadata)")
+    }
+

Changelog

Will add when it is time to announce

@wooj-stripe wooj-stripe changed the title Eventing framework rev2 Eventing framework Sep 13, 2024
@wooj-stripe wooj-stripe marked this pull request as ready for review September 13, 2024 17:32
@wooj-stripe wooj-stripe requested review from a team as code owners September 13, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant