{"id":22440136,"url":"https://github.com/lfaoro/creditcard","last_synced_at":"2025-08-25T05:21:16.817Z","repository":{"id":57521985,"uuid":"137194052","full_name":"lfaoro/creditcard","owner":"lfaoro","description":"Credit Card structure, helpers and validation.","archived":false,"fork":false,"pushed_at":"2018-06-20T11:46:58.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T14:23:58.264Z","etag":null,"topics":["creditcard","go","golang","luhn-algorithm","maxmind","package"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lfaoro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-13T09:32:39.000Z","updated_at":"2018-06-20T11:46:44.000Z","dependencies_parsed_at":"2022-08-26T23:40:47.108Z","dependency_job_id":null,"html_url":"https://github.com/lfaoro/creditcard","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfaoro%2Fcreditcard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfaoro%2Fcreditcard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfaoro%2Fcreditcard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lfaoro%2Fcreditcard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lfaoro","download_url":"https://codeload.github.com/lfaoro/creditcard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245816395,"owners_count":20677099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["creditcard","go","golang","luhn-algorithm","maxmind","package"],"created_at":"2024-12-06T01:17:24.144Z","updated_at":"2025-03-27T09:27:05.745Z","avatar_url":"https://github.com/lfaoro.png","language":"Go","readme":"# Credit Card\n\nIt implements various checks on a credit card details and reduces human\nerror using the Luhn algorithm.\n\nOffers various helpers for data manipulation.\n\nDoes risk evaluation using maxMind's minFraud service.\n\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)\n[![Go Doc](https://img.shields.io/badge/go%20doc-read-blue.svg)](https://godoc.org/github.com/lfaoro/creditcard)\n[![Go Report Card](https://goreportcard.com/badge/github.com/lfaoro/creditcard)](https://goreportcard.com/report/github.com/lfaoro/creditcard)\n\n## Installation\n```bash\ngo get github.com/lfaoro/creditcard\n```\n\n## Quick start\n```go\n// Create a new CreditCard instance.\ncard := creditcard.New(\"Leonardo Faoro\", \"4444333322221111\", \"123\", \"06/2019\")\n\n// Create a new CreditCard instance and validate it\n// using all the checks implemented so far.\ncard, err := creditcard.NewValidate(\"Leonardo Faoro\", \"4444333322221111\", \"123\", \"06/2019\")\nif err != nil {\n    log.Fatal(err)\n}\n\n// Validate a CreditCard using all the checks implemented so far.\nif err := card.Validate(); err != nil {\n    log.Fatal(err)\n}\n\n// Luhn checksum a number. https://en.wikipedia.org/wiki/Luhn_algorithm\nif yes := creditcard.Luhn(\"4444333322221111\"); !yes {\n    log.Println(\"Luhn validation failed.\")\n}\n\n// Encrypt the CreditCard.Number and get the bytes blob.\nb := card.Encrypt(\"mySuperSecureSalt\")\n\n// Common helpers.\nfmt.Println(card.First6()) // 123456\nfmt.Println(card.Last4()) // 4567\nfmt.Println(card.Issuer()) // other, visa, amex, ...\nfmt.Println(card.ToJSON()) // {\"name\":\"Leonardo Faoro\",\"number\":\"4444333322221111\",\"cvv_2\":\"123\",\"expiry\":\"06/2019\"}\n```\n\n## Maxmind's minFraud (https://www.maxmind.com/en/minfraud-services)\nminFraud uses a combination of data points across over a billion transactions to provide an accurate risk score for every credit or debit card payment you process. Several variables go into the assessment and scoring, including geolocation, IIN information, reputation checks, IP checks, and device tracking.\n### Benefits\n- Significantly reduce or eliminate the number of fraudulent transactions your business processes.\n- Significantly reduce or eliminate chargebacks from customers (e.g. if they have been the victim of identity theft and their card has been used in a criminal way).\n### Quick start\n```bash\nexport MAXMIND_USER=\"123456\"\nexport MAXMIND_PASSWORD=\"maxMindServicePassword\"\nexport MAXMIND_ENDPOINT=\"https://minfraud.maxmind.com/minfraud/v2.0/insights\"\n# NB: alternatively provide a .env file in your app with the above variables.\n```\n```go\nriskScore, err := maxmind.RiskCheck(card.First6(), card.Last4(), \"8.8.8.8\", \"test@test.com\")\nif err != nil {\n    log.Println(\"riskCheck error: \", err)\n}\nfmt.Println(riskScore)\n```\n\n# Contibuting\n\u003e Any help and suggestions are very welcome and appreciated.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfaoro%2Fcreditcard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flfaoro%2Fcreditcard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flfaoro%2Fcreditcard/lists"}