Swift SDK for the Revolut Open Business API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Example
Revolut.xcodeproj
Revolut
RevolutTests
LICENSE
README.md
Revolut.png

README.md

Swift SDK for the Revolut Open Business API

Revolut

Swift SDK for the Revolut Open Business API.

Platform iOS Swift 4 compatible Carthage compatible License: MIT

By MANDELKIND.

Getting Started

Set the API Key on application start in application:didFinishLaunchingWithOptions of the app's delegate:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // MARK: Set your Revolut API Key
    // It should have one of the following formats:
    //
    // Sandbox: sand_XXXXXXX
    // Production: prod_XXXXXXX
    
    Revolut.configure("sand_XXXXXXX")

Now you're able to call the endpoints below.

Accounts

Get Accounts

This endpoint retrieves your accounts.

Revolut.shared.accounts(
    completionHandler: ([Account]?, Error?) -> Void
)

Get Account

This endpoint retrieves one of your accounts by ID.

Get Account Details

This endpoint retrieves individual account details.

Counterparties

Before a transfer or payment can be made, you need to add the counterparties with which you intend to transact with.

Add Revolut Counterparty

You can create a counterparty for an existing Revolut user.

Add non-Revolut Counterparty

You can create a counterparty for an non-Revolut bank account.

Delete Counterparty

This endpoint deletes a counterparty with the given ID. Once a counterparty is deleted no payments can be made to it.

Get Counterparty

This endpoint retrieves a counterparty by ID.

Get Counterparties

This endpoint retrieves all your counterparties.

Payments

All incoming and outgoing payments are represented as transactions and are processed in two stages from the user's perspective:

  1. a new transaction is created,
  2. the created transaction is processed, i.e.
  • credit/debit on both sides of transaction if Revolut-to-Revolut,
  • posted to the external payment network (Faster Paymetns, SEPA, SWIFT etc.).

A new transaction has pending state, and a processed transaction's state can be one of completed, failed, reverted or declined.

Transfer

This endpoint processes transfers between accounts of the business with the same currency.

Create Payment

This endpoint creates a new payment. If the payment is for another Revolut account, business or personal, the transaction may be processed synchronously.

Schedule Payment

It is possible to schedule an internal payments for up to 30 days ahead. Scheduling external payments is not supported at the moment. Scheduled payments must be in the currency of the account from which you pay.

Check Payment Status

This endpoint retrieves transaction details by transaction ID or by request ID. It also allows you to find out more about the transaction, such as cardholder details for card payments.

Cancel Payment

This endpoint allows to cancel a scheduled transaction that was initiated by you, via API.

Get Transactions

This endpoint retrieves historical transactions based on the provided query criteria.

Revolut.shared.transactions(
    where: [Revolut.TransactionsFilter],
    completionHandler: (([Transaction]?, Error?) -> Void)
)

Webhooks

Web-hook is a mechanism that allows you to receive updates about your account to an HTTPS endpoint provided by you. When a supported event occurs, a notification will be posted, via HTTP POST method, to the specified endpoint. If the receiver returns an HTTP error response, there will be two more consequent attempts for delivery.

Currently the following events are supported:

  • Transaction Creation (TransactionCreated)
  • Transaction State Change (TransactionStateChanged)

Errors

The API may return one of the following errors:

Error Description
 .badRequest Your request is invalid.
 .unauthorized Your API key is wrong.
 .forbidden Access to the requested resource or action is forbidden.
 .notFound The requested resource could not be found.
 .methodNotAllowed You tried to access an endpoint with an invalid method.
 .notAcceptable You requested a format that isn't JSON.
 .unprocessableEntity The server response does not match the expected format.
 .tooManyRequests You're sending too many requests.
 .internalServerError We had a problem with our server. Try again later.
 .serviceUnavailable We're temporarily offline for maintenance. Please try again later.