Quick Start¶
Create and verify a mock payment in an ASP.NET Core app using the PayBridge NuGet package. The example uses an in-memory database and needs no provider credentials.
Choose a version¶
| Package line | Minimum framework | Where to start |
|---|---|---|
| v2.0.0 | .NET 10 | This guide and the package-only sample below |
| v1.2.0 | .NET 8 | NuGet v1.2.0 and the v1.2.0 source and README |
If you already use PayBridge, see Upgrade to v2.
1. Run the package-only example¶
Install the .NET 10 SDK. Download NuGetQuickstart.csproj and Program.cs from the v2.0.0 release. Save both files in the same folder, then run the following command there. The project restores PayBridge.SDK 2.0.0 from NuGet.
dotnet run --project NuGetQuickstart.csproj
2. Create and verify a mock payment¶
From a second terminal:
curl -X POST http://127.0.0.1:5080/payments
Copy the transactionReference from the response:
curl http://127.0.0.1:5080/payments/YOUR_TRANSACTION_REFERENCE
The first call creates a pending payment of NGN 2,500.50. The second call returns a successful verification and saves the updated status in the local database. Both calls use a mock provider. No checkout link, card data, provider account or real charge is involved. The app listens on localhost, and the data is cleared when the process stops.
3. Take the next step¶
- Follow the Paystack sandbox walkthrough for hosted checkout and server-side verification with a Paystack test account.
- Use the example API for real sandbox gateway configuration and database setup. Keep provider credentials in local user secrets or a server-side secret store.
- Check the gateway capability matrix for available operations and sandbox evidence.
- Read Webhook security and Payment creation idempotency before handling real payments.
Build and verify a local package¶
From a clone of the PayBridge repository on master:
dotnet pack PayBridge.SDK/PayBridge.SDK.csproj -c Release -o ./nupkg
./scripts/smoke-test-package.sh ./nupkg
The script installs that exact package into an isolated copy of the example and verifies the mock payment lifecycle. To run the example server against the local package:
dotnet restore examples/NuGetQuickstart/NuGetQuickstart.csproj \
--source ./nupkg --source https://api.nuget.org/v3/index.json
dotnet run --project examples/NuGetQuickstart/NuGetQuickstart.csproj --no-restore