Skip to content

Commit 0d1791e

Browse files
committed
feat: simple Rafiki integration guide
1 parent 4f25c87 commit 0d1791e

2 files changed

Lines changed: 116 additions & 0 deletions

File tree

559 KB
Loading
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: 'Simple Rafiki Integration Guide'
3+
description: 'TBD'
4+
date: 2026-03-18
5+
slug: simple-rafiki-integration-guide
6+
authors:
7+
author_urls:
8+
tags:
9+
- Rafiki
10+
- Integration
11+
- Updates
12+
---
13+
14+
15+
## ASE and Rafiki responsibilities
16+
17+
![Overview of responsibilities between ASE and Rafiki](/developers/img/blog/2026-03-18/responsibilies.png)
18+
19+
## Open Payments and ILP
20+
21+
### Open Payments API
22+
Open Payments is an API standard for allowing **third-party clients** to initiate payments between wallet addresses.
23+
24+
#### Use cases
25+
- eCommerce payments
26+
- Peer to peer payments (e.g. remittances)
27+
- Recurring payments (e.g. subscriptions)
28+
29+
### ILP (Interledger Protocol)
30+
A protocol for transferring payments (through packets).
31+
If the Open Payments API is responsible for payment authorization, then ILP is **how** the payments actually happen.
32+
33+
### Basic concepts
34+
#### Wallet addresses
35+
A wallet address is a sharable identifier (URL) linked to an underlying user account at an ASE, and accessible via the Open Payments API standard.
36+
37+
#### Assets
38+
Assets represent monetary values, for example, country currencies. Each asset is made up of a code, and a scale to represent the decimal units. For example, US dollars can be deliniated as code: `USD`, with scale `2`, where value `1000` represents `$10.00`.
39+
40+
### Integrating Rafiki with your system
41+
#### Components
42+
Currently, Rafiki is made up of three software components:
43+
- `backend`: hosts the Open Payments resource server, ILP connector, and the Admin API
44+
- `auth`: hosts the Open Payments auth server
45+
- `frontend`: UI to manage the Rafiki resources (wallet addresses, payments, assets, e.t.c.) through the Admin API.
46+
47+
#### Admin API
48+
As an ASE, the main entrypoint into the Rafiki system will be through the Admin API. This is a GraphQL API.
49+
50+
### Integration steps
51+
#### Creating assets
52+
In order to begin your Rafiki integration, you need to load the assets you will support for your users. For example, if you will be supporting US dollars, you must create an USD asset in Rafiki [through the Admin UI or Admin API](https://rafiki.dev/integration/requirements/assets/).
53+
54+
#### Creating wallet addresses
55+
After creating at least one asset, you can start [creating wallet addresses](https://rafiki.dev/integration/requirements/wallet-addresses/) under that asset. This wallet address must be linked to a user account in your sytem, and will be publicly accessible through the Open Payments API.
56+
57+
#### Making payments
58+
Making payments consists of three parts:
59+
60+
61+
##### 1. Creating an incoming payment
62+
First, you will need to create an incoming payment for a recipient's wallet address using the [Admin API's `createIncomingPayment`](https://rafiki.dev/apis/graphql/backend/#mutation-createIncomingPayment). This will set up a resource to pay into.
63+
64+
##### 2. Creating a quote
65+
Second, you will need to create a quote for a sender's wallet address using the [Admin API's `createQuote`](https://rafiki.dev/apis/graphql/backend/#mutation-createQuote). This will show how much it will cost the sender to deliver an amount to the receiver.
66+
67+
##### 3. Creating an outgoing payment
68+
Third, you will create an outgoing payment for the sender's wallet address using the [Admin API's `createOutgoingPayment`](https://rafiki.dev/apis/graphql/backend/#mutation-createOutgoingPayment). This will be the operation to actually start the payment. At this point, you as the ASE will need to fund/approve the outgoing payment before it gets sent.
69+
70+
###### Webhook request handling
71+
When operating Rafiki, you as the ASE will be notified about events that happen in the system, e.g. an incoming payment was created or expired. Some of these events are actionable, for example, the outgoing payment created event. When an outgoing payment is created, you as the ASE will need to:
72+
1. Check that the user account (for the linked wallet address) is active
73+
2. Check that the user account has enough balance to make the payment
74+
3. Reserve funds on the user account
75+
4. Notify Rafiki to approve the outgoing payment by calling the [`depositOutgoingPaymentLiquidity` API](https://rafiki.dev/apis/graphql/backend/#mutation-depositOutgoingPaymentLiquidity).
76+
77+
Once the outgoing payment has been approved/funded, Rafiki will make the payment between the sender and receiver.
78+
79+
5. If the payment in Rafiki is successful, you will receive an outgoing payment completed webhook. When this is received, you should finalize the debit of the sending user's account.
80+
6. You will also receive an incoming payment completed (or incoming payment expired) webhook. For these webhooks, you should credit the recepient's user account.
81+
82+
83+
```mermaid
84+
sequenceDiagram
85+
participant ASE as ASE (you)
86+
participant R as Rafiki
87+
88+
89+
ASE ->> R: createIncomingPayment Admin API
90+
R -->> ASE: incoming_payment.created webhook
91+
ASE ->> R: Create quote
92+
93+
ASE ->> R: createOutgoingPayment Admin API
94+
R -->> ASE: outgoing_payment.created webhook
95+
ASE ->> ASE: Check user account status, balance & reserve funds
96+
ASE ->> R: depositOutgoingPaymentLiquidity Admin API
97+
R ->> R: Payment is made between sender and receiver
98+
R -->> ASE: outgoing_payment.completed webhook
99+
ASE ->> ASE: Finalize debit on sender account
100+
R -->> ASE: incoming_payment.completed (or expired) webhook
101+
ASE ->> ASE: Credit receiver's account
102+
```
103+
104+
The [Rafiki documentation](https://rafiki.dev/integration/requirements/webhook-events/) describes all of the webhook events and how they should be handled.
105+
106+
> [!NOTE]
107+
> When Rafiki sends a webhook to the ASE, it expects a 200 response. Otherwise, it will keep retrying.
108+
109+
## FAQ
110+
### What APIs are exposed publicly?
111+
Open Payments endpoints + ILP connector. The Admin API must not be exposed externally.
112+
113+
114+
### Can you make cross-currency payments?
115+
In order to make cross-currency payments, you will need to create the corresponding assets, and [provide a way for Rafiki to fetch rates](https://rafiki.dev/integration/requirements/exchange-rates/).
116+

0 commit comments

Comments
 (0)