ApplePayContextDelegate
public protocol ApplePayContextDelegate : _stpinternal_STPApplePayContextDelegateBase
Implement the required methods of this delegate to supply a PaymentIntent to ApplePayContext and be notified of the completion of the Apple Pay payment. You may also implement the optional delegate methods to handle shipping methods and shipping address changes e.g. to verify you can ship to the address, or update the payment amount.
-
Called after the customer has authorized Apple Pay. Implement this method to call the completion block with the client secret of a PaymentIntent or SetupIntent.
Declaration
Swift
func applePayContext( _ context: STPApplePayContext, didCreatePaymentMethod paymentMethod: StripeAPI.PaymentMethod, paymentInformation: PKPayment, completion: @escaping STPIntentClientSecretCompletionBlock )
Parameters
paymentMethod
The PaymentMethod that represents the customer’s Apple Pay payment method. If you create the PaymentIntent with confirmation_method=manual, pass
paymentMethod.id
as the payment_method and confirm=true. Otherwise, you can ignore this parameter.paymentInformation
The underlying PKPayment created by Apple Pay. If you create the PaymentIntent with confirmation_method=manual, you can collect shipping information using its
shippingContact
andshippingMethod
properties.completion
Call this with the PaymentIntent or SetupIntent client secret, or the error that occurred creating the PaymentIntent or SetupIntent.
-
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
func applePayContext( _ context: STPApplePayContext, didCompleteWith status: STPApplePayContext.PaymentStatus, error: Error? )
Parameters
status
The status of the payment
error
The error that occurred, if any.