Type Method

buttonWithType:style:

Returns a button instance with the Apple Pay logo.

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:forControlEvents: 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.

See Also

Creating Payment Buttons

- initWithPaymentButtonType:paymentButtonStyle:

Initializes a new payment button.