Skip to content

BitColibri/mccCodes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCC Codes

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

Installation

go get github.com/bitcolibri/mccCodes

Usage

package 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)
}

API Overview

  • 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.

Disclaimer

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages