<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: -",
    "macOS: 12.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "PassKit",
  "identifier" : "/documentation/PassKit/PKPaymentRequest/paymentCouponCodeInvalidError(localizedDescription:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PassKit (Apple Pay and Wallet)",
      "PassKit"
    ],
    "preciseIdentifier" : "s:So16PKPaymentRequestC7PassKitE29paymentCouponCodeInvalidError20localizedDescriptions0I0_pSSSg_tFZ"
  },
  "title" : "paymentCouponCodeInvalidError(localizedDescription:)"
}
-->

# paymentCouponCodeInvalidError(localizedDescription:)

Returns an error object that indicates an invalid coupon.

```
static func paymentCouponCodeInvalidError(localizedDescription: String? = nil) -> any Error
```

## Parameters

`localizedDescription`

A user-readable error as a localized string.

## Return Value

A new invalid coupon error.

## Discussion

Use this convenience method to create a payment error object instead of creating an <doc://com.apple.documentation/documentation/Foundation/NSError> object yourself. This method indicates that the coupon code received from the Apple Pay sheet is invalid.

The error you provide and its optional message appear on the Apple Pay sheet. There’s limited available space to display messages, so keep your messages concise.

---

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)