Remittances SDK for iOS

The Remittances SDK is a solution to ease the integration with the Alviere services.

Features

  • Beneficiary Management
  • Global Payments
  • Cash Pickups
  • Payout Methods Management

Requirements

  • iOS 13.0+
  • Xcode 15+
  • Swift 5.5+

Installation

Swift Package Manager

1. Add the dependency to your project. Open your project and navigate to your project’s settings. Select the tab named Swift Packages and click on the add button + at the bottom left.

image

2. Enter the url of Remittances SDK for the iOS repository (https://github.com/Alviere/alviere-remittances-ios) in the text field and click Next.

image

3. On the next screen, select the SDK version and click Next.

image

4. Select the RemittancesSDK package and click Finish.

image

5. Repeat the same process for AlCore SDK (https://github.com/Alviere/alviere-core-ios). The current version is compatible with AlCore SDK version 0.9.0 and up.

CocoaPods

1. Get the latest version of CocoaPods, if you haven’t already.

2. Create the Podfile by running the following command, if you don’t have one already.

pod init

3. Add this line to your Podfile.

pod 'RemittancesSDK'

4. Run the following command to install the library. Also, run this to update to newer releases in the future.

pod install

Carthage

1. Get the latest version of Carthage, if you haven’t already.

2. Add the following entries in your Cartfile:

binary https://raw.githubusercontent.com/Alviere/alviere-core-ios/master/AlCore.json
binary https://raw.githubusercontent.com/Alviere/alviere-remittances-ios/master/RemittancesSDK.json

3. Run the following command to download the latest version of the SDK.

carthage update --use-xcframeworks

4. Follow the Manual instructions below to embed the SDK into your project.

Manual

1. Get the latest versions of RemittancesSDK.xcframework and AlCore.xcframework and embed them into your application by dragging and dropping the files onto the Frameworks, Libraries and Embedded Content project section, as shown below.

image

2. Depending on the location of RemittancesSDK.xcframework and AlCore.xcframework on the filesystem you may need to change the Framework Search Paths build setting to avoid the error: fatal error: ‘RemittancesSDK/RemittancesSDK.h’ file not found. For example, the Xcode project below have it set to FRAMEWORK_SEARCH_PATHS = $(PROJECT_DIR)/../ since the xcframeworks files are shared between them and are kept in the directory that also contains the project directories.

image

Usage

To initialize the Remittances SDK for iOS, you need to set the Environment at the entry point of your application. For example, you can do this on your AppDelegate file on the application(_:,didFinishLaunchingWithOptions:) method, as shown below.

import AlCore

...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Setup Alviere SDK.
    if !AlCoreSDK.shared.setEnvironment(.sandbox) {
        print("Error initializing SDK.")
    }
    return true
}

After this setup, you just need to import the Remittances SDK for iOS on the files where you want to use the features.

import RemittancesSDK

Beneficiary Management

Create a Beneficiary

To create a beneficiary, use createBeneficiary where you will need to pass the auth_token, pass the accountUuid of the user and the CreateBeneficiaryRequest model with the data.

let request = CreateBeneficiaryRequest( ... )

let response = try await AlRemittances.shared
    .createBeneficiary(
        token: authToken,
        accountUuid: accountUuid,
        data: request
    )

This action will return a Beneficiary or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

List Beneficiaries

To list beneficiaries, use listBeneficiaries where you will need to pass the auth_token and pass the accountUuid of the user.

let response = try await AlRemittances.shared
    .listBeneficiaries(
        token: authToken,
        accountUuid: accountUuid
    )

This action will return a Beneficiary list or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Get Beneficiary

To get a beneficiary, use getBeneficiary where you will need to pass the auth_token, pass the accountUuid of the user and pass the beneficiaryUuid.

let response = try await AlRemittances.shared
    .getBeneficiary(
        token: authToken,
        accountUuid: accountUuid,
        beneficiaryUuid: beneficiaryUuid
    )

This action will return a Beneficiary or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Update a Beneficiary

To update a beneficiary, use updateBeneficiary where you will need to pass the auth_token, pass the accountUuid of the user, pass the beneficiaryUuid and pass the UpdateBeneficiaryRequest model with the data.

let request = UpdateBeneficiaryRequest( ... )

let response = try await AlRemittances.shared
    .updateBeneficiary(
        token: authToken,
        accountUuid: accountUuid,
        beneficiaryUuid: beneficiaryUuid,
        data: request
    )

This action will return a Beneficiary or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Delete a Beneficiary

To delete a beneficiary, use deleteBeneficiary where you will need to pass the auth_token, pass the accountUuid of the user and the beneficiaryUuid.

try await AlRemittances.shared
    .deleteBeneficiary(
        token: authToken,
        accountUuid: accountUuid,
        beneficiaryUuid: beneficiaryUuid
    )

This action will not return a response but can throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Global Payments

Create a Quote

To create a quote, use createQuote where you will need to pass the auth_token, pass the walletUuid and the CreateQuoteRequest model with the data.

let request = CreateQuoteRequest( ... )

let response = try await AlRemittances.shared
    .createQuote(
        token: authToken,
        walletUuid: walletUuid,
        data: request
    )

This action will return a Quote or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Create a Remittance

To create a remittance, use createRemittance where you will need to pass the auth_token, pass the walletUuid and the CreateRemittanceRequest model with the data.

let request = CreateRemittanceRequest( ... )

let response = try await AlRemittances.shared
    .createRemittance(
        token: authToken,
        walletUuid: walletUuid,
        data: request
    )

This action will return a Remittance or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Cash Pickup

List Cash Pickup Cities

To list cash pickup cities, use listCashPickupCities where you will need to pass the auth_token and pass CashPickupCitiesQuery with at least the country defined.

let query = CashPickupCitiesQuery(country: "MEX")

let response = try await AlRemittances.shared
    .listCashPickupCities(
        token: authToken,
        query: query
    )

This action will return a CashPickupCity list or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

List Cash Pickup Locations

To list cash pickup locations, use listCashPickupLocations where you will need to pass the auth_token and pass CashPickupLocationsQuery with at least the city_uuid defined.

let query = CashPickupLocationsQuery(cityUuid: cityUuid)

let response = try await AlRemittances.shared
    .listCashPickupLocations(
        token: authToken,
        query: query
    )

This action will return a CashPickupLocation list or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Get Cash Pickup Location

To get a cash pickup location, use getCashPickupLocation where you will need to pass the auth_token and pass the location_uuid.

let response = try await AlRemittances.shared
    .getCashPickupLocation(
        token: authToken,
        locationUuid: locationUuid
    )

This action will return a CashPickupLocation or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Payout Methods

Create a Payout Method

To create a payout method, use createPayoutMethod where you will need to pass the auth_token, pass the beneficiaryUuid and the CreatePayoutMethodRequest model with the data.

let request = CreatePayoutMethodRequest( ... )

let response = try await AlRemittances.shared
    .createPayoutMethod(
        token: authToken,
        beneficiaryUuid: beneficiaryUuid,
        data: request
    )

This action will return a PayoutMethod or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

List Payout Methods

To list payout methods, use listPayoutMethods where you will need to pass the auth_token and pass the beneficiaryUuid.

let response = try await AlRemittances.shared
    .listPayoutMethods(
        token: authToken,
        beneficiaryUuid: beneficiaryUuid
    )

This action will return a PayoutMethod list or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Get Payout Method

To get a payout method, use getPayoutMethod where you will need to pass the auth_token and pass the payoutMethodUuid.

let response = try await AlRemittances.shared
    .getPayoutMethod(
        token: authToken,
        payoutMethodUuid: accountUuid
    )

This action will return a PayoutMethod or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Update a Payout Method

To update a payout method, use updatePayoutMethod where you will need to pass the auth_token, pass the payoutMethodUuid and pass the UpdatePayoutMethodRequest model with the data.

let request = UpdatePayoutMethodRequest( ... )

let response = try await AlRemittances.shared
    .updatePayoutMethod(
        token: authToken,
        payoutMethodUuid: payoutMethodUuid,
        data: request
    )

This action will return a PayoutMethod or throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.

Delete a Payout Method

To delete a payout method, use deletePayoutMethod where you will need to pass the auth_token and pass the payoutMethodUuid.

try await AlRemittances.shared
    .deletePayoutMethod(
        token: authToken,
        payoutMethodUuid: payoutMethodUuid
    )

This action will not return a response but can throw an EventError. The keys for the EventError metadata field are defined on the Metadata enum.