The official Globally Paid .NET library
Supporting .NET Standard 2.0
Using the .NET Core CLI tools:
dotnet add package GloballyPaid.net
Using the NuGet CLI:
nuget install GloballyPaid.net
Using the Package Manager Console:
Install-Package GloballyPaid.net
From within Visual Studio:
- Open Solution Explorer
- Right-click on a project within your solution
- Click on Manage NuGet Packages
- Click on the Browse tab and search for GloballyPaid.net
- Click on the GloballyPaid.net package, select version in the right-tab
- Click Install
For the Globally Paid API documentation, please visit Globally Paid API documentation
For a comprehensive list of examples, please visit Globally Paid .NET SDK samples.
There are three ways to configure the Globally Paid SDK:
All SDK calls can be configured within ConfigureServices
method in Startup
class using the AddGloballyPaid
extension.
Additionally, this extension call will register all Globally Paid services:
services.AddGloballyPaid("Your Publishable API Key", "Your Shared Secret", "Your APP ID", useSandbox: false, requestTimeoutSeconds: 90);
To register the Globally Paid services only, AddGloballyPaidServices
extension can be used:
services.AddGloballyPaidServices();
All SDK calls can be configured using the static GloballyPaidConfiguration
object:
GloballyPaidConfiguration.PublishableApiKey = "Your Publishable API Key";
GloballyPaidConfiguration.SharedSecret = "Your Shared Secret";
GloballyPaidConfiguration.AppId = "Your APP ID";
GloballyPaidConfiguration.UseSandbox = false; //true if you need to test through Globally Paid sandbox
GloballyPaidConfiguration.RequestTimeoutSeconds = 90;
Or using the GloballyPaidConfiguration
Setup method:
GloballyPaidConfiguration.Setup("Your Publishable API Key", "Your Shared Secret", "Your APP ID", useSandbox: false, requestTimeoutSeconds: 90);
All SDK calls can be configured using the <appSettings>
section in configuration files (App.config or web.config):
<appSettings>
<add key="GloballyPaidPublishableApiKey" value="Your Publishable API Key"></add>
<add key="GloballyPaidSharedSecret" value="Your Shared Secret"></add>
<add key="GloballyPaidAppId" value="Your APP ID"></add>
<add key="GloballyPaidUseSandbox" value="false"></add> <!--true if you need to test through Globally Paid sandbox-->
<add key="GloballyPaidRequestTimeoutSeconds" value="90"></add>
</appSettings>
All SDK service methods accept an optional RequestOptions
object, additionally allowing per-request configuration:
var requestOptions = new RequestOptions("Your Publishable API Key", "Your Shared Secret", "Your APP ID", useSandbox: false, requestTimeoutSeconds: 90);
var request = new ChargeRequest
{
Source = "source", //this can be the token or payment instrument identifier
Amount = 1299,
Capture = true, //sale charge
ClientCustomerId = "12345", //set your customer id
ClientInvoiceId = "IX213", //set your invoice id
ClientTransactionDescription = "Tuition for CS" //set your transaction description
};
//if Globally Paid services are registered, you can inject this as IChargeService in the constructor
var chargeService = new ChargeService();
var charge = chargeService.Charge(request);
For any feedback or bug/enhancement report, please open an issue or submit a pull request.