---
title: "buttonWithType:style:"
framework: passkit
role: symbol
role_heading: Type Method
path: "passkit/pkpaymentbutton/buttonwithtype:style:"
---

# buttonWithType:style:

Creates a new payment button with the specified type and style.

## Declaration

```occ
+ (instancetype) buttonWithType:(PKPaymentButtonType) buttonType style:(PKPaymentButtonStyle) buttonStyle;
```

## Parameters

- `buttonType`: The button’s content. For a complete list of button types, see doc://com.apple.passkit/documentation/PassKit/PKPaymentButtonType.
- `buttonStyle`: The button’s appearance. For a complete list of button styles, see doc://com.apple.passkit/documentation/PassKit/PKPaymentButtonStyle.

## Return Value

Return Value Returns a PKPaymentButton instance with the specified type and style.

## Discussion

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.

## See Also

### Creating payment buttons

- [init(paymentButtonType:paymentButtonStyle:)](passkit/pkpaymentbutton/init(paymentbuttontype:paymentbuttonstyle:).md)
