https://revolutdev.github.io/business-api/
https://developer.revolut.com/docs/merchant-api/
- Business API
- Merchant API
For merchant API you only need a merchant API key
- Clone RevolutLib from GitHub inside your project directory
- Add the RevolutApi project to yout solution
- Add a reference to the RevolutApi project
- generate certificate on machine with openssl (bellow snippet in ubuntu)
openssl genrsa -out privatekey.pem 1024
openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 1825
openssl pkcs12 -inkey privatekey.pem -in publickey.cer -export -out revolut_pfx.pfx
base64 revolut_pfx.pfx
- copy public cert into revolut
cat publickey.cer
- because .NET core currnetly does not support *.pem certificats we created pfx in previous step now what we need to to is just to base64 encode certificate and we paste it into our configuration
base64 revolut_pfx.pfx
- Include nuget package
This part requres manual work where we need to provide new authorization code every 90 days.
Call function AuthorizationApiClient.Authorize
providing all the parameters
// issuer shuld be without http or https
Result<AuthorizationCodeResp> authorisationResp = await authorizationApiClient.Authorize("base64enconced pfx cert","certificate password","your domain (issuer)", "clientId provided by revolut", "authorization code provided by revolut");
// here you save rerresh token
db.Save(authorisationResp.Value.RefreshToken);
RevolutApiClient revolutApiClient = new RevolutApiClient(settings.Value.RevolutSettings.Endpoint, new RevolutAPI.Models.Authorization.RefreshAccessTokenModel
{
PrivateCert = "base64enconced pfx cert",
CertificatePassword = "certificate password",
ClientId = "clientId provided by revolut",
Issuer = "your domain (issuer)",
RefreshToken = db.getLastRefreshToken()
}, memoryCache);
CounterPartiesApiClient counterPartiesApiClient = new CounterPartiesApiClient(revolutApiClient);
Result<AddNonRevolutCounterpartyResp> resp = await _counterPartyApiClient.CreateNonRevolutCounterparty(req);
GetAccounts()
- Retrieves your accountsGetAccount(string id)
- Retrieves one of your accounts by IDGetAccountDetails()
- Retrieves individual account details
CreateCounterparty()
- Create a counterparty for an existing Revolut user.CreateCounterparty(AddCounterpartyReq req)
- You can create a counterparty for an non-Revolut bank account.CreateNonRevolutCounterparty(AddNonRevolutCounterpartyReq req)
- Create a counterparty for an non-Revolut bank account.DeleteCounterparty(string id)
- Deletes a counterparty with the given ID. Once a counterparty is deleted no payments can be made to it.GetCounterparty(string id)
- Retrieves a counterparty by ID.GetCounterparties()
- Retrieves all your counterparties.
GetTransfer(TransferReq req)
- Processes transfers between accounts of the business with the same currency.CreatePayment(CreatePaymentReq req)
- Creates a new payment. If the payment is for another Revolut account, business or personal.SchedulePayment(SchedulePaymentReq req)
- 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.CheckPaymentStatusByTransactionId(string transactionId)
- Retrieves transaction details by transaction ID. It also allows you to find out more about the transaction, such as cardholder details for card payments.CheckPaymentStatusByRequestId(string requestId)
- 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.CancelPayment(string transactionId)
- Cancel a scheduled transaction that was initiated by you, via API.GetTransactions(DateTime from, DateTime to, string type, string counterparty = null)
- Retrieves historical transactions based on the provided query criteria.GetTransactions(string from = null, string to = null, string counterparty = null, int count = 0, string type = null)
- Retrieves historical transactions based on the provided query criteria.
In order to run tests you need to modify the Config.cs
file in the RevolutApiTests project.
This file contains global values used during test execution. The values are:
ENDPOINT
- The endpoint used during testingTOKEN
- The authorization token
The following values are used when testing the payment endpoints.
ACCOUNT_ID
- Sender accountCOUNTERPARTY_ID
- Reciever counterpartyCOUNTERPARTY_ACCOUNT_ID
- Reciever counterparty accountCURRENCY
- Currencry used in the trasaction tests
NOTE: These values should be prexisting accounts and couterparties with a non-empty balance. The currencty should also match, otherwise the tests will fail.