Payins

Create a Payin

This endpoint will allow you to create a payin. In order to complete a payin, it must first be created, then the user must be directed to the Airtm website to confirm/checkout the payin, at which time they will be redirected to a URL of your choosing. See “Usage” below.

We will redirect the user to either confirmationUri or cancelUri with code as a query parameter so you can process the payin as being either confirmed or cancelled.

Usage

  1. Create a payin.
  2. Extract the id from the response and redirect the user to: https://<API Host>/payin/:id User will be redirected for authentication as necessary.
  3. User will confirm or cancel payin from Airtm’s website.
  4. If confirmed, money will be transferred from the user’s Airtm wallet, to your account, and the user will be redirected to the provided confirmationUri. If canceled, no money will be transferred, and the user will be redirected to the provided cancelUri.

Upon confirmation or cancellation, the payin will be considered completed, and the URL residing at /payin/:id will no longer function. Therefore, if you wish to complete an identical payin, you will need to create a new one.

The confirmationUri attribute should not be used for transaction completeness verification, if the URI was requested, it doesn't mean the transaction was completed successfully.

Redirection

[!important] If you are integrating our API in a mobile application, you will need to redirect the user with the payin generated url by making sure that you open the user’s external browser. By implementing this, the user’s device will be able to successfully handle deeplinks and redirect the users to the Airtm app to finish the operation.

Here are some code snippets in the most popular mobile development frameworks for you to implement the redirection:

Swift Example

// instead of opening a WKWebView or a Safari View Controller, do this:

let url = URL(string: "https://app.airtm.com/payin/payin-id")
if UIApplication.shared.canOpenURL(url) {
    UIApplication.shared.open(url)
}

Kotlin Example

val url = "https://app.airtm.com/payin/payin-id"
fun Context.openUrl(url: String?) {
    if (url == null) return

    val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))

    kotlin.runCatching {
        this.startActivity(browserIntent)
    }.onFailure {
        // handle errors gracefully
    }
}

Flutter Example

import 'package:url_launcher/url_launcher.dart';

void openUrl(String? url) async {
  if (url == null) return;

  final uri = Uri.parse(url);

  try {
    await launchUrl(uri, mode: LaunchMode.externalApplication);
  } catch (_) {
    // Fail silently or log if needed
  }
}

React Native Example

import { Linking } from 'react-native';

const openUrl = async (url: string | null | undefined) => {
  if (!url) return;

  try {
    const supported = await Linking.canOpenURL(url);
    if (supported) {
      await Linking.openURL(url);
    }
    // If not supported, you can silently fail or log
  } catch (error) {
    // Optional: Handle errors silently or log
  }
};
post/payins

Request

Request body

codestring required

An arbitrary string of the partner’s choosing. Used to identify and correlate Airtm purchases with partner records.

[!important] Must be unique.

amountnumber double required

The total amount in USD of the purchase.

[!important] This value must correctly correspond to the sum of the amounts associated with each purchase item.

descriptionstring required

A text string describing the purchase. This text is displayed to the user when they are confirming the transaction.

confirmationUristring url required

A URL to redirect the user to when they confirm the transaction.

cancelUristring url required

A URL to redirect the user to when they cancel the transaction.

Example request

{
  "items": [
    {
      "amount": 10,
      "quantity": 1
    }
  ]
}

Response

Ok

idstring uuid required
codestring required

An arbitrary string of the partner’s choosing. Used to identify and correlate Airtm purchases with partner records.

[!important] Must be a unique.

hashstring

Unique hash for the payin operation within the Airtm system.

status'CREATED' | 'CONFIRMED' | 'CANCELED' | 'PROCESSING' | 'FAILED' | 'BRIDGE_FAILED' | 'BRIDGE_CANCELED' required

The current status of the payin

  • CREATED: The payin has been created but not yet confirmed.
  • CONFIRMED: The payin has been confirmed and is ready for processing.
  • CANCELED: The payin has been canceled by the user or system.
  • PROCESSING: The payin is currently being processed.
  • FAILED: The payin has failed due to an error.
  • BRIDGE_FAILED: The payin has failed due to an error in Bridge.
  • BRIDGE_CANCELED: The payin has been canceled due to an error in Bridge.
amountnumber double required

Amount in USD that was transacted in the operation.

netAmountnumber double required

Amount in USD to be received by the enterprise

airtmFeenumber double required

Amount to be collected by Airtm as fee

descriptionstring required

A text string describing the purchase.

[!tip] This text is displayed to the user when they are confirming the transaction.

airtmUserIdstring uuid
airtmUserEmailstring
failureReasonstring

If the payin failed to complete, this field will describe why it failed.

createdAtstring date-time required

Timestamp of when the payin was created.

updatedAtstring date-time required

Timestamp of the last update made to the payin.

confirmationUristring url required

A URL to redirect the user to when they confirm the transaction.

cancelUristring url required

A URL to redirect the user to when they cancel the transaction.

Example response

{
  "amount": 10,
  "netAmount": 9.5,
  "airtmFee": 0.5,
  "items": [
    {
      "amount": 10,
      "quantity": 1
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.