Migrate virtual accounts to v3
curl --request POST \
--url https://production.hifi.com/v3/virtual-accounts/v3-migration \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"v2Ids": [
"8f14e45f-ceea-467e-adde-0f8d0f5f4b1c",
"c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54"
]
}
'import requests
url = "https://production.hifi.com/v3/virtual-accounts/v3-migration"
payload = { "v2Ids": ["8f14e45f-ceea-467e-adde-0f8d0f5f4b1c", "c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
v2Ids: ['8f14e45f-ceea-467e-adde-0f8d0f5f4b1c', 'c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54']
})
};
fetch('https://production.hifi.com/v3/virtual-accounts/v3-migration', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://production.hifi.com/v3/virtual-accounts/v3-migration",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'v2Ids' => [
'8f14e45f-ceea-467e-adde-0f8d0f5f4b1c',
'c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://production.hifi.com/v3/virtual-accounts/v3-migration"
payload := strings.NewReader("{\n \"v2Ids\": [\n \"8f14e45f-ceea-467e-adde-0f8d0f5f4b1c\",\n \"c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://production.hifi.com/v3/virtual-accounts/v3-migration")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"v2Ids\": [\n \"8f14e45f-ceea-467e-adde-0f8d0f5f4b1c\",\n \"c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.hifi.com/v3/virtual-accounts/v3-migration")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"v2Ids\": [\n \"8f14e45f-ceea-467e-adde-0f8d0f5f4b1c\",\n \"c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"v2Id": "8f14e45f-ceea-467e-adde-0f8d0f5f4b1c",
"v3Id": "va_3Kf9dQ2mNpXwZ7bV1aLcs",
"migrated": true,
"message": "migrated"
},
{
"v2Id": "c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54",
"v3Id": null,
"migrated": false,
"message": "Resource not found"
}
]
}{
"type": "VALIDATION_ERROR",
"message": "One or more fields are invalid or missing.",
"fields": [
{
"code": "invalid_value",
"message": "Must be a valid email address",
"field": "email"
}
]
}{
"type": "UNAUTHORIZED",
"message": "Authentication required"
}{
"type": "INTERNAL_SERVER_ERROR",
"message": "An internal server error occurred"
}Virtual Accounts
Migrate virtual accounts to v3
Migrate v2 virtual accounts to v3 and return their v3 public IDs.
Virtual accounts that cannot be found are returned with v3Id: null and
migrated: false rather than causing the whole request to fail.
Migrating an account that is already on v3 is safe and returns the same
v3Id.
POST
/
v3
/
virtual-accounts
/
v3-migration
Migrate virtual accounts to v3
curl --request POST \
--url https://production.hifi.com/v3/virtual-accounts/v3-migration \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"v2Ids": [
"8f14e45f-ceea-467e-adde-0f8d0f5f4b1c",
"c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54"
]
}
'import requests
url = "https://production.hifi.com/v3/virtual-accounts/v3-migration"
payload = { "v2Ids": ["8f14e45f-ceea-467e-adde-0f8d0f5f4b1c", "c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54"] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
v2Ids: ['8f14e45f-ceea-467e-adde-0f8d0f5f4b1c', 'c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54']
})
};
fetch('https://production.hifi.com/v3/virtual-accounts/v3-migration', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://production.hifi.com/v3/virtual-accounts/v3-migration",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'v2Ids' => [
'8f14e45f-ceea-467e-adde-0f8d0f5f4b1c',
'c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://production.hifi.com/v3/virtual-accounts/v3-migration"
payload := strings.NewReader("{\n \"v2Ids\": [\n \"8f14e45f-ceea-467e-adde-0f8d0f5f4b1c\",\n \"c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://production.hifi.com/v3/virtual-accounts/v3-migration")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"v2Ids\": [\n \"8f14e45f-ceea-467e-adde-0f8d0f5f4b1c\",\n \"c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://production.hifi.com/v3/virtual-accounts/v3-migration")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"v2Ids\": [\n \"8f14e45f-ceea-467e-adde-0f8d0f5f4b1c\",\n \"c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"v2Id": "8f14e45f-ceea-467e-adde-0f8d0f5f4b1c",
"v3Id": "va_3Kf9dQ2mNpXwZ7bV1aLcs",
"migrated": true,
"message": "migrated"
},
{
"v2Id": "c9f0f895-fb98-4b91-a0d3-3c1e2a7b6d54",
"v3Id": null,
"migrated": false,
"message": "Resource not found"
}
]
}{
"type": "VALIDATION_ERROR",
"message": "One or more fields are invalid or missing.",
"fields": [
{
"code": "invalid_value",
"message": "Must be a valid email address",
"field": "email"
}
]
}{
"type": "UNAUTHORIZED",
"message": "Authentication required"
}{
"type": "INTERNAL_SERVER_ERROR",
"message": "An internal server error occurred"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
v2 virtual account IDs to migrate to v3.
Up to 100 v2 virtual account IDs to migrate to v3.
Required array length:
1 - 100 elementsResponse
Migration results, one per unique requested ID, in request order.
Show child attributes
Show child attributes
⌘I