Zay Pay iOS SDK guide

Integration of Zay Pay is designed to be simple and fast. Follow the steps below to get started.

1

Import the framework

import ZayPay
2

Customize the UI

Define your colors and button corner radius:

import UIKit
import ZayPay

struct PumpFunColorsAssetsProvider: ColorsAssetsProvider {
    static var backgroundPrimary: UIColor { .init(red: 0.059, green: 0.059, blue: 0.071, alpha: 1.0) }
    static var backgroundSecondary: UIColor { .init(red: 0.157, green: 0.161, blue: 0.176, alpha: 1.0) }
    static var backgroundTertiary: UIColor { .init(red: 0.294, green: 0.298, blue: 0.31, alpha: 1.0) }
    static var backgroundAttention: UIColor { .init(red: 1.0, green: 0.584, blue: 0.0, alpha: 0.122) }
    static var backgroundAttentionSuccess: UIColor { .init(red: 0.251, green: 0.749, blue: 0.176, alpha: 1.0) }
    static var backgroundAttentionFailure: UIColor { .init(red: 0.812, green: 0.239, blue: 0.247, alpha: 1.0) }
    static var backgroundButtonPrimary: UIColor { .init(red: 0.624, green: 0.922, blue: 0.69, alpha: 1.0) }
    static var backgroundButtonSecondary: UIColor { .init(red: 0.169, green: 0.22, blue: 0.2, alpha: 1.0) }

    static var fillPrimary: UIColor { .init(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) }
    static var fillSecondary: UIColor { .init(red: 0.494, green: 0.498, blue: 0.506, alpha: 1.0) }
    static var fillTertiary: UIColor { .init(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) }
    static var fillButtonPrimary: UIColor { .init(red: 0.082, green: 0.086, blue: 0.106, alpha: 1.0) }
    static var fillButtonSecondary: UIColor { .init(red: 0.624, green: 0.922, blue: 0.69, alpha: 1.0) }

    static var textAttention: UIColor { .init(red: 0.91, green: 0.525, blue: 0.114, alpha: 1.0) }
    static var textAttentionSuccess: UIColor { .init(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) }
    static var textAttentionFailure: UIColor { .init(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) }

    static var outline: UIColor { .init(red: 1.0, green: 1.0, blue: 1.0, alpha: 0.102) }

    static var logo: UIColor { .init(red: 0.357, green: 0.361, blue: 0.373, alpha: 1.0) }
}

struct PumpFunUIConstantsProvider: UIConstantsProvider {
    static var commonButtonCornerRadius: CGFloat { 8.0 }
}

Create the main assets provider:

struct PumpFunAssetsProvider: AssetsProvider {
    static var colorsAssetsProviderType: ColorsAssetsProvider.Type {
        PumpFunColorsAssetsProvider.self
    }
    static var uiConstantsProvider: UIConstantsProvider.Type {
        PumpFunUIConstantsProvider.self
    }
}

Register your theme at startup:

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

func application(_ application: UIApplication, didFinishLaunchingWithOptions  launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // 3. Apply your custom theme to the SDK
    Zay.setAssetsProviderType(PumpFunAssetsProvider.self)
    return  true
}

// ... other AppDelegate methods

}
3

Present the UI

Zay.launch(in: hostViewController,
            apiKey: apiKey,
            secret: secret,
            withdrawAddress: withdrawAddress,
            options: .init(
                    showDepositModeSwitcher: false,
                    startingDepositMode: .crypto
                )
            )

Parameters:

  • hostViewController: the presenting controller

  • apiKey: your Zay Pay API key

  • secret: your Zay Pay API secret

  • withdrawAddress: destination Solana address for the converted SOL

Last updated