Skip to content

tapayadot/accept-ios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AcceptSDK

Platform iOS Docs License SPM

iOS SDK for integrating Tapaya Accept payment processing into your app.

Installation

Swift Package Manager

Add via Xcode: File → Add Package Dependencies and enter:

https://github.com/tapayadot/accept-ios.git

Or add to your Package.swift:

dependencies: [
    .package(url: "https://github.com/tapayadot/accept-ios.git", from: "1.2.2")
]

Usage

Setup

import AcceptSDK

// Initialize (call once at app launch)
try await Accept.initialize(demo: isTestMode)

// Authenticate with your merchant token
try await Accept.authenticate(merchantToken: "your-merchant-token")

Card Payment

let outcome = try await Accept.pay(AcceptCardPaymentIntent(
    amount: 1000,
    requestedCurrency: "EUR",
    settlementCurrency: "EUR"
))

switch outcome {
case .completed(let status):
    print("Payment completed: \(status.paymentToken)")
case .canceled:
    print("Payment canceled")
}

Currencies are ISO 4217 alpha-3 codes (e.g. "EUR", "CZK", "USD").

SEPA Instant Credit Transfer

let outcome = try await Accept.pay(AcceptSepaPaymentIntent(
    amount: 1000,
    requestedCurrency: "EUR",
    settlementCurrency: "EUR"
))

switch outcome {
case .completed(let status):
    print("Payment completed: \(status.paymentToken)")
case .canceled:
    print("Payment canceled")
}

Certis (Czech Instant Transfer)

let outcome = try await Accept.pay(AcceptCertisPaymentIntent(
    amount: 10000,
    requestedCurrency: "CZK",
    settlementCurrency: "CZK"
))

switch outcome {
case .completed(let status):
    print("Payment completed: \(status.paymentToken)")
case .canceled:
    print("Payment canceled")
}

Refund a Payment

let refund = try await Accept.refund(
    paymentToken: "pay_…",
    reason: .customerRequest
)

print(refund.refundToken, refund.status)

Reasons: .customerRequest, .duplicate, .fraudulent, .expiredCharge. Pass an optional refundToken as an idempotency key for safe retries. Throws .refundConflict if the payment is not refundable or the token was reused, .paymentNotFound if the payment token is unknown.

Look Up Payment Status

Query the result of a previously initiated payment without going through the full payment flow — useful when resuming after an app restart:

let status = try await Accept.getPaymentStatus(for: "pay_…")

Cancel the Active Payment

Dismisses the in-flight SDK UI and cancels the transaction server-side if it is still pending. The suspended Accept.pay(…) call returns .canceled.

try Accept.cancelActivePayment()
// throws .noActivePayment if no payment flow is running

KYB Onboarding

let result = try await Accept.presentKyb(prefilling: KybPrefillData(
    businessType: .company,
    countryCode: "DE",
    legalName: "Acme GmbH",
    businessEmail: "hello@acme.de"
))

switch result {
case .submitted:
    print("KYB submitted")
case .cancelled:
    print("User cancelled")
case .failed:
    print("Onboarding failed")
}

Merchant Onboarding Status

let status = try await Accept.getOnboardingStatus()

// Check if merchant is onboarded
print(status.isOnboarded)

// Check status of a specific payment method
if let cardStatus = status.status(for: .card) {
    print(cardStatus.isReady) // true if .active or .attentionNeeded
}

Or query a single method directly:

let cardStatus = try await Accept.getPaymentMethodStatus(for: .card)
// .notStarted | .pending | .actionRequired
// | .attentionNeeded | .active | .blocked

Theming

The SDK UI can be customized with your brand colors and logo. Pass a theme at initialization or update it any time before presenting a flow.

Colors

try await Accept.initialize(
    environment: .production,
    theme: AcceptThemeConfiguration(
        colors: .local(AcceptColorTheme(accent: AcceptColor(hex: "#2D6A4F")))
    )
)

AcceptColor accepts a UIColor, sRGB doubles, 8-bit channels, a hex string ("#RRGGBB", "RRGGBBAA", "RGB"), or a hex integer (0xRRGGBB). The adaptive presets .blue, .red, .orange, and .green wrap the matching UIColor.system… so dark mode is preserved.

AcceptColorTheme properties:

Property Description
accent Primary brand color — drives buttons, tints, and focus rings
error Form validation and error states
warning Warning states
success Success and confirmation states
brandGradientColors Capsule and icon gradient. nil derives from accent.
brandSubtleGradientColors Full-screen background gradient. nil derives from accent.

Images

try await Accept.initialize(
    environment: .production,
    theme: AcceptThemeConfiguration(
        images: .local(AcceptImageTheme(
            brandLogo: UIImage(named: "CompanyLogo")!,        // square, ~40×40 pt
            toolbarLogo: UIImage(named: "CompanyWordmark")!,  // horizontal, transparent bg
            solidLogo: UIImage(named: "CompanyWordmarkSolid")! // for light/colored backgrounds
        ))
    )
)
Property Where it appears Asset guidelines
brandLogo Flow page header (64×64 pt glass container) Square, ~40×40 pt, original rendering
toolbarLogo Payment screen nav bar Horizontal, transparent bg, 28 pt height
solidLogo Light/colored backgrounds Horizontal, no gradient

Updating the theme after initialization

try await Accept.setTheme(AcceptThemeConfiguration(
    colors: .local(AcceptColorTheme(accent: .blue))
))

The theme is captured when a flow is presented — changing it while a flow is on screen does not affect the running flow.

Documentation

Full documentation is available at docs.tapaya.com.

License

Licensed under the Apache License, Version 2.0.

About

Official repository for the Accept SDK, including public documentation, packages, and integration resources.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages