PKPaymentRequest
An object that represents a request for payment, including details about payment-processing capabilities, the payment amount, and shipping information.
Declaration
class PKPaymentRequestOverview
Use a PKPaymentRequest object to represent a merchant request for payment for goods or services. Your app creates a payment request as soon as a person taps the Apple Pay button to make a purchase. Tapping the Apple Pay button in your app initiates the payment request process. If your customers need to enter a discount code, choose a shipping method, or any other task, your app needs to ask for that information before they tap the Apple Pay button.
A payment request object contains information that describes the purchase, including information about the merchant, available payment networks, the payment summary, billing and shipping details, coupon codes, custom data, error messages, and more.
A typical payment request is for a one-time payment. To support different types of payment requests, include one of the following options in the payment request object:
Payment type request | Property to set |
|---|---|
Recurring payments | |
Automatic reload payments | |
Deferred payments | |
Indicating eligibility for Apple Pay Later | |
Multiple payment tokens to support for multimerchant payments |
Request a recurring payment
Use the recurringPaymentRequest property to set up a recurring payment request using the PKRecurringPaymentRequest and PKRecurringPaymentSummaryItem classes. Recurring payments, such as subscriptions, can feature different payment intervals (for example, annually or monthly) and billing cycles, such as regular or trial.
Request an automatic reload payment
Use the automaticReloadPaymentRequest property to set up an automatic reload payment request using the PKAutomaticReloadPaymentRequest and PKAutomaticReloadPaymentSummaryItem classes. You can set up automatic reload payments, such as store card top-ups, that feature a balance threshold and a reload amount. The card automatically reloads with the reload amount when the account drops below the balance threshold.
Request a deferred payment
Use the deferredPaymentRequest property to set up a deferred payment request using the PKDeferredPaymentRequest class. Deferred payments include purchases, such as hotel bookings or pre-orders, where the card renders payment at a later date upon the receipt of goods or delivery of services.
Set the Apple Pay Later mode
Use the applePayLaterAvailability property to indicate whether this payment request is eligible for Apple Pay Later. You can indicate that Apple Pay Later is unavailable for certain kinds of transactions, including subscriptions, items that require recurring payments or prohibited items, such as gift cards.
Request multitoken or multimerchant payments
Use the multiTokenContexts property to request payment data for multimerchant payments with the PKPaymentTokenContext class. You can set up multitoken transactions to process and display payment requests with multiple merchants on one payment sheet, for example, a booking site where someone pays for a hotel, flight, and car rental from different merchants.
Topics
Selecting the payment networks
Setting merchant information
Setting currency and region information
Setting the payment summary items
Requesting recurring, automatic, and deferred payments
recurringPaymentRequestPKRecurringPaymentRequestautomaticReloadPaymentRequestPKAutomaticReloadPaymentRequestdeferredPaymentRequestPKDeferredPaymentRequest
Requesting multitoken or multimerchant payments
Requesting billing and shipping contact fields
Providing known contact information
Setting the shipping methods and types
Displaying a Read-Only Pickup AddressshippingMethodsPKShippingMethodshippingTypeshippingContactEditingModePKShippingTypePKShippingContactEditingMode
Working with coupon codes
Adding custom data
Providing error information
paymentBillingAddressInvalidError(withKey:localizedDescription:)paymentContactInvalidError(withContactField:localizedDescription:)paymentShippingAddressInvalidError(withKey:localizedDescription:)paymentShippingAddressUnserviceableError(withLocalizedDescription:)paymentCouponCodeInvalidError(localizedDescription:)paymentCouponCodeExpiredError(localizedDescription:)
Deprecated
enabledrequiredBillingAddressFieldsrequiredShippingAddressFieldsPKAddressFieldbillingAddressshippingAddress