iOS SDK

The MoneyHash iOS SDK allows developers to integrate MoneyHash payment processing into their mobile applications. With this SDK, you can easily accept customer payments, manage subscriptions, and send payouts in your iOS apps.

Prerequisites

Before integrating MoneyHash with the native iOS (Swift) SDK, ensure you have completed the following steps:

  1. Get Started with MoneyHash to access your own Organization.
  2. Create an Account within your Organization.
  3. Connect providers to your new Account.
  4. Set up your Payment Defaults.
  5. Obtain your API keys from the dashboard to make API calls.

Installing

To install MoneyHash's iOS Swift SDK, you can use Swift Package Manager (SPM).

Using Swift Package Manager (SPM)

  1. Open Your Project in Xcode.

  2. Add Package Dependency:

    • Go to File > Add Packages.

    • Enter the repository URL:

      https://github.com/MoneyHash/moneyhash-ios
      
  3. Choose the Latest Stable Version.

  4. Add the Package to your target.


Integration

After installing the MoneyHash iOS Swift SDK, you can start integrating it into your iOS application. The integration involves several key steps:

Step 1: Create an Intent

Before initiating any payment or payout process, you need to create an Intent on your server. An Intent represents a payment or payout operation that you plan to perform.

Ensure you receive and store the intentId from your server's response, as you will need it in subsequent steps.

Step 2: Import the MoneyHash SDK

Import the MoneyHash SDK into your Swift files where you plan to use it.

import MoneyHash

Step 3: Create a MoneyHash Instance

Create an instance of MoneyHashSDK.

let moneyHashSDK = MoneyHashSDK()

Step 4: Set the Public API Key

Set your public API key to authenticate your SDK instance. Obtain your public API key from the MoneyHash Dashboard under your Account settings. For more information on obtaining your public API key, see the MoneyHash Authentication Documentation.

moneyHashSDK.setPublicKey("your_public_api_key")

Step 5: Get Intent Details

Retrieve the details of the intent that was created earlier by your server. This will provide you with the current state of the intent and other relevant information.

do {
    let intentDetails = try await moneyHashSDK.getIntentDetails(
        intentId: "<intent_id>",
        intentType: .payment // or .payout
    )
    print("Intent Details: \(intentDetails)")
} catch {
    print("Error retrieving intent details: \(error)")
}

Refer to the IntentDetails model for a complete list of available properties.


Basic Concepts


Overview of MoneyHash APIs

For a detailed guide to all available APIs in the MoneyHash SDK for iOS, including parameters, return types, and usage examples, refer to the following documentation:

This includes methods for handling payments, retrieving intent details, submitting forms, and more.


Overview of MoneyHash Models

The MoneyHash SDK for iOS features various models to represent data structures like intents, payment methods, transactions, and card information. For comprehensive details on these models, including their properties and usage within the SDK, see the Models Documentation.


Questions and Issues

Please provide any feedback or report issues via a GitHub Issue.