An open API service indexing awesome lists of open source software.

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.

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.