Deposit Funds into Liquidity Providers
Learn how to deposit funds into liquidity provider accounts.
Liquidity Provider Deposit - Data Model
field | type | description |
---|---|---|
id | string | ID of the liquidity provider deposit. Usually in the form of a UUID. > Post Requests: Omit this field. |
liquidityProviderId | string | Id of the liquidity provider the deposit was performed on |
paymentGatewayId | string | Payment Gateway that performed the deposit |
paymentGatewayTransactionId | string | Transaction ID supplied by the payment gateway for this deposit. Should be unique |
amount | string | Amount deposited into the liquidity provider’s account. Should be a string |
currency | string | Three letter currency code used to deposit funds into the liquidity provider’s account |
blockchainTransactionId | string | Transaction ID on the blockchain for a successful deposit. > POST Requests: Omit this field. |
Liquidity Provider Deposit - API Calls
Acknowledge a new deposit from a liquidity provider to a payment gateway.
{
"paymentGatewayId"
: “[string]
Id of the gateway acknowledging the deposit.”,
"paymentGatewayTransactionId"
: “[string]
Unique transaction id generated by the payment gateway.”,
"amount"
: “[string]
Amount to deposit into liquidity provider’s wallet account.”,
"currency"
: “[string]
Three letter currency used for this deposit.”
}
Get list of deposits to a liquidity provider account.
Try it out:
Let’s deposit funds into a liquidity provider account
Tools you might need
These are the tools you might need to follow along this tutorial.
linux
ormac
: Many of the command line examples have been customized for UNIX-like operating systems.curl
: To perform API calls.- mac:
brew install curl
- ubuntu/debian:
sudo apt-get install curl
- mac:
jq: To process json on the command line.
- mac:
brew install jq
- ubuntu/debian:
sudo apt-get install jq
- mac:
jo: To create json on the command line.
- mac:
brew install jo
- ubuntu/debian:
sudo apt-get install jo
- mac:
openssl: To perform cryptographic operations on the command line.
- mac:
brew install openssl
- ubuntu/debian:
sudo apt-get install openssl
- mac:
RSA Keys
Depositing funds requires digital signatures as previously outlined in our Security Prologue.
To facilitate our command line operations for this tutorial, we will store our payment gateway RSA keys in special folders.
mkdir -p ~/.pape-rsa-keys
The private and public keys of each payment gateway you manage should be kept inside the above folder with the format below:
- ~/.pape-rsa-keys/
paymentGatewayId
.pub for the public key, and - ~/.pape-rsa-keys/
paymentGatewayId
.priv for the private key
e.g.
- ~/.pape-rsa-keys/ng.bank.ecobank.ngn.pub for the public key, and
- ~/.pape-rsa-keys/ng.bank.ecobank.ngn.priv for the private key
Liquidity Provider Account
For the purpose of this demo, you will deposit funds into a liquidity provider you control.
Please contact Interswitch to set you up a new PAPE liquidity provider.
Get Token
export PAPE_TOKEN_ENDPOINT=https://id.dev.projectwhite.io/auth/realms/projectwhite/protocol/openid-connect/token;
export PAPE_API_ENDPOINT=https://apis-alpha.dev.projectwhite.io
export PAPE_USERNAME=cm.wallet.interstellar-demo.xaf;
export PAPE_PASSWORD=abc;
export PAPE_TOKEN=`curl -s --request POST \
--url "$PAPE_TOKEN_ENDPOINT" \
--data-urlencode grant_type=password \
--data-urlencode username=$PAPE_USERNAME \
--data-urlencode password=$PAPE_PASSWORD \
--data-urlencode 'client_id=projectwhite' \
| jq -r ".access_token"`
echo $PAPE_TOKEN
Get Liquidity Providers
curl -s --request GET \
--url "$PAPE_API_ENDPOINT/liquidity-providers" \
--header "accept: application/json" \
--header 'accept: */*' \
--header "Authorization: Bearer $PAPE_TOKEN" | jq .
Sample response
[
{
"id": "807e5a5a-8596-476b-8476-300640a1857b",
"createdAt": "0001-01-01T00:00:00Z",
"updatedAt": "0001-01-01T00:00:00Z",
"pagingToken": "",
"firstName": "Fritz",
"lastName": "Second Liquidity",
"email": "fritz-liquidity@mailinator.com",
"extras": null
},
{
"id": "a3357273-de08-4c05-a432-fd19a8aebc39",
"createdAt": "2022-06-29T21:49:37.654Z",
"updatedAt": "2022-06-29T21:49:37.654Z",
"pagingToken": "1656539377653-1135521159",
"firstName": "support@interstellar.cm",
"lastName": "Liquidity",
"email": "support@interstellar.cm",
"extras": null
},
{
"id": "b772458d-ff50-4aaf-8942-3e2b24ec080f",
"createdAt": "2022-06-29T21:37:37.608Z",
"updatedAt": "2022-06-29T21:37:37.608Z",
"pagingToken": "1656538657607-3344327404",
"firstName": "interswitch@mailinator.com",
"lastName": "Liquidity",
"email": "interswitch@mailinator.com",
"extras": null
}
]
Set Liquidity Provider ID
Identify the liquidity provider ID from the list generated above. Then set it in an environment variable.
export PAPE_LIQUIDITY_PROVIDER_ID=807e5a5a-8596-476b-8476-300640a1857b
Set API Path for Liquidity Provider Deposit
export PAPE_API_PATH="/liquidity-providers/$PAPE_LIQUIDITY_PROVIDER_ID/deposits"
echo $PAPE_API_PATH
Construct JSON Payload
field | type | description |
---|---|---|
paymentGatewayId | string | Payment Gateway that performed the deposit |
paymentGatewayTransactionId | string | Transaction ID supplied by the payment gateway for this deposit. Should be unique |
amount | string | Amount deposited into the liquidity provider’s account. Should be a string |
currency | string | Three letter currency code used to deposit funds into the liquidity provider’s account |
export PAPE_API_PAYLOAD=`jo -p -- \
paymentGatewayId=$PAPE_USERNAME \
-s amount="10000" \
currency=XAF \
-s paymentGatewayTransactionId=$(date +%s)`
echo $PAPE_API_PAYLOAD
Get Signature
export PAPE_CALL_SIGNATURE=`echo -n "$PAPE_API_PATH$PAPE_API_PAYLOAD" | openssl dgst -sha256 -sign ~/.pape-rsa-keys/$PAPE_USERNAME.priv | openssl enc -base64 -A`
echo $PAPE_CALL_SIGNATURE
Call API
curl -s --request POST \
--url "$PAPE_API_ENDPOINT$PAPE_API_PATH" \
--data "$PAPE_API_PAYLOAD" \
--header "accept: application/json" \
--header "X-PAPE-SIGNATURE-BASE64: $PAPE_CALL_SIGNATURE" \
--header 'accept: */*' \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $PAPE_TOKEN" | jq .
Voila !!!