Delete a payment method
curl --request DELETE \
--url https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_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.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"payment_method": {
"lago_id": "4cf085a7-c196-4f07-a543-97c50ec6e8b2",
"is_default": true,
"payment_provider_type": "stripe",
"provider_method_id": "pm_1N8ZQX2eZvKYlo2CkL9Y8XYZ",
"created_at": "2025-01-21T00:10:29Z",
"payment_provider_code": "stripe_prod",
"payment_provider_name": "Stripe"
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}Payment methods
Delete a payment method from a customer
This endpoint deletes a specific payment method for a customer.
DELETE
/
customers
/
{external_customer_id}
/
payment_methods
/
{lago_id}
Delete a payment method
curl --request DELETE \
--url https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_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.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.getlago.com/api/v1/customers/{external_customer_id}/payment_methods/{lago_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"payment_method": {
"lago_id": "4cf085a7-c196-4f07-a543-97c50ec6e8b2",
"is_default": true,
"payment_provider_type": "stripe",
"provider_method_id": "pm_1N8ZQX2eZvKYlo2CkL9Y8XYZ",
"created_at": "2025-01-21T00:10:29Z",
"payment_provider_code": "stripe_prod",
"payment_provider_name": "Stripe"
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The payment method unique identifier, created by Lago.
Example:
"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
The customer external unique identifier (provided by your own application)
Example:
"5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba"
Response
Payment method deleted
Show child attributes
Show child attributes
Was this page helpful?
⌘I