Use cases

Building a Digital Wallet

Let’s take an example of a generic digital wallet to see how the Flagright API can be seamlessly used as the compliance and anti-fincrime infrastructure. For a generic wallet, there are three types of transactions:

1. Deposit

A deposit is when a User transfers money from external source (ex: Bank, credit card) to their wallet.

For deposits, the origin payment method is the external source, for example a SWIFT transfer and the destination payment method is the wallet type. In this case, the originUserId would be empty and the destinationUserId would be the userId of the user.

originPaymentMethod would contain information on the SWIFT transaction and the destinationPaymentMethod would contain payload for the wallet details on the user where the money is being deposited to.

To make the following request, you’ll need an API Key. Please reach out if you don’t have one.

You would make an API call to the POST /transactions to verify this transacation before processing, with the payload like so:

POST /transactions
$ curl --request POST \
> --url https://sandbox.api.flagright.com/transactions \
> --header 'Content-Type: application/json' \
> --data '{
> "transactionId": "7b80a539eea6e78acbd6d458e5971482",
> "type": "DEPOSIT",
> "destinationUserId": "9350a2611e0771cba03310f74bf6",
> "originAmountDetails": {
> "country": "DE",
> "transactionAmount": 800,
> "transactionCurrency": "EUR"
> },
> "destinationAmountDetails": {
> "country": "IN",
> "transactionAmount": 68351.34,
> "transactionCurrency": "INR"
> },
> "timestamp": 1641654664,
> "originPaymentDetails": {
> "method": "SWIFT",
> "swiftCode": "AAAABB11CC",
> "accountNumber": "32213423221",
> "accountType": "SAVINGS"
> },
> "destinationPaymentDetails": {
> "method": "WALLET",
> "walletId": "20ac00fed8ef913aefb17cfae1097cce"
> }
> }'

2. Withdrawal

A withdrawal is when a User transfers money from wallet to external source.

For withdrawal, the destination payment method is the external source, for example a SWIFT transfer and the origin payment method is the wallet type. In this case, the originUserId would be the userId of the user and the destinationUserId would be empty.

originPaymentMethod would contain information on the Wallet and the destinationPaymentMethod would contain payload for the SWIFT details on the user where the money is being withdrawn to.

To make the following request, you’ll need an API Key. Please reach out if you don’t have one.

You would make an API call to the POST /transactions to verify this transaction before processing, with the payload like:

POST /transactions
$ curl --request POST \
> --url https://sandbox.api.flagright.com/transactions \
> --header 'Content-Type: application/json' \
> --data '{
> "transactionId": "7b80a539eea6e78acbd6d458e5971482",
> "type": "DEPOSIT",
> "originUserId": "9350a2611e0771cba03310f74bf6",
> "originAmountDetails": {
> "country": "DE",
> "transactionAmount": 800,
> "transactionCurrency": "EUR"
> },
> "destinationAmountDetails": {
> "country": "IN",
> "transactionAmount": 68351.34,
> "transactionCurrency": "INR"
> },
> "timestamp": 1641654664,
> "originPaymentDetails": {
> "method": "WALLET",
> "walletId": "20ac00fed8ef913aefb17cfae1097cce"
> },
> "destinationPaymentDetails": {
> "method": "SWIFT",
> "swiftCode": "AAAABB11CC",
> "accountNumber": "32213423221",
> "accountType": "SAVINGS"
> }
> }'

3. Wallet to Wallet Transfer

For peer-to-peer transfer, the destination payment method and the origin payment method are of wallet type. In this case, the originUserId would be the userId of the user making the payment and the destinationUserId would be the userId of the user receiving the payment.

originPaymentMethod would contain information on the Wallet and the destinationPaymentMethod would contain payload for the Wallet details on the user where the money is being transferred to.

You would make an API call to the POST /transactions to verify this transacation before processing, with the payload like:

POST /transactions
$ curl --request POST \
> --url https://sandbox.api.flagright.com/transactions \
> --header 'Content-Type: application/json' \
> --data '{
> "transactionId": "7b80a539eea6e78acbd6d458e5971482",
> "type": "DEPOSIT",
> "originUserId": "9350a2611e0771cba03310f74bf6",
> "destinationPaymentMethod": "ac00fed8ef913aefb17cfae1097cce07a0",
> "originAmountDetails": {
> "country": "IN",
> "transactionAmount": 68351.34,
> "transactionCurrency": "INR"
> },
> "destinationAmountDetails": {
> "country": "IN",
> "transactionAmount": 68351.34,
> "transactionCurrency": "INR"
> },
> "timestamp": 1641654664,
> "originPaymentDetails": {
> "method": "WALLET",
> "walletId": "33ef69fed7ef123a171e3efae109791d"
> },
> "destinationPaymentDetails": {
> "method": "WALLET",
> "walletId": "20ac00fed8ef913aefb17cfae1097cce"
> }
> }'