Withdraw Money
This endpoint is used to create a withdrawal to another funding method owned by the same account (self-payments). The endpoint is as follows:
POST https://sandbox-api.veem.com/veem/v1.2/payments/withdraw
HeadersThree headers are required to use this endpoint.
Name Type Required Description Authorizationstring Yes Bearer token (OAuth 2.0) This header holds the bearer token required to use Veem's public API, and belongs to the owner account. Failure to use a valid bearer token will result in a 404 (Not Found) status code in the response. An example of a valid header value is as follows: Bearer c047594b-082c-4da1-be89-08fe3770f4b3.
See Get Access Token section to generate your Bearer token.X-Request-Idstring Yes This is a unique string that identifies the current API request, and should follow the UUID format. Reusing this header without changing the value will result in a 409 (Conflict) status code in the response. An example X-request-id is as follows: 48855846-628d-4177-b071-80332a116f0aContent-Typestring Yes The content type of the request. Must be application/json
Request Payload
When sending a withdraw request using Veem's Withdraw Payment API to another funding method, follow the format as shown in the following examples:
{
"amount": {
"currency": "USD",
"number": 50
},
"fromFundingMethodType": "VirtualBank",
"fromFundingMethodId": 1,
"toFundingMethodType": "Wallet",
"toFundingMethodId": 135323,
"onBehalfAccountId": 12345 // see Partner Notes
}{
"amount": {
"currency": "USD",
"number": 50
},
"fromFundingMethodType": "VirtualBank",
"fromFundingMethodId": 1,
"sweepToWalletId":11808
}Request Parameters
The following table contains detailed information on the payload's parameters, such as the parameter name, whether it is mandatory or not, formatting (if applicable), and size of the parameter. You can retrieve various fields such as countryCode, bankName, bankCode, swiftCode, and purposeOfPayment from the Country-Currency-Map endpoint. Please refer to the following link: country-currency-map
| Parameter | Mandatory? | Format/Values | Size (in chars) |
|---|---|---|---|
| amount.currency | Yes | Amount currency to withdraw Currency Code (ISO 4217) | |
| amount.number | Yes | Amount number to withdraw Number | |
| fromFundingMethodType | Yes | "Wallet" "VirtualBank" | |
| fromFundingMethodId | Yes | Number Note: Make sure the ID is the one associated with the requesting account | |
| toFundingMethodType | Yes (if sweepToWalletId is not provided) | For wallet withdrawal the supported funding methods: For Virtual Bank withdrawal the supported funding methods: | |
| toFundingMethodId | Yes (if sweepToWalletId is not provided) | Number Note: Make sure the ID is the one associated with the requesting account | |
| sweepToWalletId | Not supported for wallet withdrawals Yes (if toFundingMethodType and toFundingMethodId are not provided) | Number Note: Make sure the ID is the one associated with the requesting account |
Response Payload
Once a valid request has been sent, a response payload of this format should be expected:
{
"requestId": "18eb345d-2425-42f6-9b77-dbec8803cb75",
"ccEmails": [],
"status": "Sent",
"goodFundsPayment": false,
"realTimePayment": false,
"extraInfo": {},
"id": 468711,
"exchangeRate": {},
"feeInformation": {
"payerInfo": {
"originalAmount": 50.00,
"feeAmount": 0.00,
"totalAmount": 50.00,
"currency": "USD"
},
"payeeInfo": {
"originalAmount": 50.00,
"feeAmount": 0.00,
"totalAmount": 50.00,
"currency": "USD"
}
},
"fastTransfer": false,
"cancelable": false,
"payerFundingMethodType": "VirtualBank",
"receiverFundingMethodType": "Wallet"
}Partner Notes:
- A partner account can be configured to make this API request on behalf of their customers. This requires internal configuration for the partner account by Veem. Once the internal configuration is enabled, the API request can be made using partner account bearer token.
onBehalfAccountIdis an optional parameter, this needs to be included on the request body in case of partner making an API request on behalf of their customer. This is the customer Veem account ID.
Possible Errors
If any mandatory field is missing, one will get a Status 400 (Bad Request) error in the following format:
{
"validationErrorMessage": [
"From Funding Method Type is required.",
"Sweep to Wallet is not supported for wallet withdrawals.",
"Amount number <> is not acceptable",
"To funding method type and id are required",
"Funding method of type <> is not acceptable",
"Partner <> is not allowed to sweep to wallet."
]
}Here are some extra examples of specific errors that can pop up during the use of the Withdraw Money API:
Unauthorized
Status Code: 401 (Unauthorized)
Example:
{
"error": "unauthorized",
"error_description": "Full authentication is required to access this resource"
}Incorrect Funding Method ID
Status Code: 404 (Not Found)
Example:
{
"code": 10001004,
"message": "Could not find funding method: VIRTUALBANK for payer accountId: 441628 and fundingMethodId: 163",
"logTag": "6642a1b3-9b67-4bf5-a9ba-ca34138f1b4c",
"timestamp": "2025-01-03T21:34:04.464",
"fileName": "CreatePayment.java",
"lineNumber": 406
}