create payments
curl --request POST \
--url https://api.togai.com/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Payment for services",
"notes": "Invoice payment",
"currency": "USD",
"accountId": "acc123",
"totalAmount": 10000,
"externalPaymentReference": {
"sourceName": "XYZ Company",
"sourceType": "CARD",
"transactionNumber": "TXN123",
"description": "Card payment"
},
"lineItemRecords": [
{
"togaiId": "inv.234.12efwe",
"order": 1,
"amount": 1000,
"type": "INVOICE"
},
{
"togaiId": "inv.236.12efwe",
"order": 2,
"amount": 500,
"type": "INVOICE"
},
{
"togaiId": "cred.236.12efwe",
"order": 3,
"amount": 200,
"type": "CREDIT"
}
]
}
'import requests
url = "https://api.togai.com/payments"
payload = {
"description": "Payment for services",
"notes": "Invoice payment",
"currency": "USD",
"accountId": "acc123",
"totalAmount": 10000,
"externalPaymentReference": {
"sourceName": "XYZ Company",
"sourceType": "CARD",
"transactionNumber": "TXN123",
"description": "Card payment"
},
"lineItemRecords": [
{
"togaiId": "inv.234.12efwe",
"order": 1,
"amount": 1000,
"type": "INVOICE"
},
{
"togaiId": "inv.236.12efwe",
"order": 2,
"amount": 500,
"type": "INVOICE"
},
{
"togaiId": "cred.236.12efwe",
"order": 3,
"amount": 200,
"type": "CREDIT"
}
]
}
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({
description: 'Payment for services',
notes: 'Invoice payment',
currency: 'USD',
accountId: 'acc123',
totalAmount: 10000,
externalPaymentReference: {
sourceName: 'XYZ Company',
sourceType: 'CARD',
transactionNumber: 'TXN123',
description: 'Card payment'
},
lineItemRecords: [
{togaiId: 'inv.234.12efwe', order: 1, amount: 1000, type: 'INVOICE'},
{togaiId: 'inv.236.12efwe', order: 2, amount: 500, type: 'INVOICE'},
{togaiId: 'cred.236.12efwe', order: 3, amount: 200, type: 'CREDIT'}
]
})
};
fetch('https://api.togai.com/payments', 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.togai.com/payments",
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([
'description' => 'Payment for services',
'notes' => 'Invoice payment',
'currency' => 'USD',
'accountId' => 'acc123',
'totalAmount' => 10000,
'externalPaymentReference' => [
'sourceName' => 'XYZ Company',
'sourceType' => 'CARD',
'transactionNumber' => 'TXN123',
'description' => 'Card payment'
],
'lineItemRecords' => [
[
'togaiId' => 'inv.234.12efwe',
'order' => 1,
'amount' => 1000,
'type' => 'INVOICE'
],
[
'togaiId' => 'inv.236.12efwe',
'order' => 2,
'amount' => 500,
'type' => 'INVOICE'
],
[
'togaiId' => 'cred.236.12efwe',
'order' => 3,
'amount' => 200,
'type' => 'CREDIT'
]
]
]),
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://api.togai.com/payments"
payload := strings.NewReader("{\n \"description\": \"Payment for services\",\n \"notes\": \"Invoice payment\",\n \"currency\": \"USD\",\n \"accountId\": \"acc123\",\n \"totalAmount\": 10000,\n \"externalPaymentReference\": {\n \"sourceName\": \"XYZ Company\",\n \"sourceType\": \"CARD\",\n \"transactionNumber\": \"TXN123\",\n \"description\": \"Card payment\"\n },\n \"lineItemRecords\": [\n {\n \"togaiId\": \"inv.234.12efwe\",\n \"order\": 1,\n \"amount\": 1000,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"inv.236.12efwe\",\n \"order\": 2,\n \"amount\": 500,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"cred.236.12efwe\",\n \"order\": 3,\n \"amount\": 200,\n \"type\": \"CREDIT\"\n }\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://api.togai.com/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Payment for services\",\n \"notes\": \"Invoice payment\",\n \"currency\": \"USD\",\n \"accountId\": \"acc123\",\n \"totalAmount\": 10000,\n \"externalPaymentReference\": {\n \"sourceName\": \"XYZ Company\",\n \"sourceType\": \"CARD\",\n \"transactionNumber\": \"TXN123\",\n \"description\": \"Card payment\"\n },\n \"lineItemRecords\": [\n {\n \"togaiId\": \"inv.234.12efwe\",\n \"order\": 1,\n \"amount\": 1000,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"inv.236.12efwe\",\n \"order\": 2,\n \"amount\": 500,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"cred.236.12efwe\",\n \"order\": 3,\n \"amount\": 200,\n \"type\": \"CREDIT\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/payments")
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 \"description\": \"Payment for services\",\n \"notes\": \"Invoice payment\",\n \"currency\": \"USD\",\n \"accountId\": \"acc123\",\n \"totalAmount\": 10000,\n \"externalPaymentReference\": {\n \"sourceName\": \"XYZ Company\",\n \"sourceType\": \"CARD\",\n \"transactionNumber\": \"TXN123\",\n \"description\": \"Card payment\"\n },\n \"lineItemRecords\": [\n {\n \"togaiId\": \"inv.234.12efwe\",\n \"order\": 1,\n \"amount\": 1000,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"inv.236.12efwe\",\n \"order\": 2,\n \"amount\": 500,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"cred.236.12efwe\",\n \"order\": 3,\n \"amount\": 200,\n \"type\": \"CREDIT\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "payment.1223dfs.234ds",
"description": "Payment for services",
"notes": "Invoice payment",
"accountId": "acc123",
"currency": "USD",
"externalPaymentReferences": {
"sourceName": "XYZ Company",
"sourceType": "CARD",
"transactionNumber": "TXN123",
"description": "Card payment"
},
"lineItemRecords": [
{
"togaiId": "inv.234.12efwe",
"amount": 1000,
"type": "INVOICE",
"order": 1
},
{
"togaiId": "inv.235.12efwe",
"amount": 600,
"type": "INVOICE",
"order": 2
},
{
"togaiId": "cred.236.12efwe",
"amount": 100,
"type": "CREDIT",
"order": 3
}
],
"totalAmount": 1700,
"version": 1,
"createdBy": "user123",
"createdAt": "2023-01-01T12:00:00"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Payments
create payments
create payments
POST
/
payments
create payments
curl --request POST \
--url https://api.togai.com/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Payment for services",
"notes": "Invoice payment",
"currency": "USD",
"accountId": "acc123",
"totalAmount": 10000,
"externalPaymentReference": {
"sourceName": "XYZ Company",
"sourceType": "CARD",
"transactionNumber": "TXN123",
"description": "Card payment"
},
"lineItemRecords": [
{
"togaiId": "inv.234.12efwe",
"order": 1,
"amount": 1000,
"type": "INVOICE"
},
{
"togaiId": "inv.236.12efwe",
"order": 2,
"amount": 500,
"type": "INVOICE"
},
{
"togaiId": "cred.236.12efwe",
"order": 3,
"amount": 200,
"type": "CREDIT"
}
]
}
'import requests
url = "https://api.togai.com/payments"
payload = {
"description": "Payment for services",
"notes": "Invoice payment",
"currency": "USD",
"accountId": "acc123",
"totalAmount": 10000,
"externalPaymentReference": {
"sourceName": "XYZ Company",
"sourceType": "CARD",
"transactionNumber": "TXN123",
"description": "Card payment"
},
"lineItemRecords": [
{
"togaiId": "inv.234.12efwe",
"order": 1,
"amount": 1000,
"type": "INVOICE"
},
{
"togaiId": "inv.236.12efwe",
"order": 2,
"amount": 500,
"type": "INVOICE"
},
{
"togaiId": "cred.236.12efwe",
"order": 3,
"amount": 200,
"type": "CREDIT"
}
]
}
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({
description: 'Payment for services',
notes: 'Invoice payment',
currency: 'USD',
accountId: 'acc123',
totalAmount: 10000,
externalPaymentReference: {
sourceName: 'XYZ Company',
sourceType: 'CARD',
transactionNumber: 'TXN123',
description: 'Card payment'
},
lineItemRecords: [
{togaiId: 'inv.234.12efwe', order: 1, amount: 1000, type: 'INVOICE'},
{togaiId: 'inv.236.12efwe', order: 2, amount: 500, type: 'INVOICE'},
{togaiId: 'cred.236.12efwe', order: 3, amount: 200, type: 'CREDIT'}
]
})
};
fetch('https://api.togai.com/payments', 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.togai.com/payments",
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([
'description' => 'Payment for services',
'notes' => 'Invoice payment',
'currency' => 'USD',
'accountId' => 'acc123',
'totalAmount' => 10000,
'externalPaymentReference' => [
'sourceName' => 'XYZ Company',
'sourceType' => 'CARD',
'transactionNumber' => 'TXN123',
'description' => 'Card payment'
],
'lineItemRecords' => [
[
'togaiId' => 'inv.234.12efwe',
'order' => 1,
'amount' => 1000,
'type' => 'INVOICE'
],
[
'togaiId' => 'inv.236.12efwe',
'order' => 2,
'amount' => 500,
'type' => 'INVOICE'
],
[
'togaiId' => 'cred.236.12efwe',
'order' => 3,
'amount' => 200,
'type' => 'CREDIT'
]
]
]),
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://api.togai.com/payments"
payload := strings.NewReader("{\n \"description\": \"Payment for services\",\n \"notes\": \"Invoice payment\",\n \"currency\": \"USD\",\n \"accountId\": \"acc123\",\n \"totalAmount\": 10000,\n \"externalPaymentReference\": {\n \"sourceName\": \"XYZ Company\",\n \"sourceType\": \"CARD\",\n \"transactionNumber\": \"TXN123\",\n \"description\": \"Card payment\"\n },\n \"lineItemRecords\": [\n {\n \"togaiId\": \"inv.234.12efwe\",\n \"order\": 1,\n \"amount\": 1000,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"inv.236.12efwe\",\n \"order\": 2,\n \"amount\": 500,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"cred.236.12efwe\",\n \"order\": 3,\n \"amount\": 200,\n \"type\": \"CREDIT\"\n }\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://api.togai.com/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Payment for services\",\n \"notes\": \"Invoice payment\",\n \"currency\": \"USD\",\n \"accountId\": \"acc123\",\n \"totalAmount\": 10000,\n \"externalPaymentReference\": {\n \"sourceName\": \"XYZ Company\",\n \"sourceType\": \"CARD\",\n \"transactionNumber\": \"TXN123\",\n \"description\": \"Card payment\"\n },\n \"lineItemRecords\": [\n {\n \"togaiId\": \"inv.234.12efwe\",\n \"order\": 1,\n \"amount\": 1000,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"inv.236.12efwe\",\n \"order\": 2,\n \"amount\": 500,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"cred.236.12efwe\",\n \"order\": 3,\n \"amount\": 200,\n \"type\": \"CREDIT\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/payments")
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 \"description\": \"Payment for services\",\n \"notes\": \"Invoice payment\",\n \"currency\": \"USD\",\n \"accountId\": \"acc123\",\n \"totalAmount\": 10000,\n \"externalPaymentReference\": {\n \"sourceName\": \"XYZ Company\",\n \"sourceType\": \"CARD\",\n \"transactionNumber\": \"TXN123\",\n \"description\": \"Card payment\"\n },\n \"lineItemRecords\": [\n {\n \"togaiId\": \"inv.234.12efwe\",\n \"order\": 1,\n \"amount\": 1000,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"inv.236.12efwe\",\n \"order\": 2,\n \"amount\": 500,\n \"type\": \"INVOICE\"\n },\n {\n \"togaiId\": \"cred.236.12efwe\",\n \"order\": 3,\n \"amount\": 200,\n \"type\": \"CREDIT\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "payment.1223dfs.234ds",
"description": "Payment for services",
"notes": "Invoice payment",
"accountId": "acc123",
"currency": "USD",
"externalPaymentReferences": {
"sourceName": "XYZ Company",
"sourceType": "CARD",
"transactionNumber": "TXN123",
"description": "Card payment"
},
"lineItemRecords": [
{
"togaiId": "inv.234.12efwe",
"amount": 1000,
"type": "INVOICE",
"order": 1
},
{
"togaiId": "inv.235.12efwe",
"amount": 600,
"type": "INVOICE",
"order": 2
},
{
"togaiId": "cred.236.12efwe",
"amount": 100,
"type": "CREDIT",
"order": 3
}
],
"totalAmount": 1700,
"version": 1,
"createdBy": "user123",
"createdAt": "2023-01-01T12:00:00"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}{
"message": "<Reason message>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Payload to create a payment
payload to create payment
Maximum string length:
512Example:
"ACC001"
external payment reference object
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Maximum string length:
512Example:
"USD"
A brief description of the payment
Maximum string length:
512Example:
"Payment for Invoice inv.234.23afv"
A detailed note about the payment
Maximum string length:
512Example:
"Payment for purchase of credits"
Response
Response for POST payments requests
Payment object
Example:
"pay.w123rwe.1231"
Example:
"ACC001"
external payment reference object
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I
