https://github.com/restoremonarchy/paymentgateway
Another custom payment gateway provider for Mock, PayPal & more
https://github.com/restoremonarchy/paymentgateway
Last synced: about 1 year ago
JSON representation
Another custom payment gateway provider for Mock, PayPal & more
- Host: GitHub
- URL: https://github.com/restoremonarchy/paymentgateway
- Owner: RestoreMonarchy
- Created: 2021-11-13T11:02:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-15T22:28:03.000Z (over 2 years ago)
- Last Synced: 2025-04-21T23:36:04.197Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 1.91 MB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## PaymentGateway
This is a custom payment gateway for my projects.
It's still under development and I will first implement it for my [UnturnedStore](https://github.com/RestoreMonarchy/UnturnedStore) project.
> *This is my payment gateway. There are many like it, but this one is mine.*
> *My payment gateway is my best friend. It is my life. I must master it as I must master my life.*
> *My payment gateway, without me, is useless. Without my payment gateway, I am useless...*
### Payment Gateway Client
```cs
PaymentGatewayClient client = new(new PaymentGatewayClientOptions()
{
BaseAddress = "https://localhost:7255",
APIKey = "be1ade6b-53ca-4d2c-8815-3127efbc4a8e"
});
Payment payment = Payment.Create(PaymentProviders.Mock, "YOUR_CUSTOM", "YOUR_RECEIVER", "USD", 49);
// In case of mock, receiver can be null
payment.AddItem("Large Fries", 5, 2);
payment.AddItem("Cheeseburger", 2, 2);
payment.AddItem("Big Mac", 10, 3.5m);
Guid publicId = await client.CreatePaymentAsync(payment); // It sends a request to payment gateway web API
string payUrl = client.BuildPayUrl(publicId); // Simply formats url: {PaymentGateway_URL}/pay/{publicId}
```
Now you can redirect user to `payUrl`. If he completes the payment notifications are going to be sent, to notify URL of the store, until your web API returns status code 200 (OK).
### Screenshots