Create a payment request
curl --request POST \
--url https://api.getlago.com/api/v1/payment_requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_request": {
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"email": "dinesh@piedpiper.test",
"lago_invoice_ids": [
"1a901a90-1a90-1a90-1a90-1a901a901a90"
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
}
'import requests
url = "https://api.getlago.com/api/v1/payment_requests"
payload = { "payment_request": {
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"email": "dinesh@piedpiper.test",
"lago_invoice_ids": ["1a901a90-1a90-1a90-1a90-1a901a901a90"],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
} }
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_request: {
external_customer_id: '5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba',
email: 'dinesh@piedpiper.test',
lago_invoice_ids: ['1a901a90-1a90-1a90-1a90-1a901a901a90'],
payment_method: {
payment_method_type: 'provider',
payment_method_id: '1a901a90-1a90-1a90-1a90-1a901a901a90'
}
}
})
};
fetch('https://api.getlago.com/api/v1/payment_requests', 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/payment_requests",
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_request' => [
'external_customer_id' => '5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba',
'email' => 'dinesh@piedpiper.test',
'lago_invoice_ids' => [
'1a901a90-1a90-1a90-1a90-1a901a901a90'
],
'payment_method' => [
'payment_method_type' => 'provider',
'payment_method_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90'
]
]
]),
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/payment_requests"
payload := strings.NewReader("{\n \"payment_request\": {\n \"external_customer_id\": \"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba\",\n \"email\": \"dinesh@piedpiper.test\",\n \"lago_invoice_ids\": [\n \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\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.getlago.com/api/v1/payment_requests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_request\": {\n \"external_customer_id\": \"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba\",\n \"email\": \"dinesh@piedpiper.test\",\n \"lago_invoice_ids\": [\n \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/payment_requests")
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_request\": {\n \"external_customer_id\": \"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba\",\n \"email\": \"dinesh@piedpiper.test\",\n \"lago_invoice_ids\": [\n \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"payment_request": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"email": "dinesh@piedpiper.test",
"amount_cents": 100,
"amount_currency": "EUR",
"payment_status": "succeeded",
"created_at": "2022-04-29T08:59:51Z",
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"sequential_id": 1,
"slug": "LAG-1234-001",
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"applicable_timezone": "America/Los_Angeles",
"created_at": "2022-04-29T08:59:51Z",
"billing_entity_code": "acme_corp",
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"currency": "USD",
"email": "dinesh@piedpiper.test",
"legal_name": "Coleman-Blair",
"legal_number": "49-008-2965",
"logo_url": "http://hooli.com/logo.png",
"name": "Gavin Belson",
"firstname": "Gavin",
"lastname": "Belson",
"account_type": "customer",
"phone": "1-171-883-3711 x245",
"state": "CA",
"tax_identification_number": "EU123456789",
"timezone": "America/Los_Angeles",
"url": "http://hooli.com",
"zipcode": "91364",
"net_payment_term": 30,
"updated_at": "2022-04-29T08:59:51Z",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"billing_configuration": {
"invoice_grace_period": 3,
"subscription_invoice_issuing_date_anchor": "next_period_start",
"subscription_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "stripe",
"payment_provider_code": "stripe-eu-1",
"provider_customer_id": "cus_12345",
"sync": true,
"sync_with_provider": true,
"document_locale": "fr",
"provider_payment_methods": [
"card",
"sepa_debit",
"us_bank_account",
"bacs_debit",
"link",
"boleto",
"crypto",
"customer_balance"
]
},
"shipping_address": {
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"state": "CA",
"zipcode": "91364"
},
"metadata": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "Purchase Order",
"value": "123456789",
"display_in_invoice": true,
"created_at": "2022-04-29T08:59:51Z"
}
]
},
"invoices": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "acme_corp",
"number": "LAG-1234-001-002",
"issuing_date": "2022-04-30",
"invoice_type": "subscription",
"status": "finalized",
"payment_status": "succeeded",
"currency": "EUR",
"fees_amount_cents": 100,
"coupons_amount_cents": 10,
"credit_notes_amount_cents": 10,
"sub_total_excluding_taxes_amount_cents": 100,
"taxes_amount_cents": 20,
"sub_total_including_taxes_amount_cents": 120,
"prepaid_credit_amount_cents": 0,
"progressive_billing_credit_amount_cents": 0,
"total_amount_cents": 100,
"version_number": 3,
"created_at": "2022-04-29T08:59:51Z",
"updated_at": "2022-04-29T08:59:51Z",
"sequential_id": 2,
"payment_dispute_lost_at": "2022-09-14T16:35:31Z",
"payment_due_date": "2022-04-30",
"payment_overdue": true,
"net_payment_term": 30,
"prepaid_granted_credit_amount_cents": 0,
"prepaid_purchased_credit_amount_cents": 0,
"self_billed": false,
"file_url": "https://getlago.com/invoice/file"
}
]
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Payment requests
Create a payment request
This endpoint is used to create a payment request to collect payments of overdue invoices of a given customer
POST
/
payment_requests
Create a payment request
curl --request POST \
--url https://api.getlago.com/api/v1/payment_requests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_request": {
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"email": "dinesh@piedpiper.test",
"lago_invoice_ids": [
"1a901a90-1a90-1a90-1a90-1a901a901a90"
],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
}
}
'import requests
url = "https://api.getlago.com/api/v1/payment_requests"
payload = { "payment_request": {
"external_customer_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"email": "dinesh@piedpiper.test",
"lago_invoice_ids": ["1a901a90-1a90-1a90-1a90-1a901a901a90"],
"payment_method": {
"payment_method_type": "provider",
"payment_method_id": "1a901a90-1a90-1a90-1a90-1a901a901a90"
}
} }
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_request: {
external_customer_id: '5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba',
email: 'dinesh@piedpiper.test',
lago_invoice_ids: ['1a901a90-1a90-1a90-1a90-1a901a901a90'],
payment_method: {
payment_method_type: 'provider',
payment_method_id: '1a901a90-1a90-1a90-1a90-1a901a901a90'
}
}
})
};
fetch('https://api.getlago.com/api/v1/payment_requests', 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/payment_requests",
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_request' => [
'external_customer_id' => '5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba',
'email' => 'dinesh@piedpiper.test',
'lago_invoice_ids' => [
'1a901a90-1a90-1a90-1a90-1a901a901a90'
],
'payment_method' => [
'payment_method_type' => 'provider',
'payment_method_id' => '1a901a90-1a90-1a90-1a90-1a901a901a90'
]
]
]),
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/payment_requests"
payload := strings.NewReader("{\n \"payment_request\": {\n \"external_customer_id\": \"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba\",\n \"email\": \"dinesh@piedpiper.test\",\n \"lago_invoice_ids\": [\n \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\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.getlago.com/api/v1/payment_requests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_request\": {\n \"external_customer_id\": \"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba\",\n \"email\": \"dinesh@piedpiper.test\",\n \"lago_invoice_ids\": [\n \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/payment_requests")
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_request\": {\n \"external_customer_id\": \"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba\",\n \"email\": \"dinesh@piedpiper.test\",\n \"lago_invoice_ids\": [\n \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n ],\n \"payment_method\": {\n \"payment_method_type\": \"provider\",\n \"payment_method_id\": \"1a901a90-1a90-1a90-1a90-1a901a901a90\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"payment_request": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"email": "dinesh@piedpiper.test",
"amount_cents": 100,
"amount_currency": "EUR",
"payment_status": "succeeded",
"created_at": "2022-04-29T08:59:51Z",
"customer": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"sequential_id": 1,
"slug": "LAG-1234-001",
"external_id": "5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba",
"applicable_timezone": "America/Los_Angeles",
"created_at": "2022-04-29T08:59:51Z",
"billing_entity_code": "acme_corp",
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"currency": "USD",
"email": "dinesh@piedpiper.test",
"legal_name": "Coleman-Blair",
"legal_number": "49-008-2965",
"logo_url": "http://hooli.com/logo.png",
"name": "Gavin Belson",
"firstname": "Gavin",
"lastname": "Belson",
"account_type": "customer",
"phone": "1-171-883-3711 x245",
"state": "CA",
"tax_identification_number": "EU123456789",
"timezone": "America/Los_Angeles",
"url": "http://hooli.com",
"zipcode": "91364",
"net_payment_term": 30,
"updated_at": "2022-04-29T08:59:51Z",
"finalize_zero_amount_invoice": "inherit",
"skip_invoice_custom_sections": false,
"billing_configuration": {
"invoice_grace_period": 3,
"subscription_invoice_issuing_date_anchor": "next_period_start",
"subscription_invoice_issuing_date_adjustment": "keep_anchor",
"payment_provider": "stripe",
"payment_provider_code": "stripe-eu-1",
"provider_customer_id": "cus_12345",
"sync": true,
"sync_with_provider": true,
"document_locale": "fr",
"provider_payment_methods": [
"card",
"sepa_debit",
"us_bank_account",
"bacs_debit",
"link",
"boleto",
"crypto",
"customer_balance"
]
},
"shipping_address": {
"address_line1": "5230 Penfield Ave",
"address_line2": null,
"city": "Woodland Hills",
"country": "US",
"state": "CA",
"zipcode": "91364"
},
"metadata": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"key": "Purchase Order",
"value": "123456789",
"display_in_invoice": true,
"created_at": "2022-04-29T08:59:51Z"
}
]
},
"invoices": [
{
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"billing_entity_code": "acme_corp",
"number": "LAG-1234-001-002",
"issuing_date": "2022-04-30",
"invoice_type": "subscription",
"status": "finalized",
"payment_status": "succeeded",
"currency": "EUR",
"fees_amount_cents": 100,
"coupons_amount_cents": 10,
"credit_notes_amount_cents": 10,
"sub_total_excluding_taxes_amount_cents": 100,
"taxes_amount_cents": 20,
"sub_total_including_taxes_amount_cents": 120,
"prepaid_credit_amount_cents": 0,
"progressive_billing_credit_amount_cents": 0,
"total_amount_cents": 100,
"version_number": 3,
"created_at": "2022-04-29T08:59:51Z",
"updated_at": "2022-04-29T08:59:51Z",
"sequential_id": 2,
"payment_dispute_lost_at": "2022-09-14T16:35:31Z",
"payment_due_date": "2022-04-30",
"payment_overdue": true,
"net_payment_term": 30,
"prepaid_granted_credit_amount_cents": 0,
"prepaid_purchased_credit_amount_cents": 0,
"self_billed": false,
"file_url": "https://getlago.com/invoice/file"
}
]
}
}{
"status": 400,
"error": "Bad request"
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 422,
"error": "Unprocessable entity",
"code": "validation_errors",
"error_details": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
PaymentRequest payload
Show child attributes
Show child attributes
Response
PaymentRequest created
Show child attributes
Show child attributes
⌘I