mcccodes is a Go package that provides a static Merchant Category Code (MCC)
database.
The MCC reference used for this package is the Citibank Merchant Category Codes PDF:
https://www.citibank.com/tts/solutions/commercial-cards/assets/docs/govt/Merchant-Category-Codes.pdf
go get github.com/bitcolibri/mccCodespackage main
import (
"fmt"
"log"
mcccodes "github.com/bitcolibri/mccCodes"
)
func main() {
all := mcccodes.All()
fmt.Println("total MCCs:", len(all))
description, err := mcccodes.FindDescription("0742")
if err != nil {
log.Fatal(err)
}
fmt.Println(description)
relaxed, err := mcccodes.FindRelaxed("9999")
if err != nil {
log.Fatal(err)
}
fmt.Println(relaxed)
utilities, err := mcccodes.ByCategory("Utility Services")
if err != nil {
log.Fatal(err)
}
fmt.Println("utility MCCs:", len(utilities))
visaCodes, err := mcccodes.ByPaymentBrand("visa")
if err != nil {
log.Fatal(err)
}
fmt.Println("Visa MCCs:", len(visaCodes))
mastercardDescription, err := mcccodes.FindDescriptionByPaymentBrand("4813", "mastercard")
if err != nil {
log.Fatal(err)
}
fmt.Println(mastercardDescription)
}All()returns the full list of MCC codes.Categories()returns the known MCC category ranges.ByCategory(category)returns MCC codes for a category.ByPaymentBrand(brand)returns MCC codes valid for a payment brand.Find(code)returns the full MCC entry for a code.FindDescription(code)returns the MCC description for a code.FindRelaxed(code)returns the MCC description when the code exists, or the category name when only the code range is known.FindByPaymentBrand(code, brand)returns the MCC entry when the code is valid for the payment brand.FindDescriptionByPaymentBrand(code, brand)returns the MCC description when the code is valid for the payment brand.
Payment brands can be passed as V, Visa, M, Mastercard, or TSYS.
This library, including its code and generated MCC dataset, was fully written by AI. Review and validate the data and behavior before using it in production, compliance, reporting, or financial workflows.