Skip to content

Add refund support via entitlement IDs#433

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/add-support-for-refunds
Closed

Add refund support via entitlement IDs#433
Copilot wants to merge 2 commits intomainfrom
copilot/add-support-for-refunds

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

Implements the /game/refund/v1 refund endpoint, allowing players to refund previously purchased items by their entitlement IDs.

New types (PurchaseRequest.cs)

  • LootLockerRefundByEntitlementIdsRequest – request payload
  • LootLockerRefundByEntitlementIdsResponse – full response with inventory events, currency credited/clawed back, and per-entitlement warnings
  • Supporting models: LootLockerRefundInventoryEvent, LootLockerRefundCurrencyEntry, LootLockerRefundWarning, LootLockerRefundWarningDetail, LootLockerRefundNonReversibleReward

New endpoint (LootLockerEndPoints.cs)

public static EndPointClass refundByEntitlementIds = new EndPointClass("game/refund/v1", LootLockerHTTPMethod.POST);

New SDK method (LootLockerSDKManager.cs)

LootLockerSDKManager.RefundByEntitlementIds(
    new[] { "entitlementUlid1", "entitlementUlid2" },
    response => {
        // response.player_inventory_events – assets removed or skipped
        // response.currency_refunded      – purchase price returned
        // response.currency_clawback      – currency rewards reclaimed
        // response.warnings               – non-fatal issues per entitlement
    }
);

A non-empty warnings array does not indicate failure — it signals partial reversal (e.g. non-reversible progression rewards, insufficient funds for clawback). The method validates that entitlementIds is non-null and non-empty before making the API call.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for refunds</issue_title>
<issue_description>### Purpose

Reflect the backend implementation of the refunds feature
Acceptance Criteria

  • All refund endpoints have implementations in the relevant SDKs
  • Public SDK api surface is well documented in code documentation
  • Functionality is tested and working end to end

APIDog collaboration link

https://app.apidog.com/link/project/446496/apis/api-28123628

Public API docs link

https://ref.lootlocker.com/game/refund-items-by-entitlement-ids-api-28123628

An in issue OpenAPI spec of the relevant API surface

{   "openapi": "3.1.0",   "info": {     "title": "Default module",     "description": "Async virtual-currency purchasing endpoints for game clients. Purchases are initiated with a 202 response and polled for completion via the status endpoint. Failed purchases can be retried.\n",     "version": "1.0.0"   },   "tags": [],   "paths": {     "/game/refund/v1": {       "post": {         "summary": "Refund items by Entitlement IDs",         "deprecated": false,         "description": "",         "tags": [],         "parameters": [           {             "name": "Content-Type",             "in": "header",             "description": "",             "required": true,             "example": "application/json",             "schema": {               "type": "string"             }           }         ],         "requestBody": {           "content": {             "application/json": {               "schema": {                 "type": "object",                 "properties": {                   "entitlement_ids": {                     "type": "array",                     "items": {                       "$ref": "#/components/schemas/ULID"                     }                   }                 },                 "required": [                   "entitlement_ids"                 ]               },               "examples": {}             }           },           "required": true         },         "responses": {           "200": {             "description": "",             "content": {               "application/json": {                 "schema": {                   "type": "object",                   "properties": {                     "player_inventory_events": {                       "type": "array",                       "description": "Assets that were added or removed from the player's inventory as part of the refund",                       "items": {                         "type": "object",                         "properties": {                           "asset_id": {                             "type": "integer",                             "description": "The legacy numeric ID of the asset",                             "format": "uint64"                           },                           "name": {                             "type": "string",                             "description": "Display name of the asset"                           },                           "action": {                             "type": "string",                             "enum": [                               "removed",                               "skipped"                             ],                             "description": "`removed` if the asset was successfully taken back from the player's inventory. `skipped` if it could not be removed (e.g. already consumed or transferred)."                           }                         },                         "required": [                           "asset_id",                           "name",                           "action"                         ]                       }                     },                     "currency_refunded": {                       "type": "array",                       "description": "Currency amounts credited back to the player's wallet (i.e. the purchase price being returned)",                       "items": {                         "$ref": "#/components/schemas/Currency%20Entry"                       }                     },                     "currency_clawback": {                       "type": "array",                       "description": "Currency amounts debited from the player's wallet (i.e. currency rewards from the entitlement being reclaimed)",                       "items": {                         "$ref": "#/components/schemas/Currency%20Entry"                       }                     },                     "warnings": {                       "type": "array",                       "description": "Warnings encountered during refund processing, grouped by entitlement. A non-empty warnings array does not mean the refund failed — it means some aspects could not be fully reversed.",                       "items": {                         "type": "object",                         "properties": {                           "entitlement_id": {      ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes lootlocker/index#1395

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Co-authored-by: kirre-bylund <4068377+kirre-bylund@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for refunds implementation in SDKs Add refund support via entitlement IDs Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants