<!--
{
  "availability" : [
    "iOS: 8.3.0 -",
    "iPadOS: 8.3.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PassKit",
  "identifier" : "/documentation/PassKit/PKPaymentButton/buttonWithType:style:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PassKit (Apple Pay and Wallet)"
    ],
    "preciseIdentifier" : "c:objc(cs)PKPaymentButton(cm)buttonWithType:style:"
  },
  "title" : "buttonWithType:style:"
}
-->

# buttonWithType:style:

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

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

## Parameters

`buttonType`

The button’s content. For a complete list of button types, see [`PKPaymentButtonType`](/documentation/PassKit/PKPaymentButtonType).

`buttonStyle`

The button’s appearance. For a complete list of button styles, see [`PKPaymentButtonStyle`](/documentation/PassKit/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](https://developer.apple.com/library/archive/documentation/General/Conceptual/Devpedia-CocoaApp/TargetAction.html#//apple_ref/doc/uid/TP40009071-CH3) by calling its <doc://com.apple.documentation/documentation/UIKit/UIControl/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](https://developer.apple.com/library/archive/ApplePay_Guide/index.html#//apple_ref/doc/uid/TP40014764).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)