OPApplePayContextDelegate
@objc
public protocol OPApplePayContextDelegate : NSObjectProtocol
Protocol to hook into important events in the ApplePay flow
Required: Implement applePaymentMethodCreatedto get payment method details that need to be submitted to Olo’s Ordering API when submitting a basket with OloPay
Optional: Implement applePaymentCompleted to know when the ApplePay sheet is dismissed
-
Called after the customer has authorized ApplePay and a payment method has been created. Implement this method to pass the payment method ID to Olo’s Ordering API when submitting a basket. If the API call returns an error, return that error so the ApplePay payment sheet can be dismissed appropriately
Declaration
Swift
@objc func applePaymentMethodCreated(_ context: OPApplePayContextProtocol, didCreatePaymentMethod paymentMethod: OPPaymentMethodProtocol) -> NSError?Parameters
paymentMethodThe PaymentMethod that represents the customer’s Apple Pay payment method.
Return Value
nil if basket submission was successful, or an Error from Olo’s Ordering API if submission was unsuccessful
-
Called after the Apple Pay sheet is dismissed with the result of the payment. Your implementation could stop a spinner and display a receipt view or error to the customer, for example.
Declaration
Swift
@objc optional func applePaymentCompleted(_ context: OPApplePayContextProtocol, didCompleteWith status: OPPaymentStatus, error: Error?)Parameters
statusThe status of the payment
errorThe error that occurred, if any. This will generally be
OPError. If the error has anerrorTypeofcardErrorit will also contain a user-friendly message that can be used to help the user understand why the payment couldn’t be completed.
OPApplePayContextDelegate Protocol Reference