Delete a payment rule
client.Monetization.Rules.DeleteRule(ctx, ruleID, body) (*MonetizationRuleCollection, error)
DELETE/zones/{zone_id}/monetization/rules/{rule_id}
Removes a single Payment Required rule identified by its ID. Every other rule is preserved. Returns the resulting rule collection.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Delete a payment rule
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"github.com/cloudflare/cloudflare-go/monetization"
"github.com/cloudflare/cloudflare-go/option"
)
func main() {
client := cloudflare.NewClient(
option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
)
monetizationRuleCollection, err := client.Monetization.Rules.DeleteRule(
context.TODO(),
"023e105f4ecef8ad9ca31a8372d0c353",
monetization.RuleDeleteRuleParams{
ZoneID: cloudflare.F("9f1839b6152d298aca64c4e906b6d074"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", monetizationRuleCollection.Rules)
}
{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"result": {
"rules": [
{
"address": "0x1234567890abcdef1234567890abcdef12345678===",
"expression": "(http.request.uri.path eq \"/premium\" and http.request.method in {\"GET\" \"POST\"})",
"price": "250000",
"scheme": "exact",
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"description": "Premium API endpoint",
"enabled": true
}
]
},
"success": true
}Returns Examples
{
"errors": [
{
"code": 0,
"message": "message"
}
],
"messages": [
{
"code": 0,
"message": "message"
}
],
"result": {
"rules": [
{
"address": "0x1234567890abcdef1234567890abcdef12345678===",
"expression": "(http.request.uri.path eq \"/premium\" and http.request.method in {\"GET\" \"POST\"})",
"price": "250000",
"scheme": "exact",
"id": "023e105f4ecef8ad9ca31a8372d0c353",
"description": "Premium API endpoint",
"enabled": true
}
]
},
"success": true
}