InnovateSoftware.Promotions.Client
1.0.0
See the version list below for details.
dotnet add package InnovateSoftware.Promotions.Client --version 1.0.0
NuGet\Install-Package InnovateSoftware.Promotions.Client -Version 1.0.0
<PackageReference Include="InnovateSoftware.Promotions.Client" Version="1.0.0" />
<PackageVersion Include="InnovateSoftware.Promotions.Client" Version="1.0.0" />
<PackageReference Include="InnovateSoftware.Promotions.Client" />
paket add InnovateSoftware.Promotions.Client --version 1.0.0
#r "nuget: InnovateSoftware.Promotions.Client, 1.0.0"
#:package InnovateSoftware.Promotions.Client@1.0.0
#addin nuget:?package=InnovateSoftware.Promotions.Client&version=1.0.0
#tool nuget:?package=InnovateSoftware.Promotions.Client&version=1.0.0
InnovateSoftware.Promotions.Client
.NET client for the Integration API of Aliya Promotions & Loyalty (.NET 8 and later, no dependencies beyond the framework). Guides and the API reference: https://api.aliyapromotions.com/docs/
dotnet add package InnovateSoftware.Promotions.Client
var promotions = new PromotionsClient(httpClient, new PromotionsClientOptions
{
BaseAddress = new Uri("https://api.example.com"),
ApiKey = configuration["Promotions:ApiKey"]!,
});
var session = await promotions.PutSessionAsync("order-1001", new SessionRequest
{
Currency = "EUR",
Items = [new SessionItem { Ref = "line-1", UnitPrice = 1500 }],
});
Reserve before payment (ReserveAsync, which throws EffectsChangedException with the new price if the discounts changed), confirm after (ConfirmAsync), cancel on failure (CancelAsync). Lifecycle calls send an idempotency key and retry with it on network errors, timeouts and 502/503/504.
Catalogue: keep the application's products up to date with SyncCatalogueAsync (up to 1,000 changes, all or nothing) or PutProductAsync / DeleteProductAsync, and show product-page prices with GetPricesAsync (up to 100 SKUs, the rules marked "Show on product pages").
Offers: GetOffersAsync lists what applies to a cart, the customer's own codes and what is one step away (Offer.Missing, with the campaign's near-miss text), for "Spend 12.50 more" hints and an account page.
Segments: keep a list segment's members with UpdateSegmentMembersAsync(key, new SegmentMembersChange { Add = …, Remove = … }) (up to 1,000 profile ids, all or nothing) and check one with IsSegmentMemberAsync; Profile.Segments from GetProfileAsync lists every segment a profile is in, filters included.
Events: SendEventAsync(new EventRequest { Type = "reviewSubmitted", EventId = "rev-881", ProfileId = "C1", Attributes = new Dictionary<string, object?> { ["rating"] = 5 } }) sends something a customer did (the type must be one of the application's event types); sending the same EventId again is safe and answers Duplicate = true. GetProfileEventsAsync(profileId, type, after) pages through a profile's events, newest first, with the built-in session.confirmed, session.returned and referral.rewarded.
Gift cards: IssueGiftCardAsync(new IssueGiftCardRequest { Program = "gift", Amount = 5000 }, idempotencyKey) sells a card and is the only answer with its Code (and a Pin made for it); CheckGiftCardAsync(code, pin) answers its balance (null for an unknown code); ActivateGiftCardAsync, GetGiftCardAsync, GetGiftCardEntriesAsync, TopUpGiftCardAsync, VoidGiftCardAsync and GetProfileGiftCardsAsync do the rest. In a session set GiftCards = [new SessionGiftCard { Code = code, Pin = pin }] and charge Totals.ToPay; reserve, confirm, cancel and returns hold, spend and give back the cards' money. Changes are retried with the same idempotency key like the lifecycle calls.
Paying with points: set Loyalty = new SessionLoyalty { Program = "rewards", SpendPoints = 500 } (or SpendPoints.Max) with a ProfileId; Session.Loyalty says how many points pay how much and, when fewer than asked, the Reason. Charge Totals.ToPay; reserve, confirm, cancel and returns hold, spend and give back the points.
Rewards: GetRewardsAsync("rewards", memberId) lists what your application offers, with CanRedeem and the Reason when not; RedeemRewardAsync("rewards", memberId, "five-off") buys one and answers the code (Redemption.Coupon.Code) or the custom reward, and the member's points. Pass the same idempotency key when retrying. GetRedemptionsAsync lists a member's rewards; CancelRedemptionAsync undoes one.
Tiers: when the programme has tiers, GetLoyaltyMemberAsync answers the member's Tier, QualifyingPoints and NextTier (with the points still needed in Remaining). A reward with TierRequired can be redeemed from that tier up; below it the Reason is RewardRefusal.TierRequired.
Referrals: GetReferralCodeAsync("friends", profileId) gives the advocate their code; GetReferralAdvocateAsync("friends", profileId) answers their friends, rewards, NextMilestone and Cap for the customer's account; GetReferralRewardsAsync("friends", after) pages through every advocate's rewards, oldest first (pass the last page's Next as after).
Free items: an effect with IsFreeItemToAdd asks the shop to add Quantity units of Sku to the cart at their normal price; the next update makes them free. Remove lines you added once no such effect is offered for their SKU.
Webhooks: check a delivery's signature and read the event with Webhooks.ReadEvent(body, request.Headers["Promotions-Signature"], secret), which throws WebhookSignatureException when it doesn't match.
The flow, error handling and fallback policy are in the integration guide that comes with your API access.
Licence
MIT; see LICENSE in the package. Using the API itself needs an agreement with Innovate Software.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.