buttonWithType:style:
Creates a new payment button with the specified type and style.
Declaration
+ (instancetype) buttonWithType:(PKPaymentButtonType) buttonType style:(PKPaymentButtonStyle) buttonStyle;Parameters
- buttonType:
The button’s content. For a complete list of button types, see Pkpaymentbuttontype.
- buttonStyle:
The button’s appearance. For a complete list of button styles, see Pkpaymentbuttonstyle.
Return Value
Returns a PKPaymentButton instance with the specified type and style.
Discussion
Use the returned button to trigger a purchase through Apple Pay. Add the button instance to your view hierarchy, and then set its Target-Action by calling its addTarget(_:action:for:) method. In the action method, create the payment request and present the payment authorization view controller. These buttons can be used only to initiate Apple Pay transactions.
Do not display a button smaller than its intrinsic content size. You can extend the button’s width to fit your layout, but do not reduce the width or change the button’s height.
For more information on using Apple Pay, see Apple Pay Programming Guide.