Reference
shared.services.payment_providers.revolut.entities ¶
CounterPartyInfo
dataclass
¶
RevolutBusinessAccountConfig
dataclass
¶
RevolutBusinessAccountConfig(
base_url,
api_credentials_secret_name,
private_key,
private_key_secret_name,
client_id,
issuer,
reimbursement_account_id=None,
webhook_signing_secret=None,
webhook_signing_secret_name=None,
)
RevolutBusinessAccountName ¶
RevolutBusinessAccountNamesAvailableByCountry ¶
RevolutPrevoyancePaymentAccount
dataclass
¶
This dataclass is storing the name of the env vars used to setup Revolut client. We introduced the model when we had to switch our Revolut business accounts from Alan SA to Alan Insurance.
Alan property is nullable as the bank account for Alan insurer was created immediately on Alan Insurance business account.
RevolutTransactionInfo
dataclass
¶
RevolutTransactionInfo(
id,
type,
request_id,
state,
created_at,
updated_at,
completed_at=None,
reason_code=None,
related_transaction_id=None,
reference=None,
legs=list(),
)
https://developer.revolut.com/docs/business/get-transaction#response ⧉
Leg
dataclass
¶
Leg(
leg_id,
amount,
currency,
account_id,
fee=None,
bill_amount=None,
bill_currency=None,
description=None,
balance=None,
)
reason_code
class-attribute
instance-attribute
¶
The reason code when the transaction state is declined or failed.
RevolutTransactionState ¶
Bases: AlanBaseEnum
Possible states for a payment transaction.
RevolutTransactionType ¶
Bases: AlanBaseEnum
Possible types for a payment transaction.
TransactionCreatedEvent
dataclass
¶
TransactionCreatedEvent(
transaction_id,
account_id,
state,
created_at,
updated_at,
business_account_name,
raw_event,
type,
request_id,
related_transaction_id=None,
legs=list(),
)
Event for Revolut TransactionCreated webhooks.
Emitted when a new transaction is created in Revolut. https://developer.revolut.com/docs/guides/manage-accounts/webhooks/about-webhooks#transaction-created-event ⧉
related_transaction_id
class-attribute
instance-attribute
¶
Only for refund transactions
TransactionStateChangedEvent
dataclass
¶
TransactionStateChangedEvent(
transaction_id,
payment_id,
state,
old_state,
updated_at,
business_account_name,
raw_event,
is_refund=False,
)
Event for Revolut TransactionStateChanged webhooks.
Emitted when an existing transaction changes state. https://developer.revolut.com/docs/guides/manage-accounts/webhooks/about-webhooks#transaction-state-changed-event ⧉
shared.services.payment_providers.revolut.errors ¶
PotentialSwiftError ¶
Bases: RevolutError
A special case of RevolutError. Raised when we think it may be fixable by resetting the SWIFT. Context: many calls to /counterparty fail because we supply the wrong SWIFT number. We don't get details from the 400 response from Revolut, but we want to communicate that it's possibly caused by a SWIFT problem.
Source code in shared/services/payment_providers/revolut/errors.py
RevolutError ¶
Bases: Exception
A generic revolut exception we should handle
Source code in shared/services/payment_providers/revolut/errors.py
RevolutInternalError ¶
Bases: RevolutError
Revolut issue, we can't act on it
Source code in shared/services/payment_providers/revolut/errors.py
RevolutNotAuthorizedError ¶
Bases: RevolutError
The access token is not valid.
We have a scheduled job running every 15 minutes to rotate the access token as it is valid for less than 1h. If the command failed to run for some reason, the token won't have been rotated, and will thus be expired / invalid.
Source code in shared/services/payment_providers/revolut/errors.py
RevolutNotFoundError ¶
Bases: RevolutError
Resource does not exist on Revolut, it is up to us to decide whether we take this error into account or not
Source code in shared/services/payment_providers/revolut/errors.py
RevolutParallelRequestsError ¶
shared.services.payment_providers.revolut.helpers ¶
EEA_COUNTRIES
module-attribute
¶
EEA_COUNTRIES = [
"AT",
"AX",
"BE",
"BG",
"CY",
"CZ",
"DE",
"DK",
"EA",
"EE",
"ES",
"FI",
"FR",
"GB",
"GF",
"GI",
"GP",
"GR",
"HR",
"HU",
"IC",
"IE",
"IT",
"LT",
"LU",
"LV",
"MF",
"MQ",
"MT",
"NL",
"PL",
"PT",
"RE",
"RO",
"SE",
"SI",
"SK",
"YT",
"NO",
"IS",
"LI",
"JE",
"GG",
"IM",
]
PREVOYANCE_BANK_ACCOUNT_CONFIG_MAPPING
module-attribute
¶
PREVOYANCE_BANK_ACCOUNT_CONFIG_MAPPING = {
alan_insurance: RevolutPrevoyancePaymentAccount(
cnp="REVOLUT_ALAN_INSURANCE_PREVOYANCE_CNP_PAYMENT_ACCOUNT_ID",
lamie="REVOLUT_ALAN_INSURANCE_PREVOYANCE_LAMIE_PAYMENT_ACCOUNT_ID",
alan="REVOLUT_ALAN_INSURANCE_PREVOYANCE_ALAN_PAYMENT_ACCOUNT_ID",
)
}
get_revolut_config_from_business_account_name ¶
Source code in shared/services/payment_providers/revolut/helpers.py
is_reimbursement_transaction ¶
Check if a Revolut transaction is linked to Alan's Revolut reimbursement account
Source code in shared/services/payment_providers/revolut/helpers.py
shared.services.payment_providers.revolut.noop_revolut_client ¶
NoopRevolutClient ¶
Revolut client that does nothing.
Can be configured with test data for get_transaction.
Initialize NoopRevolutClient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transaction_info
|
RevolutTransactionInfo | None
|
Optional transaction info to return from get_transaction. If not provided, returns default failed transaction. |
None
|
Source code in shared/services/payment_providers/revolut/noop_revolut_client.py
add_counterparty ¶
add_counterparty(
*,
company_name=None,
first_name=None,
last_name=None,
iban,
bic,
bank_country=None,
address
)
Source code in shared/services/payment_providers/revolut/noop_revolut_client.py
create_payment ¶
create_payment(
*,
request_id,
amount_in_cents,
receiver_counterparty_id,
receiver_account_id,
payment_description=None
)
Source code in shared/services/payment_providers/revolut/noop_revolut_client.py
get_supported_currency ¶
get_transaction ¶
Source code in shared/services/payment_providers/revolut/noop_revolut_client.py
shared.services.payment_providers.revolut.openapi ¶
business ¶
Account ¶
Bases: BaseModel
created_at
instance-attribute
¶
The date and time the account was created in ISO 8601 ⧉ format.
public
instance-attribute
¶
Indicates whether the account is visible to other businesses on Revolut.
updated_at
instance-attribute
¶
The date and time the account was last updated in ISO 8601 ⧉ format.
AccountBankDetailsItem ¶
AccountBankDetailsItems ¶
Bases: RootModel[list[AccountBankDetailsItem]]
AccountCurrency ¶
Bases: RootModel[str]
AccountNameValidationReasonAU ¶
Bases: BaseModel
code
class-attribute
instance-attribute
¶
The reason code. Possible values for AU:
- close_match (business accounts): The provided name is similar to the account name.
The actual name is returned. Mismatched account type is corrected.
- not_matched: The account details don't match the provided values.
- account_does_not_exist: The account does not exist.
- account_switched: The account has been switched using the Current Account Switching Service.
Please contact the recipient for updated account details.
- cannot_be_checked: The account cannot be checked.
AccountNameValidationReasonEUR ¶
Bases: BaseModel
code
class-attribute
instance-attribute
¶
The reason code. Possible values for EUR:
- close_match: The provided name is similar to the account name.
The actual name is returned.
- not_matched: The account details don't match the provided values.
- account_does_not_exist: The account does not exist.
- account_switched: The account has been switched using the Current Account Switching Service.
Please contact the recipient for updated account details.
- cannot_be_checked: The account cannot be checked.
AccountNameValidationReasonRO ¶
Bases: BaseModel
code
class-attribute
instance-attribute
¶
The reason code. Possible values for RO:
- cannot_be_checked: The account cannot be checked.
AccountNameValidationReasonUK ¶
Bases: BaseModel
code
class-attribute
instance-attribute
¶
The reason code. Possible values for UK:
- close_match: The provided name is similar to the account name, the account type is correct.
The actual name is returned.
- individual_account_name_matched: The names match but the counterparty is an individual, not a business.
- company_account_name_matched: The names match but the counterparty is a business, not an individual.
- individual_account_close_match: The provided name is similar to the account name, and the account type is incorrect – the counterparty is an individual, not a business.
The actual name is returned.
- company_account_close_match: The provided name is similar to the account name, and the account type is incorrect - the counterparty is a business, not an individual.
The actual name is returned.
- not_matched: The account details don't match the provided values.
- account_does_not_exist: The account does not exist.
- account_switched: The account has been switched using the Current Account Switching Service.
Please contact the recipient for updated account details.
- cannot_be_checked: The account cannot be checked.
Amount1 ¶
AmountWithCurrency ¶
BankCountryCode ¶
Bases: RootModel[str]
BeneficiaryAddress ¶
Bases: BaseModel
BusinessMerchantCategory ¶
Bases: RootModel[Literal['health', 'general', 'services', 'airlines', 'transport', 'accommodation', 'utilities', 'shopping', 'financial', 'furniture', 'hardware', 'groceries', 'fuel', 'entertainment', 'software', 'restaurants', 'advertising', 'cash', 'education', 'government']]
CardCanBeUnlocked ¶
Bases: RootModel[bool]
root
instance-attribute
¶
Returned for locked cards (state=locked).
Indicates whether the card can be unlocked ⧉ manually (via API or in-app).
If true, you'll still need the necessary scope or permission ⧉ to unlock the card.
Info
Cards can be locked for various reasons. For example, a card can be locked by the user, due to spending period settings, or automatically by the system. Only certain types of lock can be lifted manually.
CardContacts ¶
Bases: RootModel[list[CardContact]]
CardCreatedResponse ¶
Bases: BaseModel
categories
class-attribute
instance-attribute
¶
The list of merchant categories that are available for card spending. If this parameter is not specified, categories are not restricted.
countries
class-attribute
instance-attribute
¶
The list of countries where the card can be used, specified as 2-letter ISO 3166 ⧉ codes.
created_at
instance-attribute
¶
The date and time the card was created in ISO 8601 ⧉ format.
holder_id
class-attribute
instance-attribute
¶
The ID of the team member who is the holder of the card. If the card belongs to the business, this will be empty.
For more information, see the guides: Manage Cards - Create a virtual card ⧉.
merchant_controls
class-attribute
instance-attribute
¶
The merchant-level controls for card spending.
They block or allow the card to only transact with specific merchants:
- allow: permits only the specified merchants (cannot be used if the categories parameter is set)
- block: blocks the specified merchants (can be used with or without categories)
spending_period
class-attribute
instance-attribute
¶
The controls for the card's spending period.
They specify the dates when the card becomes available or unavailable for spending, and define what happens after the end date.
updated_at
instance-attribute
¶
The date and time the card was last updated in ISO 8601 ⧉ format.
virtual
instance-attribute
¶
Specifies whether the card is virtual (true) or physical (false).
CardInvitationAccounts ¶
Bases: RootModel[list[UUID]]
CardInvitationCardId ¶
Bases: RootModel[UUID]
root
instance-attribute
¶
The ID of the card issued after this invitation was claimed.
Note
Only returned for invitations in state redeemed.
CardInvitationCategories ¶
Bases: RootModel[list[BusinessMerchantCategory]]
root
instance-attribute
¶
The list of merchant categories that will be available for card spending. If this parameter is not specified, categories are not restricted.
CardInvitationCountries ¶
Bases: RootModel[list[CardInvitationCountry]]
root
instance-attribute
¶
The list of countries where the team member will be able to use the card. Specified as 2-letter ISO 3166 ⧉ codes.
CardInvitationCreatedAt ¶
Bases: RootModel[AwareDatetime]
root
instance-attribute
¶
The date and time the card invitation was created in ISO 8601 ⧉ format.
CardInvitationCreatedHolderId ¶
Bases: RootModel[UUID]
root
instance-attribute
¶
The ID of the team member to be assigned as the holder of the card after the invitation is claimed.
CardInvitationCreatedResponse ¶
Bases: BaseModel
CardInvitationExpiryDate ¶
Bases: RootModel[AwareDatetime]
root
instance-attribute
¶
The date and time after which this card invitation expires if not claimed or cancelled before then. Specified in ISO 8601 ⧉ format.
Note
Only returned for invitations in state created.
Tip
For other states, to find out when a card invitation transitioned to its final state ⧉, check the updated_at value.
CardInvitationHolderId ¶
Bases: RootModel[UUID]
root
instance-attribute
¶
The ID of the team member to be assigned as the holder of the card after the invitation is claimed.
Note
If the team member has been deleted since the invitation was created, the holder_id is not returned.
CardInvitationId ¶
Bases: RootModel[UUID]
CardInvitationMerchantControls ¶
Bases: BaseModel
merchant_ids
instance-attribute
¶
The list of IDs of merchants to which the control applies.
Tip
To find merchant IDs, check transaction details (→ merchant.id).
You can fetch transaction details for a specific transaction ⧉ or for all transactions ⧉.
CardInvitationResponse ¶
Bases: BaseModel
CardInvitationSpendProgram ¶
Bases: RootModel[SpendProgram]
CardInvitationSpendingLimits ¶
Bases: RootModel[SpendingLimits]
CardInvitationSpendingPeriod ¶
Bases: RootModel[CardInvitationSpendingPeriod4 | CardInvitationSpendingPeriod5]
root
instance-attribute
¶
The controls for the card's spending period.
They specify the dates when the card will become available or unavailable for spending, and define what happens after the end date.
CardInvitationSpendingPeriod1 ¶
Bases: BaseModel
end_date
class-attribute
instance-attribute
¶
The end date (inclusive) of the spending period, in ISO 8601 ⧉ format (YYYY-MM-DD).
Uses the timezone set by the business ⧉, or defaults to Europe/London.
end_date_action
class-attribute
instance-attribute
¶
The action to take after the end date of the spending period.
start_date
instance-attribute
¶
The start date (inclusive) of the spending period, in ISO 8601 ⧉ format (YYYY-MM-DD).
Uses the timezone set by the business ⧉, or defaults to Europe/London.
CardInvitationSpendingPeriod2 ¶
Bases: BaseModel
end_date
instance-attribute
¶
The end date (inclusive) of the spending period, in ISO 8601 ⧉ format (YYYY-MM-DD).
Uses the timezone set by the business ⧉, or defaults to Europe/London.
end_date_action
instance-attribute
¶
The action to take after the end date of the spending period.
start_date
class-attribute
instance-attribute
¶
The start date (inclusive) of the spending period, in ISO 8601 ⧉ format (YYYY-MM-DD).
Uses the timezone set by the business ⧉, or defaults to Europe/London.
CardInvitationSpendingPeriod3 ¶
Bases: BaseModel
CardInvitationSpendingPeriod4 ¶
CardInvitationSpendingPeriod5 ¶
CardInvitationState ¶
Bases: RootModel[Literal['created', 'expired', 'failed', 'redeemed']]
root
instance-attribute
¶
The current state of the card invitation:
- created: Invitation has been created but not yet claimed.
- expired: Invitation has expired due to expiry date being reached or manual cancellation.
- failed: Invitation claim attempt failed.
- redeemed: Invitation has been successfully claimed.
To learn more about card invitation lifecycle, see the guide: Manage card invitations → Card invitation state ⧉.
CardInvitationUpdatedAt ¶
Bases: RootModel[AwareDatetime]
root
instance-attribute
¶
The date and time the card invitation was last updated in ISO 8601 ⧉ format.
CardInvitationUpdatedResponse ¶
Bases: BaseModel
CardInvitationVirtual ¶
Bases: RootModel[bool]
root
instance-attribute
¶
Specifies whether the issued card will be a virtual (true) or physical (false) one.
CardInvitationsResponse ¶
Bases: RootModel[list[CardInvitationResponse]]
CardProduct ¶
CardReference ¶
CardReferences ¶
Bases: RootModel[list[CardReference]]
root
instance-attribute
¶
References for the card. Up to 5 name-value pairs assigned to the card for tracking.
Info
Each time the card is used, the references are recorded in the transaction details ⧉ (card.references), helping track transactions made with this card.
The names must be unique. The references can be amended ⧉ up to 10 times.
References are only supported for cards owned by the business (i.e. company ⧉ or auto-issued cards ⧉).
They are not supported for team member cards ⧉ (i.e. with holder_id present).
Note
The references recorded on a transaction are those assigned to the card at the time the transaction took place. If the references are amended, they will only be applied to future transactions. Existing transaction are not affected.
CardResponse ¶
Bases: BaseModel
categories
class-attribute
instance-attribute
¶
The list of merchant categories that are available for card spending. If not specified, categories are not restricted.
countries
class-attribute
instance-attribute
¶
The list of countries where the card can be used, specified as 2-letter ISO 3166 ⧉ codes.
created_at
instance-attribute
¶
The date and time the card was created in ISO 8601 ⧉ format.
holder_id
class-attribute
instance-attribute
¶
The ID of the team member who is the holder of the card. If the card belongs to the business, this will be empty.
For more information, see the guides: Manage Cards - Create a virtual card ⧉.
merchant_controls
class-attribute
instance-attribute
¶
The merchant-level controls for card spending.
They block or allow the card to only transact with specific merchants:
- allow: permits only the specified merchants (cannot be used if the categories parameter is set)
- block: blocks the specified merchants (can be used with or without categories)
spending_period
class-attribute
instance-attribute
¶
The controls for the card's spending period.
They specify the dates when the card becomes available or unavailable for spending, and define what happens after the end date.
updated_at
instance-attribute
¶
The date and time the card was last updated in ISO 8601 ⧉ format.
virtual
instance-attribute
¶
Specifies whether the card is virtual (true) or physical (false).
CardState ¶
Bases: RootModel[Literal['created', 'pending', 'active', 'frozen', 'locked']]
root
instance-attribute
¶
The state that the card is in.
Possible values:
- active: The card is available for spending.
Newly created cards typically go into active unless subject to certain conditions, for example, spending period starting in the future.
- frozen: The card has been frozen and is temporarily unavailable for spending.
- locked: The card is locked, typically due to an admin lock ⧉ or spending period settings, i.e. when its spending_period.start_date is in the future or spending_period.end_date is in the past.
A locked card is unavailable for spending until it's unlocked ⧉ and active.
Tip
To see if the card can be unlocked, check the can_be_unlocked parameter.
Note that you'll still need the necessary scope or permission ⧉ to unlock it.
created: The card has been created but is not yet active. Used only for a specific type of cards.pending: This status is currently not in use.
CardsResponse ¶
Bases: RootModel[list[CardResponse]]
Category ¶
ChargeBearer ¶
Bases: RootModel[Literal['shared', 'debtor']]
root
instance-attribute
¶
The party to which any transaction fees are charged if the resulting transaction route has associated fees.
Some transactions with fees might not be possible with the specified option, in which case error 3287 is returned.
Counterparties ¶
Bases: RootModel[list[Counterparty]]
Counterparty ¶
Bases: BaseModel
accounts
class-attribute
instance-attribute
¶
The list of public accounts associated with this counterparty.
cards
class-attribute
instance-attribute
¶
The list of cards associated with this counterparty.
created_at
instance-attribute
¶
The date and time the counterparty was created in ISO 8601 ⧉ format.
updated_at
instance-attribute
¶
The date and time the counterparty was last updated in ISO 8601 ⧉ format.
CounterpartyAccount ¶
Bases: BaseModel
account_no
class-attribute
instance-attribute
¶
The bank account number of the counterparty.
bic
class-attribute
instance-attribute
¶
The BIC number of the counterparty's account if applicable.
bsb_code
class-attribute
instance-attribute
¶
The BSB number of the counterparty's account if applicable.
clabe
class-attribute
instance-attribute
¶
The CLABE number of the counterparty's account if applicable.
iban
class-attribute
instance-attribute
¶
The IBAN number of the counterparty's account if applicable.
ifsc
class-attribute
instance-attribute
¶
The IFSC number of the counterparty's account if applicable.
recipient_charges
class-attribute
instance-attribute
¶
Indicates the possibility of the recipient charges.
Caution
This field is deprecated and should be disregarded. It is returned for legacy purposes only.
routing_number
class-attribute
instance-attribute
¶
The routing number of the counterparty's account if applicable.
sort_code
class-attribute
instance-attribute
¶
The sort code of the counterparty's account if applicable.
CounterpartyCard ¶
Bases: BaseModel
CounterpartyError ¶
CounterpartyErrorParams ¶
CountryCode ¶
Bases: RootModel[str]
CountryCodeCard ¶
Bases: RootModel[str]
CreateCounterpartyRequest ¶
Bases: BaseModel
account_no
class-attribute
instance-attribute
¶
The bank account number of the counterparty.
bic
class-attribute
instance-attribute
¶
The BIC number of the counterparty's account. This field is required for non-SEPA IBAN/SWIFT.
bsb_code
class-attribute
instance-attribute
¶
The BSB number of the counterparty's account. This field is required for AUD accounts.
clabe
class-attribute
instance-attribute
¶
The CLABE number of the counterparty's account. This field is required for SWIFT MX.
company_name
class-attribute
instance-attribute
¶
The name of the company counterparty.
Use when individual_name or name isn't specified and profile_type is business.
Caution
The company_name must contain at least 2 letters (not just characters).
For example, names like 12 will fail validation because they are two characters but not two letters.
iban
class-attribute
instance-attribute
¶
The IBAN number of the counterparty's account. This field is displayed for IBAN countries.
ifsc
class-attribute
instance-attribute
¶
The IFSC number of the counterparty's account. This field is required for INR accounts.
name
class-attribute
instance-attribute
¶
The name of the counterparty that you create for an existing Revolut user via Revtag.
Provide the value only when you specify personal for profile_type.
routing_number
class-attribute
instance-attribute
¶
The routing number of the counterparty's account. This field is required for USD accounts.
sort_code
class-attribute
instance-attribute
¶
The sort code of the counterparty's account. This field is required for GBP accounts.
CreatePaymentDraftRequest ¶
Bases: BaseModel
schedule_for
class-attribute
instance-attribute
¶
The scheduled date of the payment draft in ISO 8601 ⧉ format.
CreatePaymentDraftResponse ¶
CreatePayoutLinkRequest ¶
Bases: BaseModel
request_id
instance-attribute
¶
The ID of the request, provided by the sender.
Caution
To ensure that a link payment is not processed multiple times if there are network or system errors, the same request_id should be used for requests related to the same link.
save_counterparty
class-attribute
instance-attribute
¶
Indicates whether to save the recipient as your counterparty upon link claim.
If false then the counterparty will not show up on your counterparties list, for example, when you retrieve your counterparties.
However, you will still be able to retrieve this counterparty by its ID.
If you don't choose to save the counterparty on link creation, you can do it later from your transactions list in the Business app.
CreateWebhookRequest ¶
Bases: BaseModel
events
instance-attribute
¶
A list of event types to subscribe to. If you don't provide it, you're automatically subscribed to the default event types ⧉.
url
instance-attribute
¶
A valid webhook URL to which to send event notifications. The supported protocol is https.
Currency ¶
Bases: RootModel[str]
CurrentChargeOptions ¶
Error ¶
ErrorUnauthorized ¶
Bases: ErrorWithStatus
ErrorUnprocessableEntity ¶
ErrorWithStatus ¶
EstimatedTime ¶
Bases: BaseModel
ExchangePartFrom ¶
Bases: BaseModel
amount
class-attribute
instance-attribute
¶
The amount of currency. Specify only if you want to sell currency.
ExchangePartTo ¶
ExchangeRateResponse ¶
Bases: BaseModel
rate_date
instance-attribute
¶
The date of the proposed exchange rate in ISO 8601 ⧉ format.
ExchangeReason ¶
ExchangeReasonCode ¶
Bases: RootModel[str]
root
instance-attribute
¶
The reason code for the exchange.
Depending on the country and the amount of funds to be exchanged, you might be required to provide an exchange reason.
You can check available reason codes with the GET /exchange-reasons operation ⧉.
If an exchange reason is not required, this field is ignored.
ExchangeReasons ¶
Bases: RootModel[list[ExchangeReason]]
ExchangeRequest ¶
Bases: BaseModel
reference
class-attribute
instance-attribute
¶
The reference for the exchange transaction, provided by you. It helps you to identify the transaction if you want to look it up later.
request_id
instance-attribute
¶
The ID of the request, provided by you. It helps you identify the transaction in your system.
Caution
To ensure that an exchange transaction is not processed multiple times if there are network or system errors,
the same request_id should be used for requests related to the same transaction.
ExchangeResponse ¶
Bases: BaseModel
completed_at
class-attribute
instance-attribute
¶
The date and time the transaction was completed in ISO 8601 ⧉ format.
created_at
class-attribute
instance-attribute
¶
The date and time the transaction was created in ISO 8601 ⧉ format.
reason_code
class-attribute
instance-attribute
¶
The reason why the transaction was failed or declined.
Present only when the state parameter of the transaction is declined or failed.
type
class-attribute
instance-attribute
¶
The type of the transaction. For money exchange, it is exchange.
Expense ¶
Bases: BaseModel
completed_at
class-attribute
instance-attribute
¶
The date and time the expense was completed in ISO 8601 ⧉ format.
expense_date
instance-attribute
¶
The expense data depends on the type of the expense and whether it has been completed.
Typically, it's the date and time of the expense transaction ⧉ in ISO 8601 ⧉ format.
- If the transaction related to the expense is completed, it is the date and time of its completion (completed_at ⧉).
- Otherwise, it is the date and time of its creation (created_at ⧉).
For reimbursements, it's the payment date provided in the reimbursement request.
labels
instance-attribute
¶
The labels added to the expense, organised in groups.
You can have up to 5 label groups, with max. 1 label per group.
The labels are provided as an object, where each key is the name of a label group, and each value is a single-element array containing the selected label from that group.
payer
class-attribute
instance-attribute
¶
The name of the team member ⧉ who made the transaction, refund request, or ATM withdrawal, or the name of the business if the related transaction is of type fee.
splits
instance-attribute
¶
The splits of the expense.
A single expense can be divided into multiple parts (splits), for example, to allocate different portions of the expense to different categories.
submitted_at
class-attribute
instance-attribute
¶
The date and time the expense was submitted in ISO 8601 ⧉ format.
transaction_id
class-attribute
instance-attribute
¶
The ID of the transaction ⧉ related to the expense. Not available for transactions of type external.
ExpenseSplit ¶
ExpenseState ¶
Bases: RootModel[Literal['missing_info', 'awaiting_review', 'rejected', 'pending_reimbursement', 'refund_requested', 'refunded', 'approved', 'reverted']]
root
instance-attribute
¶
Indicates the state of the expense. Possible values:
-
missing_info: The expense is missing some required information.This is the initial state of the expense when it's first created. Once the missing information is provided, the expense is ready to be submitted.
-
awaiting_review: The expense is awaiting approval before it can be completed.The approver can approve, reject, or request refund for the expense. It is also possible for the submitter to undo the submission at this stage.
-
rejected: The expense has been rejected by the approver.The expense submitter (typically, the payer) should fix the issue that was the reason for the rejection and resubmit the expense.
-
pending_reimbursement: The reimbursement request has been approved, and the expense is awaiting reimbursement.This state is possible for reimbursements (transaction type =
External). -
refund_requested: The expense has been rejected and refund has been requested.*This state is possible for card transactions. It indicates that following the review, the approver rejected the expense and requested that it be refunded back to the business account. This can happen, for example, if an employee accidentally makes a personal purchase with their business card. Once refunded, the admin can mark this expense as refunded.
-
refunded: The expense has been refunded.*This state indicates that the admin has marked the expense as refunded.
-
approved: The expense has been approved and is now completed.* -
reverted: The expense has been reverted.This status indicates that the transaction related to the expense has been reverted. In such a case, the expense status is automatically set to
reverted, and the expense is completed. This can happen, for example, when the transaction has been reverted by the merchant.
*Additionally, if an admin has previously approved the expense, marked it as refunded/completed, or requested a refund, they can revert their decision.
In such a case, the expense goes back to the initial missing_info state.
For more information, see the guides: Retrieve expenses and receipts ⧉.
ExpenseTransactionType ¶
Bases: RootModel[Literal['atm', 'card_payment', 'fee', 'transfer', 'external', 'mileage_reimbursement']]
Fee ¶
IndividualName ¶
IndividualName1 ¶
IndividualName7 ¶
IndividualName8 ¶
LabelGroup ¶
Bases: RootModel[list[str]]
MerchantControls ¶
Bases: BaseModel
merchant_ids
instance-attribute
¶
The list of IDs of merchants to which the control applies.
Tip
To find merchant IDs, check transaction details (→ merchant.id).
You can fetch transaction details for a specific transaction ⧉ or for all transactions ⧉.
MerchantControlsSchema ¶
Bases: BaseModel
merchant_ids
instance-attribute
¶
The list of IDs of merchants to which the control applies.
Tip
To find merchant IDs, check transaction details (→ merchant.id).
You can fetch transaction details for a specific transaction ⧉ or for all transactions ⧉.
PaymentDraftResponse ¶
Bases: BaseModel
scheduled_for
class-attribute
instance-attribute
¶
The scheduled date of the payment draft in ISO 8601 ⧉ format.
PaymentDraftsResponse ¶
PaymentInfo ¶
Bases: BaseModel
current_charge_options
instance-attribute
¶
The explanation of conversion process.
error_message
class-attribute
instance-attribute
¶
The description of the error message.
id
instance-attribute
¶
The ID of the payment.
Do not confuse it with the payment draft ID ⧉ or transaction ID ⧉.
PaymentOrderInfo ¶
Bases: BaseModel
scheduled_for
class-attribute
instance-attribute
¶
The scheduled date of the payment draft in ISO 8601 ⧉ format.
PaymentReceiver ¶
Bases: BaseModel
account_id
class-attribute
instance-attribute
¶
The ID of the receiving counterparty's account. Used for bank transfers.
If the counterparty has multiple payment methods available, use it to specify the account to which you want to send the money.
card_id
class-attribute
instance-attribute
¶
The ID of the receiving counterparty's card. Used for card transfers.
If the counterparty has multiple payment methods available, use it to specify the card to which you want to send the money.
PaymentRequest ¶
Bases: BaseModel
account_id
instance-attribute
¶
The ID of the account to pay from.
Note
You can specify only one account ID for multiple payments in the same payment draft.
PaymentState ¶
Bases: RootModel[Literal['CREATED', 'PENDING', 'COMPLETED', 'REVERTED', 'DECLINED', 'CANCELLED', 'FAILED', 'DELETED']]
PaymentSystem ¶
Bases: RootModel[Literal['chaps', 'bacs', 'faster_payments', 'sepa', 'swift', 'ach', 'elixir', 'sorbnet', 'nics', 'rix', 'sumclearing']]
PayoutLink ¶
PayoutLinkAccountId ¶
Bases: RootModel[UUID]
PayoutLinkAdditionalProps ¶
Bases: BaseModel
cancellation_reason
class-attribute
instance-attribute
¶
The reason for which the payout link was cancelled.
counterparty_id
class-attribute
instance-attribute
¶
The ID of the counterparty created based on the recipient's details.
Note
By default, the newly created counterparty is hidden from your counterparties list.
To automatically save it when the link is claimed, pass the save_counterparty parameter set to true.
Alternatively, you can add the recipient to your counterparties later from the list of transactions in the Business app.
transaction_id
class-attribute
instance-attribute
¶
The ID of the created transaction. Returned only if the payout has been claimed.
PayoutLinkAmount ¶
Bases: RootModel[float]
root
instance-attribute
¶
The amount of money to be transferred.
Note
The amount must be between £1 and £2,500, or equivalent in the selected currency.
PayoutLinkCounterpartyName ¶
Bases: RootModel[str]
PayoutLinkExpiryDate ¶
Bases: RootModel[AwareDatetime]
root
instance-attribute
¶
The date and time after which the payout link expires in ISO 8601 format ⧉. If the recipient doesn't claim the money before then, the payout link expires and is no longer available.
The default and maximum value is the date and time of creating the link + 7 days.
PayoutLinkExpiryPeriod ¶
Bases: RootModel[timedelta]
root
instance-attribute
¶
The period after which the payout link expires if not claimed before, provided in ISO 8601 format ⧉.
The default and maximum value is 7 days from the link creation.
PayoutLinkInitialProps ¶
Bases: BaseModel
created_at
instance-attribute
¶
The date and time the payout link was created in ISO 8601 format ⧉.
save_counterparty
instance-attribute
¶
Indicates whether you chose to save the recipient as your counterparty upon link claim.
If false then the counterparty will not show up on your counterparties list, for example, when you retrieve your counterparties ⧉.
However, you can still retrieve this counterparty by its ID ⧉.
If you didn't choose to save the counterparty on link creation, you can still do it from your transactions list in the Business app.
updated_at
instance-attribute
¶
The date and time the payout link was last updated in ISO 8601 format ⧉.
url
class-attribute
instance-attribute
¶
The URL of the payout link. Returned only for active payout links.
PayoutLinkPayoutMethods ¶
Bases: RootModel[list[PayoutMethod]]
root
instance-attribute
¶
The list of payout methods that the recipient can use to claim the payout, where:
- revolut: Revolut peer-to-peer (P2P) transfer
- bank_account: External bank transfer
- card: Card transfer
PayoutLinkReference ¶
Bases: RootModel[str]
PayoutLinkRequestId ¶
Bases: RootModel[str]
PayoutLinkState ¶
Bases: RootModel[Literal['created', 'failed', 'awaiting', 'active', 'expired', 'cancelled', 'processing', 'processed']]
root
instance-attribute
¶
The state that the payout link is in. Possible states are:
- created: The payout link has been created, but the amount has not yet been blocked ⧉.
- failed: The payout link couldn't be generated due to a failure during transaction booking.
- awaiting: The payout link is awaiting approval.
- active: The payout link can be redeemed.
- expired: The payout link cannot be redeemed because it wasn't claimed before its expiry date.
- cancelled: The payout link cannot be redeemed because it was cancelled.
- processing: The payout link has been redeemed and is being processed.
- processed: The payout link has been redeemed and the money has been transferred to the recipient.
PayoutLinks ¶
Bases: RootModel[list[PayoutLink]]
PayoutMethod ¶
Bases: RootModel[Literal['revolut', 'bank_account', 'card']]
ProfileType ¶
Bases: RootModel[Literal['personal', 'business']]
root
instance-attribute
¶
The type of the Revolut profile. Used when adding an existing Revolut user via Revtag.
Role ¶
Bases: BaseModel
created_at
instance-attribute
¶
The date and time the role was created in ISO 8601 ⧉ format.
id
instance-attribute
¶
The ID of the role. This can be a UUID or other default role such as OWNER.
updated_at
instance-attribute
¶
The date and time the role was last updated in ISO 8601 ⧉ format.
SpendProgram ¶
SpendingLimitPeriodic ¶
SpendingLimitSingleTransaction ¶
SpendingLimits ¶
Bases: BaseModel
SpendingLimitsSchema ¶
Bases: BaseModel
SpendingPeriodSchema ¶
Bases: RootModel[SpendingPeriodSchema1 | SpendingPeriodSchema2]
SpendingPeriodSchema1 ¶
Bases: BaseModel
end_date
class-attribute
instance-attribute
¶
The end date (inclusive) of the spending period, in ISO 8601 ⧉ format (YYYY-MM-DD).
Uses the timezone set by the business ⧉, or defaults to Europe/London.
end_date_action
class-attribute
instance-attribute
¶
The action to take after the end date of the spending period.
start_date
instance-attribute
¶
The start date (inclusive) of the spending period, in ISO 8601 ⧉ format (YYYY-MM-DD).
Uses the timezone set by the business ⧉, or defaults to Europe/London.
SpendingPeriodSchema2 ¶
Bases: BaseModel
end_date
instance-attribute
¶
The end date (inclusive) of the spending period, in ISO 8601 ⧉ format (YYYY-MM-DD).
Uses the timezone set by the business ⧉, or defaults to Europe/London.
end_date_action
instance-attribute
¶
The action to take after the end date of the spending period.
start_date
class-attribute
instance-attribute
¶
The start date (inclusive) of the spending period, in ISO 8601 ⧉ format (YYYY-MM-DD).
Uses the timezone set by the business ⧉, or defaults to Europe/London.
SpentAmount ¶
TaxRate ¶
Bases: BaseModel
TeamMember ¶
Bases: BaseModel
created_at
instance-attribute
¶
The date and time the team member was created in ISO 8601 ⧉ format.
role_id
instance-attribute
¶
The ID of the team member's role ⧉. This can be a UUID or other default role such as Owner.
updated_at
instance-attribute
¶
The date and time the team member was last updated in ISO 8601 ⧉ format.
TeamMemberState ¶
Bases: RootModel[Literal['created', 'confirmed', 'waiting', 'active', 'locked', 'disabled']]
Transaction ¶
Bases: BaseModel
completed_at
class-attribute
instance-attribute
¶
The date and time the transaction was completed in ISO 8601 ⧉ format.
This is required when the transaction state is completed.
created_at
instance-attribute
¶
The date and time the transaction was created in ISO 8601 ⧉ format.
legs
instance-attribute
¶
The legs of the transaction: - For transactions between your Revolut accounts, there can be 2 legs, for example, an internal transfer made out of the GBP account and into the EUR account. - For transactions in other cases, there is only 1 leg.
reason_code
class-attribute
instance-attribute
¶
The reason code when the transaction state is declined or failed.
related_transaction_id
class-attribute
instance-attribute
¶
The ID of the original transaction to which this transaction is related. Returned, for example, when this transaction is a refund of the related transaction, or for transactions related to cashback.
request_id
class-attribute
instance-attribute
¶
The request ID that you provided previously.
scheduled_for
class-attribute
instance-attribute
¶
The scheduled date of the payment, if applicable. Provided in ISO 8601 ⧉ format.
updated_at
instance-attribute
¶
The date and time the transaction was last updated in ISO 8601 ⧉ format.
TransactionCard ¶
Bases: BaseModel
references
class-attribute
instance-attribute
¶
Card references (references ⧉).
Note
These are the references that were assigned to the card at the time the transaction was made. Any update ⧉ to card references does not affect existing transactions.
TransactionCounterparty ¶
Bases: BaseModel
account_id
class-attribute
instance-attribute
¶
The ID of the counterparty account.
TransactionCounterpartyAccountType ¶
Bases: RootModel[Literal['self', 'revolut', 'external']]
TransactionLeg ¶
Bases: BaseModel
account_id
instance-attribute
¶
The ID of the account that the transaction is associated with.
balance
class-attribute
instance-attribute
¶
The total balance of the account that the transaction is associated with.
bill_amount
class-attribute
instance-attribute
¶
The billing amount for cross-currency payments.
TransactionLimitCurrency ¶
Bases: RootModel[str]
root
instance-attribute
¶
The currency of the spending limit, provided as ISO 4217 ⧉ code in upper case.
TransactionMerchant ¶
Bases: BaseModel
category_code
class-attribute
instance-attribute
¶
The category code of the merchant.
TransactionPaymentRequest ¶
Bases: BaseModel
request_id
instance-attribute
¶
The ID of the transaction, provided by you.
Caution
Always provide a unique request ID for each individual payment. This allows you to safely retry the payment in the event of any network issues; if the payment was successful, a second attempt with the same request ID won't be processed.
TransactionState ¶
Bases: RootModel[Literal['created', 'pending', 'completed', 'declined', 'failed', 'reverted']]
root
instance-attribute
¶
Indicates the transaction state. Possible values:
- created: The transaction has been created and is either processed asynchronously or scheduled for a later time.
- pending: The transaction is pending until it's being processed. If the transfer is made between Revolut accounts, this state is skipped and the transaction is executed instantly.
- completed: The transaction was successful.
- declined: The transaction was unsuccessful. This can happen for a variety of reasons, for example, insufficient account balance, wrong receiver information, etc.
- failed: The transaction was unsuccessful. This can happen for a variety of reasons, for example, invalid API calls, blocked payments, etc.
- reverted: The transaction was reverted. This can happen for a variety of reasons, for example, the receiver being inaccessible.
TransactionType ¶
Bases: RootModel[Literal['atm', 'card_payment', 'card_refund', 'card_chargeback', 'card_credit', 'exchange', 'transfer', 'loan', 'fee', 'refund', 'topup', 'topup_return', 'tax', 'tax_refund']]
Transactions ¶
Bases: RootModel[list[Transaction]]
TransferReason ¶
Bases: BaseModel
TransferReasonCode ¶
Bases: RootModel[str]
root
instance-attribute
¶
The reason code for the transaction. Transactions to certain countries and currencies might require you to provide a transfer reason.
You can check available reason codes with the GET /transfer-reasons operation ⧉.
If a transfer reason is not required for the given currency and country, this field is ignored.
TransferReasons ¶
Bases: RootModel[list[TransferReason]]
TransferRequest ¶
Bases: BaseModel
reference
class-attribute
instance-attribute
¶
The reference for the funds transfer.
request_id
instance-attribute
¶
The ID of the request, provided by you. It helps you identify the transaction in your system.
Caution
To ensure that a transfer is not processed multiple times if there are network or system errors,
the same request_id should be used for requests related to the same transfer.
source_account_id
instance-attribute
¶
The ID of the source account that you transfer the funds from.
target_account_id
instance-attribute
¶
The ID of the target account that you transfer the funds to.
TransferResponse ¶
Bases: BaseModel
completed_at
class-attribute
instance-attribute
¶
The date and time the transaction was completed in ISO 8601 ⧉ format.
created_at
instance-attribute
¶
The date and time the transaction was created in ISO 8601 ⧉ format.
UpdateWebhookRequest ¶
Bases: BaseModel
url
class-attribute
instance-attribute
¶
A valid webhook URL to which to send event notifications. The supported protocol is https.
Url ¶
ValidateAccountNameRequest ¶
ValidateAccountNameRequestAU ¶
Bases: BaseModel
bsb
instance-attribute
¶
The BSB (Bank-State-Branch) number for the counterparty's account. Used to identify the bank and branch in Australia.
company_name
class-attribute
instance-attribute
¶
The name of the business counterparty.
Required when the account type is business (individual_name is not specified).
individual_name
class-attribute
instance-attribute
¶
The name of the individual counterparty, split into first name and last name.
Required when the account type is personal (company_name isn't specified).
ValidateAccountNameRequestEUR ¶
Bases: BaseModel
bic
class-attribute
instance-attribute
¶
The BIC (Bank Identifier Code) for the counterparty's account. Also known as the SWIFT code. It can be provided, for example, when the automatic BIC detection fails and the check is unsuccessful.
company_name
class-attribute
instance-attribute
¶
The name of the business counterparty.
Required when the account type is business (individual_name is not specified).
iban
instance-attribute
¶
The IBAN (International Bank Account Number) for the counterparty's account.
individual_name
class-attribute
instance-attribute
¶
The name of the individual counterparty, split into first name and last name.
Required when the account type is personal (company_name isn't specified).
recipient_country
instance-attribute
¶
The counterparty's bank country, provided as a 2-letter ISO 3166 ⧉ code.
recipient_currency
instance-attribute
¶
The counterparty account’s currency, provided as a 3-letter ISO 4217 ⧉ code.
For VoP, the possible value is EUR.
ValidateAccountNameRequestRO ¶
Bases: BaseModel
bic
class-attribute
instance-attribute
¶
The BIC (Bank Identifier Code) for the counterparty's account. Also known as the SWIFT code. This value is optional. It can be provided, for example, when the automatic BIC detection fails and the check is unsuccessful.
company_name
class-attribute
instance-attribute
¶
The name of the business counterparty.
Required when the account type is business (individual_name is not specified).
ⓘ Note that for RO ⧉, the name you provide helps identify the request, but is not used for the actual check. The API simply returns the partially masked name associated with the IBAN for you to validate. Therefore, the returned name may differ from the one you provide.
iban
instance-attribute
¶
The IBAN (International Bank Account Number) for the counterparty's account.
individual_name
class-attribute
instance-attribute
¶
The name of the individual counterparty, split into first name and last name.
Required when the account type is personal (company_name isn't specified).
ⓘ Note that for RO ⧉, the name you provide helps identify the request, but is not used for the actual check. The API simply returns the partially masked name associated with the IBAN for you to validate. Therefore, the returned name may differ from the one you provide.
recipient_country
instance-attribute
¶
The counterparty's bank country, provided as a 2-letter ISO 3166 ⧉ code.
For RO CoP, the possible value is RO.
recipient_currency
instance-attribute
¶
The counterparty account’s currency, provided as a 3-letter ISO 4217 ⧉ code.
For RO CoP, the possible value is RON.
ValidateAccountNameRequestUK ¶
Bases: BaseModel
company_name
class-attribute
instance-attribute
¶
The name of the business counterparty.
Required when the account type is business (individual_name is not specified).
individual_name
class-attribute
instance-attribute
¶
The name of the individual counterparty, split into first name and last name.
Required when the account type is personal (company_name isn't specified).
ValidateAccountNameResponse ¶
ValidateAccountNameResponseAU ¶
Bases: BaseModel
company_name
class-attribute
instance-attribute
¶
The name of the recipient when the account type is business.
Provided only if individual_name is not specified.
When the name is a close match, the actual full name is returned. Otherwise, the name you provided is returned.
Mismatched name type is corrected
The mismatched name type in the request is corrected in the response.
This means that, for example, if an individual recipient's name was provided under company_name, in the response it is returned under individual_name.
individual_name
class-attribute
instance-attribute
¶
The name of the recipient when the account type is personal.
Provided only if company_name is not specified.
When the name is a close match, the actual first and last names are returned. Otherwise, the name you provided is returned.
Mismatched name type is corrected
The mismatched name type in the request is corrected in the response.
This means that, for example, if an individual recipient's name was provided under company_name, in the response it is returned under individual_name.
result_code
instance-attribute
¶
The result of the check.
Possible values for AU:
- matched: The name matches the provided details.
For personal accounts, this also covers close matches, in which case the actual name is returned.
- close_match (business account): The name is similar to the provided value.
- not_matched: The name doesn't match the provided values.
- cannot_be_checked: The check cannot be performed and retries won't help.
For example, the recipient's bank doesn't support CoP.
- temporarily_unavailable: The check cannot be performed right now.
For example, the recipient's bank didn't respond to our request.
You should retry the request later.
ValidateAccountNameResponseEUR ¶
Bases: BaseModel
company_name
class-attribute
instance-attribute
¶
The name of the recipient when the account type is business.
Provided only if individual_name is not specified.
When the name is a close match, the actual name is returned. Otherwise, the name you provided is returned.
Mismatched name type is not corrected
The name type in the response is returned as it was provided in the request.
For example, if an individual recipient's name was provided under company_name, in the response it's still returned under company_name (instead of individual_name).
individual_name
class-attribute
instance-attribute
¶
The name of the recipient when the account type is personal.
Provided only if company_name is not specified.
When the name is a close match, the actual name is returned. Otherwise, the name you provided is returned.
Mismatched name type is not corrected
The name type in the response is returned as it was provided in the request.
For example, if an individual recipient's name was provided under company_name, in the response it's still returned under company_name (instead of individual_name).
result_code
instance-attribute
¶
The result of the check.
Possible values for EUR:
- matched: The name matches the provided details.
- close_match: The recipient's name is similar to the provided value.
The actual name is returned.
- not_matched: The name and account type don't match the provided values.
The name provided in the request is returned.
- cannot_be_checked: The check cannot be performed and retries won't help.
For example, the recipient's bank doesn't support VoP.
- temporarily_unavailable: The check cannot be performed right now.
For example, the recipient's bank didn't respond to our request.
You should retry the request later.
ValidateAccountNameResponseRO ¶
Bases: BaseModel
company_name
class-attribute
instance-attribute
¶
The partially masked name of the recipient when the account type is business.
Provided only if individual_name is not specified.
Name considerations
- The name you provide helps identify the request, but is not used for the actual check. The API simply returns the partial name associated with the IBAN for you to validate. Therefore, the returned name may differ from the one you provided.
- Mismatched name type is not corrected.
This means that the name type in the response is returned as it was provided in the request.
For example, if an individual recipient's name was provided under
company_name, in the response it's still returned undercompany_name(instead ofindividual_name).
individual_name
class-attribute
instance-attribute
¶
The partial name of the recipient when the account type is personal, that is, the first name and the last name's initial.
Provided only if company_name is not specified.
Name considerations
- The name you provide helps identify the request, but is not used for the actual check. The API simply returns the partial name associated with the IBAN for you to validate. Therefore, the returned name may differ from the one you provided.
- Mismatched name type is not corrected.
This means that the name type in the response is returned as it was provided in the request.
For example, if an individual recipient's name was provided under
company_name, in the response it's still returned undercompany_name(instead ofindividual_name).
result_code
instance-attribute
¶
The result of the check.
For RO CoP, the API checks if an account exists for the provided IBAN.
Possible results are:
- matched: An account with the provided IBAN was found.
When this status is returned, the API also returns a partial name of the account holder.
Use this returned name to validate your recipient's details.
- cannot_be_checked: The check cannot be performed and retries won't help.
For example, the recipient's bank doesn't support CoP.
- temporarily_unavailable: The check cannot be performed right now.
For example, the recipient's bank didn't respond to our request.
You should retry the request later.
ValidateAccountNameResponseUK ¶
Bases: BaseModel
company_name
class-attribute
instance-attribute
¶
The name of the recipient when the account type is business.
Provided only if individual_name is not specified.
When the name is a close match, the actual full name is returned, otherwise, the name you provided is returned.
individual_name
class-attribute
instance-attribute
¶
The name of the recipient when the account type is personal.
Provided only if company_name is not specified.
When the name is a close match, the actual first and last names are returned in full.
result_code
instance-attribute
¶
The result of the check.
Possible values for UK:
- matched: The name and account type match the provided details.
- close_match: The name and/or account type are similar to the provided values:
- The name is a match, but the account type is incorrect.
For example, an individual recipient's name was provided under company_name.
The actual account type is returned.
- The name is similar to the provided values.
Account type is correct.
The actual name is returned.
- The name is similar to the provided values, and the account type is incorrect.
The actual values are returned.
The actual values are returned.
- not_matched: The name and account type don't match the provided values.
- cannot_be_checked: The check cannot be performed and retries won't help.
For example, the recipient's bank doesn't support CoP.
- temporarily_unavailable: The check cannot be performed right now.
For example, the recipient's bank didn't respond to our request.
You should retry the request later.
WebhookEvent ¶
Bases: BaseModel
created_at
instance-attribute
¶
The date and time the event was created in ISO 8601 ⧉ format.
last_sent_date
class-attribute
instance-attribute
¶
The date and time the last attempt at the event delivery occurred in ISO 8601 ⧉ format.
updated_at
instance-attribute
¶
The date and time the event was last updated in ISO 8601 ⧉ format.
webhook_url
instance-attribute
¶
The valid webhook URL that event notifications are sent to. The supported protocol is https.
WebhookEventType ¶
Bases: RootModel[Literal['TransactionCreated', 'TransactionStateChanged', 'PayoutLinkCreated', 'PayoutLinkStateChanged']]
WebhookEvents ¶
Bases: RootModel[list[WebhookEvent]]
WebhookSigningSecretRotateRequest ¶
Bases: BaseModel
expiration_period
class-attribute
instance-attribute
¶
The expiration period for the signing secret in ISO 8601 format ⧉. If set, when you rotate the secret, it continues to be valid until the expiration period has passed. Otherwise, on rotation, the secret is invalidated immediately. The maximum value is 7 days.
WebhookV1 ¶
WebhookV2 ¶
Bases: BaseModel
url
instance-attribute
¶
The valid webhook URL that event notifications are sent to. The supported protocol is https.
WebhookV2Basic ¶
Bases: BaseModel
url
instance-attribute
¶
The valid webhook URL that event notifications are sent to. The supported protocol is https.
Webhooks ¶
Bases: RootModel[list[WebhookV2Basic]]
fix_openapi_spec ¶
Fix invalid OpenAPI spec issues for datamodel-codegen compatibility.
Fixes:
- Removes invalid minimum/maximum constraints from string-typed fields
(these constraints are only valid for numeric types in JSON Schema)
- Fixes invalid discriminator definitions that lack propertyName and oneOf
- Converts ::: admonition syntax to MkDocs Material !!! syntax
Usage
python fix_openapi_spec.py input.yaml > output.yaml python fix_openapi_spec.py input.yaml | datamodel-codegen --input-file-type openapi ...
convert_admonitions ¶
Convert ::: admonition syntax to MkDocs Material !!! syntax.
Handles: - :::note ... ::: -> !!! note\n ... - ::::::note ... :::::: (nested containers) -> flattened !!! note - Nested admonitions are flattened to the same level
Source code in shared/services/payment_providers/revolut/openapi/fix_openapi_spec.py
fix_invalid_discriminator ¶
Fix invalid discriminator definitions.
OpenAPI 3.0 discriminators must have a propertyName and be used with oneOf/anyOf. If we find a discriminator with only mapping (no propertyName), convert it to oneOf.
Source code in shared/services/payment_providers/revolut/openapi/fix_openapi_spec.py
fix_openapi_spec ¶
fix_schema_object ¶
Recursively fix schema objects by removing invalid constraints.
Removes minimum/maximum from string-typed fields since these
constraints are only valid for numeric types in JSON Schema.
Source code in shared/services/payment_providers/revolut/openapi/fix_openapi_spec.py
fix_string_values ¶
Recursively fix string values in the spec.
Converts ::: admonition syntax to MkDocs Material !!! syntax in description fields.
Source code in shared/services/payment_providers/revolut/openapi/fix_openapi_spec.py
is_numeric ¶
main ¶
Source code in shared/services/payment_providers/revolut/openapi/fix_openapi_spec.py
shared.services.payment_providers.revolut.revolut_client ¶
RevolutAuth ¶
Bases: AuthBase
Source code in shared/services/payment_providers/revolut/revolut_client.py
RevolutClient ¶
Source code in shared/services/payment_providers/revolut/revolut_client.py
add_counterparty ¶
add_counterparty(
*,
company_name=None,
first_name=None,
last_name=None,
iban,
bic,
bank_country=None,
address
)
Create a new counterparty in Revolut https://developer.revolut.com/docs/business/add-counterparty ⧉
:param bank_country: Set by default to the IBAN first two characters. Must be overridden for countries like French Polynesia (=> PF). You can use IBANClient().get_iban_info(iban) to fetch it
Source code in shared/services/payment_providers/revolut/revolut_client.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
create_payment ¶
create_payment(
*,
request_id,
amount_in_cents,
receiver_counterparty_id,
receiver_account_id,
payment_description=None
)
https://developer.revolut.com/docs/business/create-payment ⧉
Trigger a payment using Revolut.
The payment will be sent to the recipient described by revolut_counterparty_id.
Source code in shared/services/payment_providers/revolut/revolut_client.py
get_refund_transactions ¶
Source code in shared/services/payment_providers/revolut/revolut_client.py
get_supported_currency ¶
get_transaction ¶
https://developer.revolut.com/docs/business/get-transaction ⧉
Source code in shared/services/payment_providers/revolut/revolut_client.py
get_transactions ¶
https://developer.revolut.com/docs/business/get-transactions ⧉
Source code in shared/services/payment_providers/revolut/revolut_client.py
rotate_access_token ¶
Source code in shared/services/payment_providers/revolut/revolut_client.py
shared.services.payment_providers.revolut.revolut_webhooks ¶
Decorator for validating Revolut webhook signatures.
Revolut webhooks are signed using HMAC-SHA256. The signature is computed as: 1. Concatenate: version.timestamp.raw_payload 2. Compute HMAC-SHA256 of this string using the signing secret 3. Compare with signature from Revolut-Signature header
See: https://developer.revolut.com/docs/guides/manage-accounts/webhooks/verify-the-payload-signature ⧉
RevolutWebhooks ¶
Decorator for incoming Revolut webhooks.
Validates webhook signatures to ensure requests are authentic.
Usage:
@app.route("/my_revolut_webhook", methods=["POST"])
@RevolutWebhooks.webhook_handler()
def revolut_webhook_controller():
...
is_signature_valid
staticmethod
¶
Validate Revolut webhook signature using HMAC-SHA256.
The signature is computed as follows: 1. payload_to_sign = v1.{timestamp}.{raw_payload} 2. hmac_signature = HMAC-SHA256(signing_secret, payload_to_sign) 3. expected_signature = v1={hmac_signature}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
signing_secret
|
str
|
The webhook signing secret from Revolut |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if signature is valid, False otherwise |
Source code in shared/services/payment_providers/revolut/revolut_webhooks.py
webhook_handler
staticmethod
¶
Handle Revolut webhook requests and validate their signature.
The business account name is extracted from the query parameter to fetch the appropriate signing secret for that account.
Returns:
| Type | Description |
|---|---|
callable
|
Decorated function that validates webhook signatures |