SDK Architecture

Overview

This page covers the MoneyHash client SDKs: which SDK to use on each platform, how to install and initialize it, where it sits inside your app, and the common checkout cases - with a diagram and a code example for every platform. For the platform model behind it (intents, keys, orchestration), see How MoneyHash Works and Programmatic Access.

Installation and Initialization

One SDK surface, five platforms. Every SDK exposes the same operations with the same names and payloads - getMethods, proceedWith, secure card fields, collect(), pay(), createCardToken() - so the code you see in one tab below maps one-to-one onto every other platform.

PlatformPackageInstall from
Web@moneyhash/js-sdknpm
iOSMoneyHashSwift Package Manager (CocoaPods also available)
Androidio.moneyhash:androidMaven Central
Fluttermoneyhash_paymentpub.dev
React Native@moneyhash/reactnative-sdknpm

Install the SDK for your platform:

npm install @moneyhash/js-sdk
Xcode → File → Add Package Dependencies…
https://github.com/MoneyHash/moneyhash-spm
// build.gradle.kts
dependencies {
    implementation("io.moneyhash:android:<LATEST_VERSION>")
}
flutter pub add moneyhash_payment
npm install @moneyhash/reactnative-sdk

Then initialize it - one builder call on every platform, holding only your public API key (the secret key stays on your server):

import MoneyHash from "@moneyhash/js-sdk/headless";

const moneyHash = new MoneyHash({
  type: "payment", // or "payout"
  publicApiKey: "<YOUR_PUBLIC_API_KEY>",
});
import MoneyHash

let moneyHash = MoneyHashSDKBuilder()
    .setPublicKey("<YOUR_PUBLIC_API_KEY>")
    .build()
import com.moneyhash.sdk.android.core.MoneyHashSDKBuilder

val moneyHash = MoneyHashSDKBuilder
    .setPublicKey("<YOUR_PUBLIC_API_KEY>")
    .build()
import 'package:moneyhash_payment/moneyhash_payment.dart';

final moneyHash = MoneyHashSDKBuilder().build();
moneyHash.setPublicKey("<YOUR_PUBLIC_API_KEY>");
import { MoneyHashSDKBuilder } from "@moneyhash/reactnative-sdk";

const moneyHash = MoneyHashSDKBuilder.build();
moneyHash.setPublicKey("<YOUR_PUBLIC_API_KEY>");

Inside your app, the SDK owns two things: the calls that drive the intent (your server creates the intent and hands the intent_id to the app - see Programmatic Access), and the secure fields - card inputs rendered in isolated containers (iframes on the web, native secure views on mobile) that send card data directly to the MoneyHash vault, so raw card values never enter your code and your app stays out of PCI scope.

The sections below walk through the common cases in the order a checkout uses them.


Intent States

Every SDK call that moves a payment forward - proceedWith, submitForm,