https://github.com/azshurith/sharpgateway
SharpGateway is a secure and extensible C# ASP.NET Core REST API wrapper for Authorize.Net designed to handle end-to-end payment processing. It supports authorization, capture, refunds, voids, and full transaction logging with sensitive data masking.
https://github.com/azshurith/sharpgateway
asp-net authorize-net csharp payment-gateway
Last synced: 11 months ago
JSON representation
SharpGateway is a secure and extensible C# ASP.NET Core REST API wrapper for Authorize.Net designed to handle end-to-end payment processing. It supports authorization, capture, refunds, voids, and full transaction logging with sensitive data masking.
- Host: GitHub
- URL: https://github.com/azshurith/sharpgateway
- Owner: Azshurith
- License: agpl-3.0
- Created: 2025-07-15T09:25:01.000Z (12 months ago)
- Default Branch: master
- Last Pushed: 2025-07-15T09:40:41.000Z (12 months ago)
- Last Synced: 2025-07-15T20:53:59.243Z (12 months ago)
- Topics: asp-net, authorize-net, csharp, payment-gateway
- Language: C#
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ๐ณ SharpGateway โ Authorize.Net Payment Gateway API (ASP.NET Core)
**SharpGateway** is a secure, modular, and production-ready REST API built with ASP.NET Core for integrating [Authorize.Net](https://developer.authorize.net/) payments. It supports full transaction workflows โ including authorization, capture, refund, void, and safe structured logging.
---
## โ๏ธ Features
- ๐ Credit card **Authorization Only** & **Auth + Capture**
- ๐ **Capture** of previously authorized transactions
- ๐ธ **Refunds** & **Voids**
- ๐ Swagger (OpenAPI) support for easy testing
- ๐ก๏ธ Secure request logging (card number, CVV, expiration masked)
- ๐ Environment-based config using `.env`
- ๐ฆ Clean separation of services, models, and controllers
---
## ๐ API Endpoints
| Method | Endpoint | Description |
|--------|-------------------|-----------------------------------------|
| POST | `/api/Authorize` | Authorize card without capturing funds |
| POST | `/api/Charge` | Authorize + Capture in one step |
| POST | `/api/Capture` | Capture a previously authorized trans. |
| POST | `/api/Refund` | Refund a previously settled transaction |
| POST | `/api/Void` | Void an unsettled (auth-only) transaction |
---
## ๐ฆ Tech Stack
- **ASP.NET Core 8.0**
- **Authorize.Net SDK v2.0**
- **Swashbuckle (Swagger UI)**
- **DotNetEnv** for `.env` config loading
- **Microsoft.Extensions.Logging** with safe masking
---
## ๐ Environment Configuration
Your API credentials should be placed in a `.env` file (never commit this!):
```
AUTHORIZENET__APILOGINID=your_login_id
AUTHORIZENET__TRANSACTIONKEY=your_transaction_key
```
> โ
Automatically mapped to the `AuthorizeNet` section in your config.
---
## ๐ appsettings.json (safe sample)
```json
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AuthorizeNet": {
"ApiLoginId": "",
"TransactionKey": ""
},
"AllowedHosts": "*"
}
```
---
## ๐งช Run the Project
```bash
dotnet restore
dotnet build
dotnet run
```
Navigate to: [https://localhost:5001/swagger](https://localhost:5001/swagger)
---
## ๐ Request Logging Safety
Sensitive fields like:
- `CardNumber`
- `CVV`
- `Expiration`
...are **never logged in plaintext**. They are masked using secure utilities and safe anonymous logging objects.
---
## ๐ Future Enhancements
- [ ] Support for recurring billing / customer profiles
- [ ] Webhook listener for Authorize.Net transaction updates
- [ ] Docker containerization
- [ ] Multi-environment deployment setup (dev/staging/prod)
---
## ๐ License
MIT ยฉ 2025 โ Devitrax
---
## ๐ค Contributions
PRs are welcome! Open an issue or fork this repo to contribute improvements.