Class

PKPaymentAuthorizationResult

Reports the status code and errors that you return when a payment is authorized.

Declaration

class PKPaymentAuthorizationResult : NSObject

Overview

If the Apple Pay sheet contains errors, you provide a PKPaymentAuthorizationStatus.failure status to PKPaymentAuthorizationResult, and include the errors in the errors array. If there are no errors, you provide a PKPaymentAuthorizationStatus.success status and leave the error array empty.

Listing 1 shows a failure result with two errors in the postal code and street fields.

Listing 1

A result that reports two errors

// Error in postal code field
let shippingInvalidZip =
PKPaymentRequest.paymentShippingAddressInvalidError(withKey:CNPostalAddressPostalCodeKey,
                                                    localizedDescription: "Invalid ZIP code")
// Error in street address field
let shippingInvalidStreet = PKPaymentRequest.paymentShippingAddressInvalidError(withKey:CNPostalAddressStreetKey,
                                                    localizedDescription: "Missing street name")
// Result with failure status and errors
let result = PKPaymentAuthorizationResult(status: .failure, 
                                          errors: [shippingInvalidZip, shippingInvalidStreet])

Topics

Initializing a Payment Authorization Result

init(status: PKPaymentAuthorizationStatus, errors: [Error]?)

Initialize the result with the status code and list of errors.

Payment Authorization Status and Errors

var errors: [Error]!

List of errors in the Apple Pay sheet.

var status: PKPaymentAuthorizationStatus

Payment authorization general status.

enum PKPaymentAuthorizationStatus

General success and failure status for payment authorization.

Relationships

Inherits From

Conforms To

See Also

Payment Sheet Interactions and Authorization

class PKPaymentAuthorizationController

Presents a sheet that prompts the user to authorize a payment request.

class PKPaymentAuthorizationViewController

Prompts the user to authorize a payment request.

class PKPayment

Represents the result of authorizing a payment request and contains payment information, encrypted in the payment token.