Documentation

RedeemCoupon

Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Economy->Catalogs tab in the PlayFab Game Manager.

Request Details

Coupon codes can be created for any item, or set of items, in the catalog for the title. This operation causes the coupon to be consumed, and the specific items to be awarded to the user. Attempting to re-use an already consumed code, or a code which has not yet been created in the service, will result in an error.

RedeemCouponRequest
Request Properties
CatalogVersion String

Catalog version of the coupon. If null, uses the default catalog

CharacterId String

Optional identifier for the Character that should receive the item. If null, item is added to the player

CouponCode (required) String

Generated coupon code to redeem.

POST https://{{TitleID}}.playfabapi.com/Client/RedeemCoupon
    Content-Type: application/json
    X-Authentication: <user_session_ticket_value>
{
  "CouponCode": "123-1234-123",
  "CatalogVersion": "5"
}
        

Response Details

RedeemCouponResult
Result Properties
GrantedItems List<ItemInstance>

Items granted to the player as a result of redeeming the coupon.

Sample Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
  "code": 200,
  "status": "OK",
  "data": {
    "GrantedItems": [
      {
        "ItemId": "shield_level_5",
        "ItemInstanceId": "Unique Item ID",
        "ItemClass": "shields",
        "PurchaseDate": "2014-03-07T00:00:00Z",
        "Expiration": "2015-10-01T00:00:00Z",
        "RemainingUses": 10,
        "Annotation": "No Annotation",
        "CatalogVersion": "5",
        "BundleParent": "crate block 1",
        "UnitPrice": 0
      }
    ]
  }
}

Authentication

SessionTicket

Possible Error Codes

Name Code
CatalogNotConfigured 1218
CharacterNotFound 1135
CouponAlreadyRedeemed 1226
CouponCodeNotFound 1016