Create a payment
curl --request POST \
--url https://api.getlago.com/api/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment": {
"invoice_id": "486b147a-02a1-4ccf-8603-f3541fc25e7a",
"amount_cents": 100,
"reference": "ref1",
"paid_at": "2025-02-20"
}
}
'import requests
url = "https://api.getlago.com/api/v1/payments"
payload = { "payment": {
"invoice_id": "486b147a-02a1-4ccf-8603-f3541fc25e7a",
"amount_cents": 100,
"reference": "ref1",
"paid_at": "2025-02-20"
} }
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({
payment: {
invoice_id: '486b147a-02a1-4ccf-8603-f3541fc25e7a',
amount_cents: 100,
reference: 'ref1',
paid_at: '2025-02-20'
}
})
};
fetch('https://api.getlago.com/api/v1/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.getlago.com/api/v1/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([
'payment' => [
'invoice_id' => '486b147a-02a1-4ccf-8603-f3541fc25e7a',
'amount_cents' => 100,
'reference' => 'ref1',
'paid_at' => '2025-02-20'
]
]),
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.getlago.com/api/v1/payments"
payload := strings.NewReader("{\n \"payment\": {\n \"invoice_id\": \"486b147a-02a1-4ccf-8603-f3541fc25e7a\",\n \"amount_cents\": 100,\n \"reference\": \"ref1\",\n \"paid_at\": \"2025-02-20\"\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.getlago.com/api/v1/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment\": {\n \"invoice_id\": \"486b147a-02a1-4ccf-8603-f3541fc25e7a\",\n \"amount_cents\": 100,\n \"reference\": \"ref1\",\n \"paid_at\": \"2025-02-20\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/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 \"payment\": {\n \"invoice_id\": \"486b147a-02a1-4ccf-8603-f3541fc25e7a\",\n \"amount_cents\": 100,\n \"reference\": \"ref1\",\n \"paid_at\": \"2025-02-20\"\n }\n}"
response = http.request(request)
puts response.read_body{
"payment": {
"lago_id": "4cf085a7-c196-4f07-a543-97c50ec6e8b2",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"invoice_ids": [
"486b147a-02a1-4ccf-8603-f3541fc25e7a"
],
"lago_payable_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"payable_type": "Invoice",
"amount_cents": 1099,
"amount_currency": "USD",
"status": "Completed",
"payment_status": "succeeded",
"type": "manual",
"reference": "ref1",
"payment_provider_code": "stripe_prod",
"payment_provider_type": "stripe",
"external_payment_id": "<string>",
"provider_payment_id": "pi_5eb0285741bc6ba",
"provider_customer_id": "cus_5eb0285bcf941bc6ba",
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": {
"url": "https://hooks.stripe.com/3d_secure_2/hosted?merchant=acct_AAA&payment_intent=pi_BBB&payment_intent_client_secret=pi_BBB&publishable_key=pk_test_CCC",
"return_url": "https://app.example.com"
}
},
"created_at": "2025-01-21T00:10:29Z",
"invoice_numbers": [
"HOO-202D-005-001"
],
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Payments
Create a payment
This endpoint is used to create a manual payment
POST
/
payments
Create a payment
curl --request POST \
--url https://api.getlago.com/api/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment": {
"invoice_id": "486b147a-02a1-4ccf-8603-f3541fc25e7a",
"amount_cents": 100,
"reference": "ref1",
"paid_at": "2025-02-20"
}
}
'import requests
url = "https://api.getlago.com/api/v1/payments"
payload = { "payment": {
"invoice_id": "486b147a-02a1-4ccf-8603-f3541fc25e7a",
"amount_cents": 100,
"reference": "ref1",
"paid_at": "2025-02-20"
} }
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({
payment: {
invoice_id: '486b147a-02a1-4ccf-8603-f3541fc25e7a',
amount_cents: 100,
reference: 'ref1',
paid_at: '2025-02-20'
}
})
};
fetch('https://api.getlago.com/api/v1/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.getlago.com/api/v1/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([
'payment' => [
'invoice_id' => '486b147a-02a1-4ccf-8603-f3541fc25e7a',
'amount_cents' => 100,
'reference' => 'ref1',
'paid_at' => '2025-02-20'
]
]),
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.getlago.com/api/v1/payments"
payload := strings.NewReader("{\n \"payment\": {\n \"invoice_id\": \"486b147a-02a1-4ccf-8603-f3541fc25e7a\",\n \"amount_cents\": 100,\n \"reference\": \"ref1\",\n \"paid_at\": \"2025-02-20\"\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.getlago.com/api/v1/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment\": {\n \"invoice_id\": \"486b147a-02a1-4ccf-8603-f3541fc25e7a\",\n \"amount_cents\": 100,\n \"reference\": \"ref1\",\n \"paid_at\": \"2025-02-20\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/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 \"payment\": {\n \"invoice_id\": \"486b147a-02a1-4ccf-8603-f3541fc25e7a\",\n \"amount_cents\": 100,\n \"reference\": \"ref1\",\n \"paid_at\": \"2025-02-20\"\n }\n}"
response = http.request(request)
puts response.read_body{
"payment": {
"lago_id": "4cf085a7-c196-4f07-a543-97c50ec6e8b2",
"lago_customer_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"invoice_ids": [
"486b147a-02a1-4ccf-8603-f3541fc25e7a"
],
"lago_payable_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"payable_type": "Invoice",
"amount_cents": 1099,
"amount_currency": "USD",
"status": "Completed",
"payment_status": "succeeded",
"type": "manual",
"reference": "ref1",
"payment_provider_code": "stripe_prod",
"payment_provider_type": "stripe",
"external_payment_id": "<string>",
"provider_payment_id": "pi_5eb0285741bc6ba",
"provider_customer_id": "cus_5eb0285bcf941bc6ba",
"next_action": {
"type": "redirect_to_url",
"redirect_to_url": {
"url": "https://hooks.stripe.com/3d_secure_2/hosted?merchant=acct_AAA&payment_intent=pi_BBB&payment_intent_client_secret=pi_BBB&publishable_key=pk_test_CCC",
"return_url": "https://app.example.com"
}
},
"created_at": "2025-01-21T00:10:29Z",
"invoice_numbers": [
"HOO-202D-005-001"
],
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}⌘I