iPaymentButton

Quickly implement & easily customize Apple's required payment button. 💵

1.

Install iPaymentButton.

2.

Add iPaymentButton to your project.

import SwiftUI
import iPaymentButton

struct ContentView: View {
    var body: some View {
        iPaymentButton(action: {
            // Add your custom payment code here 
        })
    }
}

3.

Customize your iPaymentButton.



Examples

Starter

Use our built-in applePayDemo() to demo a purchase experience.

import SwiftUI
import iPaymentButton
import iGraphics

struct ContentView: View {
    var body: some View {
        iGraphicsBox().stack(3)

        iPaymentButton(action: {
            iPaymentButton.applePayDemo()
            // Add your custom payment code here 
        })
    }
}

Modern

Change the button type and style.

import SwiftUI
import iPaymentButton
import iGraphics

struct ContentView: View {
    var body: some View {
        iGraphicsView(.first)

        iPaymentButton(type: .support, style: .whiteOutline, action: {
            iPaymentButton.applePayDemo()
            // Add your custom payment code here 
        })
    }
}

Customize

iPaymentButton has one required parameter: an action to execute on button tap. iPaymentButton supports several custom initializers and one custom modifier.

Example: Change the text, style and corner radius with the following code block:

iPaymentButton(type: .support, style: .whiteOutline, action: { } )
    .cornerRadius(25)

Use our exhaustive input list to customize your payment button.

Parameters & Modifiers Description
type: PKPaymentButtonType = .buy
The text written on the button. 🆒
type: PKPaymentButtonStyle = .black
The color that the button should be. 🎨
action: @escaping () -> Void
The action to be performed when the user taps the button. 🎬▶️
.cornerRadius(radius: CGFloat) -> iPaymentButton
Modifies the corner radius of the payment button ⬛️⚫️. To remove the rounded courners, set this value to 0.0 0️⃣👌. The default value is set to 4.0 🍀.

Community

Meet the developers behind iPaymentButton.


@benjaminsage


iOS 13.0+

WatchOS 6.0+