LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request DELETE "$LAGO_URL/api/v1/coupons/:code" \
--header "Authorization: Bearer $API_KEY"
from lago_python_client.client import Client
from lago_python_client.exceptions import LagoApiError
client = Client(api_key='__YOUR_API_KEY__')
try:
client.coupons.destroy('code')
except LagoApiError as e:
repair_broken_state(e) # do something on error or raise your own exception
require 'lago-ruby-client'
client = Lago::Api::Client.new(api_key: '__YOUR_API_KEY__')
client.coupons.destroy('code')
await client.coupons.destroyCoupon('code');
import "fmt"
import "github.com/getlago/lago-go-client"
func main() {
lagoClient := lago.New().
SetApiKey("__YOUR_API_KEY__")
coupon, err := lagoClient.Coupon().Delete("__YOUR_COUPON_CODE__")
if err != nil {
// Error is *lago.Error
panic(err)
}
// coupon is *lago.Coupon
fmt.Println(coupon)
}
{
"coupon": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Startup Deal",
"code": "startup_deal",
"coupon_type": "fixed_amount",
"reusable": true,
"limited_plans": true,
"limited_billable_metrics": false,
"frequency": "recurring",
"expiration": "time_limit",
"created_at": "2022-04-29T08:59:51Z",
"description": "I am a coupon description",
"amount_cents": 5000,
"amount_currency": "USD",
"plan_codes": [
"startup_plan"
],
"billable_metric_codes": [],
"percentage_rate": null,
"frequency_duration": 6,
"expiration_at": "2022-08-08T23:59:59Z",
"terminated_at": "2022-08-08T23:59:59Z"
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}Coupons
Delete a coupon
This endpoint is used to delete a coupon.
DELETE
/
coupons
/
{code}
LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request DELETE "$LAGO_URL/api/v1/coupons/:code" \
--header "Authorization: Bearer $API_KEY"
from lago_python_client.client import Client
from lago_python_client.exceptions import LagoApiError
client = Client(api_key='__YOUR_API_KEY__')
try:
client.coupons.destroy('code')
except LagoApiError as e:
repair_broken_state(e) # do something on error or raise your own exception
require 'lago-ruby-client'
client = Lago::Api::Client.new(api_key: '__YOUR_API_KEY__')
client.coupons.destroy('code')
await client.coupons.destroyCoupon('code');
import "fmt"
import "github.com/getlago/lago-go-client"
func main() {
lagoClient := lago.New().
SetApiKey("__YOUR_API_KEY__")
coupon, err := lagoClient.Coupon().Delete("__YOUR_COUPON_CODE__")
if err != nil {
// Error is *lago.Error
panic(err)
}
// coupon is *lago.Coupon
fmt.Println(coupon)
}
{
"coupon": {
"lago_id": "1a901a90-1a90-1a90-1a90-1a901a901a90",
"name": "Startup Deal",
"code": "startup_deal",
"coupon_type": "fixed_amount",
"reusable": true,
"limited_plans": true,
"limited_billable_metrics": false,
"frequency": "recurring",
"expiration": "time_limit",
"created_at": "2022-04-29T08:59:51Z",
"description": "I am a coupon description",
"amount_cents": 5000,
"amount_currency": "USD",
"plan_codes": [
"startup_plan"
],
"billable_metric_codes": [],
"percentage_rate": null,
"frequency_duration": 6,
"expiration_at": "2022-08-08T23:59:59Z",
"terminated_at": "2022-08-08T23:59:59Z"
}
}{
"status": 401,
"error": "Unauthorized"
}{
"status": 404,
"error": "Not Found",
"code": "object_not_found"
}LAGO_URL="https://api.getlago.com"
API_KEY="__YOUR_API_KEY__"
curl --location --request DELETE "$LAGO_URL/api/v1/coupons/:code" \
--header "Authorization: Bearer $API_KEY"
from lago_python_client.client import Client
from lago_python_client.exceptions import LagoApiError
client = Client(api_key='__YOUR_API_KEY__')
try:
client.coupons.destroy('code')
except LagoApiError as e:
repair_broken_state(e) # do something on error or raise your own exception
require 'lago-ruby-client'
client = Lago::Api::Client.new(api_key: '__YOUR_API_KEY__')
client.coupons.destroy('code')
await client.coupons.destroyCoupon('code');
import "fmt"
import "github.com/getlago/lago-go-client"
func main() {
lagoClient := lago.New().
SetApiKey("__YOUR_API_KEY__")
coupon, err := lagoClient.Coupon().Delete("__YOUR_COUPON_CODE__")
if err != nil {
// Error is *lago.Error
panic(err)
}
// coupon is *lago.Coupon
fmt.Println(coupon)
}
⌘I