Update an existing transaction
curl --request PATCH \
--url https://api.wellapp.ai/v1/transactions/{id} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "transaction",
"attributes": {
"status": "completed",
"executed_at": "2024-01-15T14:35:00Z",
"booking_date": "2024-01-15",
"value_date": "2024-01-15",
"settlement_amount": {
"currency": "USD",
"amount": 1355.25
},
"foreign_exchange": {
"currency_rate": "1.0842",
"currency_rate_source": "ECB",
"currency_rate_at": "2024-01-15T14:35:00Z"
},
"remittance_information": {
"unstructured": "Salary payment January 2024 - Updated",
"structured_reference": "RF18539007547034",
"reference_type": "SCOR"
},
"fees": [
{
"type": "transfer_fee",
"amount": 2.5,
"currency": "EUR"
},
{
"type": "exchange_fee",
"amount": 7.5,
"currency": "EUR"
}
]
},
"relationships": {
"documents": {
"data": [
{
"type": "invoice",
"id": "550e8400-e29b-41d4-a716-446655440004"
},
{
"type": "document",
"id": "550e8400-e29b-41d4-a716-446655440020"
}
]
}
}
}
'import requests
url = "https://api.wellapp.ai/v1/transactions/{id}"
payload = {
"type": "transaction",
"attributes": {
"status": "completed",
"executed_at": "2024-01-15T14:35:00Z",
"booking_date": "2024-01-15",
"value_date": "2024-01-15",
"settlement_amount": {
"currency": "USD",
"amount": 1355.25
},
"foreign_exchange": {
"currency_rate": "1.0842",
"currency_rate_source": "ECB",
"currency_rate_at": "2024-01-15T14:35:00Z"
},
"remittance_information": {
"unstructured": "Salary payment January 2024 - Updated",
"structured_reference": "RF18539007547034",
"reference_type": "SCOR"
},
"fees": [
{
"type": "transfer_fee",
"amount": 2.5,
"currency": "EUR"
},
{
"type": "exchange_fee",
"amount": 7.5,
"currency": "EUR"
}
]
},
"relationships": { "documents": { "data": [
{
"type": "invoice",
"id": "550e8400-e29b-41d4-a716-446655440004"
},
{
"type": "document",
"id": "550e8400-e29b-41d4-a716-446655440020"
}
] } }
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'transaction',
attributes: {
status: 'completed',
executed_at: '2024-01-15T14:35:00Z',
booking_date: '2024-01-15',
value_date: '2024-01-15',
settlement_amount: {currency: 'USD', amount: 1355.25},
foreign_exchange: {
currency_rate: '1.0842',
currency_rate_source: 'ECB',
currency_rate_at: '2024-01-15T14:35:00Z'
},
remittance_information: {
unstructured: 'Salary payment January 2024 - Updated',
structured_reference: 'RF18539007547034',
reference_type: 'SCOR'
},
fees: [
{type: 'transfer_fee', amount: 2.5, currency: 'EUR'},
{type: 'exchange_fee', amount: 7.5, currency: 'EUR'}
]
},
relationships: {
documents: {
data: [
{type: 'invoice', id: '550e8400-e29b-41d4-a716-446655440004'},
{type: 'document', id: '550e8400-e29b-41d4-a716-446655440020'}
]
}
}
})
};
fetch('https://api.wellapp.ai/v1/transactions/{id}', 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://api.wellapp.ai/v1/transactions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'transaction',
'attributes' => [
'status' => 'completed',
'executed_at' => '2024-01-15T14:35:00Z',
'booking_date' => '2024-01-15',
'value_date' => '2024-01-15',
'settlement_amount' => [
'currency' => 'USD',
'amount' => 1355.25
],
'foreign_exchange' => [
'currency_rate' => '1.0842',
'currency_rate_source' => 'ECB',
'currency_rate_at' => '2024-01-15T14:35:00Z'
],
'remittance_information' => [
'unstructured' => 'Salary payment January 2024 - Updated',
'structured_reference' => 'RF18539007547034',
'reference_type' => 'SCOR'
],
'fees' => [
[
'type' => 'transfer_fee',
'amount' => 2.5,
'currency' => 'EUR'
],
[
'type' => 'exchange_fee',
'amount' => 7.5,
'currency' => 'EUR'
]
]
],
'relationships' => [
'documents' => [
'data' => [
[
'type' => 'invoice',
'id' => '550e8400-e29b-41d4-a716-446655440004'
],
[
'type' => 'document',
'id' => '550e8400-e29b-41d4-a716-446655440020'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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://api.wellapp.ai/v1/transactions/{id}"
payload := strings.NewReader("{\n \"type\": \"transaction\",\n \"attributes\": {\n \"status\": \"completed\",\n \"executed_at\": \"2024-01-15T14:35:00Z\",\n \"booking_date\": \"2024-01-15\",\n \"value_date\": \"2024-01-15\",\n \"settlement_amount\": {\n \"currency\": \"USD\",\n \"amount\": 1355.25\n },\n \"foreign_exchange\": {\n \"currency_rate\": \"1.0842\",\n \"currency_rate_source\": \"ECB\",\n \"currency_rate_at\": \"2024-01-15T14:35:00Z\"\n },\n \"remittance_information\": {\n \"unstructured\": \"Salary payment January 2024 - Updated\",\n \"structured_reference\": \"RF18539007547034\",\n \"reference_type\": \"SCOR\"\n },\n \"fees\": [\n {\n \"type\": \"transfer_fee\",\n \"amount\": 2.5,\n \"currency\": \"EUR\"\n },\n {\n \"type\": \"exchange_fee\",\n \"amount\": 7.5,\n \"currency\": \"EUR\"\n }\n ]\n },\n \"relationships\": {\n \"documents\": {\n \"data\": [\n {\n \"type\": \"invoice\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440004\"\n },\n {\n \"type\": \"document\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440020\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.patch("https://api.wellapp.ai/v1/transactions/{id}")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"transaction\",\n \"attributes\": {\n \"status\": \"completed\",\n \"executed_at\": \"2024-01-15T14:35:00Z\",\n \"booking_date\": \"2024-01-15\",\n \"value_date\": \"2024-01-15\",\n \"settlement_amount\": {\n \"currency\": \"USD\",\n \"amount\": 1355.25\n },\n \"foreign_exchange\": {\n \"currency_rate\": \"1.0842\",\n \"currency_rate_source\": \"ECB\",\n \"currency_rate_at\": \"2024-01-15T14:35:00Z\"\n },\n \"remittance_information\": {\n \"unstructured\": \"Salary payment January 2024 - Updated\",\n \"structured_reference\": \"RF18539007547034\",\n \"reference_type\": \"SCOR\"\n },\n \"fees\": [\n {\n \"type\": \"transfer_fee\",\n \"amount\": 2.5,\n \"currency\": \"EUR\"\n },\n {\n \"type\": \"exchange_fee\",\n \"amount\": 7.5,\n \"currency\": \"EUR\"\n }\n ]\n },\n \"relationships\": {\n \"documents\": {\n \"data\": [\n {\n \"type\": \"invoice\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440004\"\n },\n {\n \"type\": \"document\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440020\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wellapp.ai/v1/transactions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"transaction\",\n \"attributes\": {\n \"status\": \"completed\",\n \"executed_at\": \"2024-01-15T14:35:00Z\",\n \"booking_date\": \"2024-01-15\",\n \"value_date\": \"2024-01-15\",\n \"settlement_amount\": {\n \"currency\": \"USD\",\n \"amount\": 1355.25\n },\n \"foreign_exchange\": {\n \"currency_rate\": \"1.0842\",\n \"currency_rate_source\": \"ECB\",\n \"currency_rate_at\": \"2024-01-15T14:35:00Z\"\n },\n \"remittance_information\": {\n \"unstructured\": \"Salary payment January 2024 - Updated\",\n \"structured_reference\": \"RF18539007547034\",\n \"reference_type\": \"SCOR\"\n },\n \"fees\": [\n {\n \"type\": \"transfer_fee\",\n \"amount\": 2.5,\n \"currency\": \"EUR\"\n },\n {\n \"type\": \"exchange_fee\",\n \"amount\": 7.5,\n \"currency\": \"EUR\"\n }\n ]\n },\n \"relationships\": {\n \"documents\": {\n \"data\": [\n {\n \"type\": \"invoice\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440004\"\n },\n {\n \"type\": \"document\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440020\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "transaction",
"id": "550e8400-e29b-41d4-a716-446655440010",
"attributes": {
"scheme": "sepa",
"external_ids": {
"transaction_id": "TXN_SEPA_20240115_001",
"payment_request_id": "PAY_REQ_001",
"end_to_end_id": "E2E_20240115_ACME_001"
},
"requested_execution_date": "2024-01-15",
"executed_at": "2024-01-15T14:35:00Z",
"booking_date": "2024-01-15",
"value_date": "2024-01-15",
"instructed_amount": {
"currency": "EUR",
"amount": 1250
},
"settlement_amount": {
"currency": "USD",
"amount": 1355.25
},
"foreign_exchange": {
"currency_rate": "1.0842",
"currency_pair": "EURUSD",
"currency_rate_source": "ECB",
"currency_rate_at": "2024-01-15T14:35:00Z"
},
"transaction_type": "transfer",
"status": "completed",
"category_purpose": "CBFF",
"purpose_code": "SALA",
"remittance_information": {
"unstructured": "Salary payment January 2024 - Updated",
"structured_reference": "RF18539007547034",
"reference_type": "SCOR"
},
"fees": [
{
"type": "transfer_fee",
"amount": 2.5,
"currency": "EUR"
},
{
"type": "exchange_fee",
"amount": 7.5,
"currency": "EUR"
}
],
"created_at": "2024-01-15T14:30:00Z",
"updated_at": "2024-01-15T14:40:00Z"
},
"relationships": {
"debtor_payment_means": {
"data": {
"type": "payment_means",
"id": "550e8400-e29b-41d4-a716-446655440000"
}
},
"creditor_payment_means": {
"data": {
"type": "payment_means",
"id": "550e8400-e29b-41d4-a716-446655440001"
}
},
"debtor": {
"data": {
"type": "company",
"id": "550e8400-e29b-41d4-a716-446655440002"
}
},
"creditor": {
"data": {
"type": "people",
"id": "550e8400-e29b-41d4-a716-446655440003"
}
},
"documents": {
"data": [
{
"type": "invoice",
"id": "550e8400-e29b-41d4-a716-446655440004"
},
{
"type": "document",
"id": "550e8400-e29b-41d4-a716-446655440020"
}
]
},
"created_by": {
"data": {
"type": "people",
"id": "550e8400-e29b-41d4-a716-446655440005"
}
},
"workspaces": {
"data": [
{
"type": "workspace",
"id": "550e8400-e29b-41d4-a716-446655440006"
}
]
}
}
},
"included": [
{
"type": "payment_means",
"id": "550e8400-e29b-41d4-a716-446655440000",
"attributes": {
"type": "account_details",
"status": "active",
"nickname": "Business Primary Account",
"description": "Main SEPA account for outgoing payments"
}
},
{
"type": "payment_means",
"id": "550e8400-e29b-41d4-a716-446655440001",
"attributes": {
"type": "account_details",
"status": "active",
"nickname": "Employee Salary Account",
"description": "Dedicated account for receiving salary payments"
}
},
{
"type": "company",
"id": "550e8400-e29b-41d4-a716-446655440002",
"attributes": {
"name": "Acme Corporation",
"description": "Leading technology solutions provider"
}
},
{
"type": "people",
"id": "550e8400-e29b-41d4-a716-446655440003",
"attributes": {
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"job_title": "Software Engineer"
}
},
{
"type": "invoice",
"id": "550e8400-e29b-41d4-a716-446655440004",
"attributes": {
"invoice_number": "INV-2024-0115",
"amount": 1250,
"currency": "EUR",
"status": "paid"
}
},
{
"type": "document",
"id": "550e8400-e29b-41d4-a716-446655440020",
"attributes": {
"name": "Payment Receipt",
"filename": "receipt-2024-0115.pdf",
"content_type": "application/pdf"
}
}
]
}{
"errors": [
{
"id": "invalid_status_transition",
"status": "400",
"code": "INVALID_STATUS_TRANSITION",
"title": "Invalid Status Transition",
"detail": "Cannot change transaction status from 'completed' to 'pending'",
"source": {
"pointer": "/data/attributes/status"
}
}
]
}{
"errors": [
{
"id": "unauthorized",
"status": "401",
"code": "UNAUTHORIZED",
"title": "Unauthorized",
"detail": "Valid authentication credentials are required"
}
]
}{
"errors": [
{
"id": "transaction_not_found",
"status": "404",
"code": "TRANSACTION_NOT_FOUND",
"title": "Transaction Not Found",
"detail": "The requested transaction does not exist or you don't have permission to access it",
"source": {
"parameter": "id"
}
}
]
}Transactions
Update Transaction
Update a financial transaction record with comprehensive payment details, foreign exchange information, remittance data, fees, and relationship associations. This endpoint supports:
Partial updates: All fields are optional - only provide the fields you want to update.
Status management: Update transaction status from pending to completed, failed, or cancelled.
Relationship updates: Modify debtor/creditor payment means, entities, documents, and workspace associations.
Financial adjustments: Update amounts, foreign exchange rates, fees, and remittance information.
Audit trail: Automatically updates the updated_at timestamp while preserving creation history.
Data integrity: Validates business rules and maintains consistency across related entities.
PATCH
/
v1
/
transactions
/
{id}
Update an existing transaction
curl --request PATCH \
--url https://api.wellapp.ai/v1/transactions/{id} \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "transaction",
"attributes": {
"status": "completed",
"executed_at": "2024-01-15T14:35:00Z",
"booking_date": "2024-01-15",
"value_date": "2024-01-15",
"settlement_amount": {
"currency": "USD",
"amount": 1355.25
},
"foreign_exchange": {
"currency_rate": "1.0842",
"currency_rate_source": "ECB",
"currency_rate_at": "2024-01-15T14:35:00Z"
},
"remittance_information": {
"unstructured": "Salary payment January 2024 - Updated",
"structured_reference": "RF18539007547034",
"reference_type": "SCOR"
},
"fees": [
{
"type": "transfer_fee",
"amount": 2.5,
"currency": "EUR"
},
{
"type": "exchange_fee",
"amount": 7.5,
"currency": "EUR"
}
]
},
"relationships": {
"documents": {
"data": [
{
"type": "invoice",
"id": "550e8400-e29b-41d4-a716-446655440004"
},
{
"type": "document",
"id": "550e8400-e29b-41d4-a716-446655440020"
}
]
}
}
}
'import requests
url = "https://api.wellapp.ai/v1/transactions/{id}"
payload = {
"type": "transaction",
"attributes": {
"status": "completed",
"executed_at": "2024-01-15T14:35:00Z",
"booking_date": "2024-01-15",
"value_date": "2024-01-15",
"settlement_amount": {
"currency": "USD",
"amount": 1355.25
},
"foreign_exchange": {
"currency_rate": "1.0842",
"currency_rate_source": "ECB",
"currency_rate_at": "2024-01-15T14:35:00Z"
},
"remittance_information": {
"unstructured": "Salary payment January 2024 - Updated",
"structured_reference": "RF18539007547034",
"reference_type": "SCOR"
},
"fees": [
{
"type": "transfer_fee",
"amount": 2.5,
"currency": "EUR"
},
{
"type": "exchange_fee",
"amount": 7.5,
"currency": "EUR"
}
]
},
"relationships": { "documents": { "data": [
{
"type": "invoice",
"id": "550e8400-e29b-41d4-a716-446655440004"
},
{
"type": "document",
"id": "550e8400-e29b-41d4-a716-446655440020"
}
] } }
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'transaction',
attributes: {
status: 'completed',
executed_at: '2024-01-15T14:35:00Z',
booking_date: '2024-01-15',
value_date: '2024-01-15',
settlement_amount: {currency: 'USD', amount: 1355.25},
foreign_exchange: {
currency_rate: '1.0842',
currency_rate_source: 'ECB',
currency_rate_at: '2024-01-15T14:35:00Z'
},
remittance_information: {
unstructured: 'Salary payment January 2024 - Updated',
structured_reference: 'RF18539007547034',
reference_type: 'SCOR'
},
fees: [
{type: 'transfer_fee', amount: 2.5, currency: 'EUR'},
{type: 'exchange_fee', amount: 7.5, currency: 'EUR'}
]
},
relationships: {
documents: {
data: [
{type: 'invoice', id: '550e8400-e29b-41d4-a716-446655440004'},
{type: 'document', id: '550e8400-e29b-41d4-a716-446655440020'}
]
}
}
})
};
fetch('https://api.wellapp.ai/v1/transactions/{id}', 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://api.wellapp.ai/v1/transactions/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'transaction',
'attributes' => [
'status' => 'completed',
'executed_at' => '2024-01-15T14:35:00Z',
'booking_date' => '2024-01-15',
'value_date' => '2024-01-15',
'settlement_amount' => [
'currency' => 'USD',
'amount' => 1355.25
],
'foreign_exchange' => [
'currency_rate' => '1.0842',
'currency_rate_source' => 'ECB',
'currency_rate_at' => '2024-01-15T14:35:00Z'
],
'remittance_information' => [
'unstructured' => 'Salary payment January 2024 - Updated',
'structured_reference' => 'RF18539007547034',
'reference_type' => 'SCOR'
],
'fees' => [
[
'type' => 'transfer_fee',
'amount' => 2.5,
'currency' => 'EUR'
],
[
'type' => 'exchange_fee',
'amount' => 7.5,
'currency' => 'EUR'
]
]
],
'relationships' => [
'documents' => [
'data' => [
[
'type' => 'invoice',
'id' => '550e8400-e29b-41d4-a716-446655440004'
],
[
'type' => 'document',
'id' => '550e8400-e29b-41d4-a716-446655440020'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"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://api.wellapp.ai/v1/transactions/{id}"
payload := strings.NewReader("{\n \"type\": \"transaction\",\n \"attributes\": {\n \"status\": \"completed\",\n \"executed_at\": \"2024-01-15T14:35:00Z\",\n \"booking_date\": \"2024-01-15\",\n \"value_date\": \"2024-01-15\",\n \"settlement_amount\": {\n \"currency\": \"USD\",\n \"amount\": 1355.25\n },\n \"foreign_exchange\": {\n \"currency_rate\": \"1.0842\",\n \"currency_rate_source\": \"ECB\",\n \"currency_rate_at\": \"2024-01-15T14:35:00Z\"\n },\n \"remittance_information\": {\n \"unstructured\": \"Salary payment January 2024 - Updated\",\n \"structured_reference\": \"RF18539007547034\",\n \"reference_type\": \"SCOR\"\n },\n \"fees\": [\n {\n \"type\": \"transfer_fee\",\n \"amount\": 2.5,\n \"currency\": \"EUR\"\n },\n {\n \"type\": \"exchange_fee\",\n \"amount\": 7.5,\n \"currency\": \"EUR\"\n }\n ]\n },\n \"relationships\": {\n \"documents\": {\n \"data\": [\n {\n \"type\": \"invoice\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440004\"\n },\n {\n \"type\": \"document\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440020\"\n }\n ]\n }\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<authorization>")
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.patch("https://api.wellapp.ai/v1/transactions/{id}")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"transaction\",\n \"attributes\": {\n \"status\": \"completed\",\n \"executed_at\": \"2024-01-15T14:35:00Z\",\n \"booking_date\": \"2024-01-15\",\n \"value_date\": \"2024-01-15\",\n \"settlement_amount\": {\n \"currency\": \"USD\",\n \"amount\": 1355.25\n },\n \"foreign_exchange\": {\n \"currency_rate\": \"1.0842\",\n \"currency_rate_source\": \"ECB\",\n \"currency_rate_at\": \"2024-01-15T14:35:00Z\"\n },\n \"remittance_information\": {\n \"unstructured\": \"Salary payment January 2024 - Updated\",\n \"structured_reference\": \"RF18539007547034\",\n \"reference_type\": \"SCOR\"\n },\n \"fees\": [\n {\n \"type\": \"transfer_fee\",\n \"amount\": 2.5,\n \"currency\": \"EUR\"\n },\n {\n \"type\": \"exchange_fee\",\n \"amount\": 7.5,\n \"currency\": \"EUR\"\n }\n ]\n },\n \"relationships\": {\n \"documents\": {\n \"data\": [\n {\n \"type\": \"invoice\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440004\"\n },\n {\n \"type\": \"document\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440020\"\n }\n ]\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wellapp.ai/v1/transactions/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"transaction\",\n \"attributes\": {\n \"status\": \"completed\",\n \"executed_at\": \"2024-01-15T14:35:00Z\",\n \"booking_date\": \"2024-01-15\",\n \"value_date\": \"2024-01-15\",\n \"settlement_amount\": {\n \"currency\": \"USD\",\n \"amount\": 1355.25\n },\n \"foreign_exchange\": {\n \"currency_rate\": \"1.0842\",\n \"currency_rate_source\": \"ECB\",\n \"currency_rate_at\": \"2024-01-15T14:35:00Z\"\n },\n \"remittance_information\": {\n \"unstructured\": \"Salary payment January 2024 - Updated\",\n \"structured_reference\": \"RF18539007547034\",\n \"reference_type\": \"SCOR\"\n },\n \"fees\": [\n {\n \"type\": \"transfer_fee\",\n \"amount\": 2.5,\n \"currency\": \"EUR\"\n },\n {\n \"type\": \"exchange_fee\",\n \"amount\": 7.5,\n \"currency\": \"EUR\"\n }\n ]\n },\n \"relationships\": {\n \"documents\": {\n \"data\": [\n {\n \"type\": \"invoice\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440004\"\n },\n {\n \"type\": \"document\",\n \"id\": \"550e8400-e29b-41d4-a716-446655440020\"\n }\n ]\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "transaction",
"id": "550e8400-e29b-41d4-a716-446655440010",
"attributes": {
"scheme": "sepa",
"external_ids": {
"transaction_id": "TXN_SEPA_20240115_001",
"payment_request_id": "PAY_REQ_001",
"end_to_end_id": "E2E_20240115_ACME_001"
},
"requested_execution_date": "2024-01-15",
"executed_at": "2024-01-15T14:35:00Z",
"booking_date": "2024-01-15",
"value_date": "2024-01-15",
"instructed_amount": {
"currency": "EUR",
"amount": 1250
},
"settlement_amount": {
"currency": "USD",
"amount": 1355.25
},
"foreign_exchange": {
"currency_rate": "1.0842",
"currency_pair": "EURUSD",
"currency_rate_source": "ECB",
"currency_rate_at": "2024-01-15T14:35:00Z"
},
"transaction_type": "transfer",
"status": "completed",
"category_purpose": "CBFF",
"purpose_code": "SALA",
"remittance_information": {
"unstructured": "Salary payment January 2024 - Updated",
"structured_reference": "RF18539007547034",
"reference_type": "SCOR"
},
"fees": [
{
"type": "transfer_fee",
"amount": 2.5,
"currency": "EUR"
},
{
"type": "exchange_fee",
"amount": 7.5,
"currency": "EUR"
}
],
"created_at": "2024-01-15T14:30:00Z",
"updated_at": "2024-01-15T14:40:00Z"
},
"relationships": {
"debtor_payment_means": {
"data": {
"type": "payment_means",
"id": "550e8400-e29b-41d4-a716-446655440000"
}
},
"creditor_payment_means": {
"data": {
"type": "payment_means",
"id": "550e8400-e29b-41d4-a716-446655440001"
}
},
"debtor": {
"data": {
"type": "company",
"id": "550e8400-e29b-41d4-a716-446655440002"
}
},
"creditor": {
"data": {
"type": "people",
"id": "550e8400-e29b-41d4-a716-446655440003"
}
},
"documents": {
"data": [
{
"type": "invoice",
"id": "550e8400-e29b-41d4-a716-446655440004"
},
{
"type": "document",
"id": "550e8400-e29b-41d4-a716-446655440020"
}
]
},
"created_by": {
"data": {
"type": "people",
"id": "550e8400-e29b-41d4-a716-446655440005"
}
},
"workspaces": {
"data": [
{
"type": "workspace",
"id": "550e8400-e29b-41d4-a716-446655440006"
}
]
}
}
},
"included": [
{
"type": "payment_means",
"id": "550e8400-e29b-41d4-a716-446655440000",
"attributes": {
"type": "account_details",
"status": "active",
"nickname": "Business Primary Account",
"description": "Main SEPA account for outgoing payments"
}
},
{
"type": "payment_means",
"id": "550e8400-e29b-41d4-a716-446655440001",
"attributes": {
"type": "account_details",
"status": "active",
"nickname": "Employee Salary Account",
"description": "Dedicated account for receiving salary payments"
}
},
{
"type": "company",
"id": "550e8400-e29b-41d4-a716-446655440002",
"attributes": {
"name": "Acme Corporation",
"description": "Leading technology solutions provider"
}
},
{
"type": "people",
"id": "550e8400-e29b-41d4-a716-446655440003",
"attributes": {
"first_name": "John",
"last_name": "Doe",
"full_name": "John Doe",
"job_title": "Software Engineer"
}
},
{
"type": "invoice",
"id": "550e8400-e29b-41d4-a716-446655440004",
"attributes": {
"invoice_number": "INV-2024-0115",
"amount": 1250,
"currency": "EUR",
"status": "paid"
}
},
{
"type": "document",
"id": "550e8400-e29b-41d4-a716-446655440020",
"attributes": {
"name": "Payment Receipt",
"filename": "receipt-2024-0115.pdf",
"content_type": "application/pdf"
}
}
]
}{
"errors": [
{
"id": "invalid_status_transition",
"status": "400",
"code": "INVALID_STATUS_TRANSITION",
"title": "Invalid Status Transition",
"detail": "Cannot change transaction status from 'completed' to 'pending'",
"source": {
"pointer": "/data/attributes/status"
}
}
]
}{
"errors": [
{
"id": "unauthorized",
"status": "401",
"code": "UNAUTHORIZED",
"title": "Unauthorized",
"detail": "Valid authentication credentials are required"
}
]
}{
"errors": [
{
"id": "transaction_not_found",
"status": "404",
"code": "TRANSACTION_NOT_FOUND",
"title": "Transaction Not Found",
"detail": "The requested transaction does not exist or you don't have permission to access it",
"source": {
"parameter": "id"
}
}
]
}⌘I