.NET SDK for Protect Group Pulse API
$ dotnet add package Pg.PulseThe official .NET SDK for Protect Group's Pulse API - a comprehensive solution for managing refundable bookings, quotes, sales, and transactions in the hospitality and travel industries.
Pulse API enables travel and hospitality businesses to offer flexible refund protection to their customers. With this SDK, you can:
Install via NuGet Package Manager:
Install-Package Pg.Pulse
Or using .NET CLI:
dotnet add package Pg.Pulse
Add your Pulse API credentials to appsettings.json:
{
"Pulse": {
"Environment": "Test",
"Region": "Global",
"MemberVendorCode": "<<YourVendorCode>>",
"ClientId": "<<YourClientId>>",
"ClientSecret": "<<YourClientSecret>>"
}
}
In your Program.cs or Startup.cs:
using Pg.Pulse.Extensions;
builder.Services.AddPulseApiClient();
using Pg.Pulse;
using Pg.Pulse.Models.Quote.Request;
using Pg.Pulse.Models.Sale.Request;
public class BookingService
{
private readonly IPulseApiClient _pulseClient;
public BookingService(IPulseApiClient pulseClient)
{
_pulseClient = pulseClient;
}
public async Task<string> CreateProtectedBookingAsync(decimal amount, int guests)
{
// Create a quote
var quoteRequest = new QuoteRequest
{
CurrencyCode = "USD",
LanguageCode = "en",
TotalValue = amount,
EventTravelDateTime = DateTime.Now.AddMonths(3).ToString("yyyy-MM-ddTHH:mm:ss.ffffffzzz"),
NumberOfTickets = guests,
ReturnHtml = true
};
var quoteResponse = await _pulseClient.CreateQuoteAsync(quoteRequest);
// Create a sale
var saleRequest = new SaleRequest
{
QuoteId = quoteResponse.Data.QuoteId,
BookingReference = "ABC4567",
IsPaidInFull = true,
TransactionDate = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.ffffffzzz"),
Customers = new[]
{
new CustomerModel
{
FirstName = "John",
LastName = "Doe",
Email = "john.doe@example.com",
Telephone = "+11234567890"
}
},
Products = new[]
{
new SaleProduct
{
ProductId = 16,
Sold = true
}
}
};
var saleResponse = await _pulseClient.CreateSaleAsync(saleRequest);
return saleResponse.Data.SaleId;
}
}
All methods return response objects with Success property and detailed error information:
var response = await _pulseClient.CreateQuoteAsync(request);
if (!response.Success)
{
_logger.LogError("Quote creation failed: {Error}", response.Error?.Message);
// Handle error
return;
}
// Process successful response
var quoteId = response.Data.QuoteId;
| Method | Description |
|---|---|
CreateQuoteAsync | Create a new refundable booking quote |
GetQuoteAsync | Retrieve an existing quote |
UpdateQuoteAsync | Update quote details |
CreateSaleAsync | Create a sale from a quote |
GetSaleAsync | Retrieve sale information |
UpdateSaleAsync | Update an existing sale |
HoldSaleAsync | Put a sale on hold |
CancelSaleAsync | Cancel an entire sale |
CancelSaleItemAsync | Cancel a specific item |
UpdateTransactionStatusAsync | Update transaction status |
UpdateTransactionItemStatusAsync | Update item status |
AcceptPaymentAsync | Record a payment |
UpdateCustomersAsync | Update customer information |
UpdateEventDateAsync | Change event/travel date |
This project is licensed under a Proprietary License. Use of this package is permitted only for authorized partners who have received valid credentials from us.