openapi: 3.0.0
info:
  title: Pricing API
  description: >-
    wappier Pricing API allows customers to integrate with wappier Pricing
    products.


    API users should have access to [wappier Applications
    portal](https://apps.wappier.com/)  to register their application and get
    their APIKey and SecurityToken.


    Once register their applications, users can utilize the provided `APIKey`
    and `token` to  authenticate their API requests. Using the headers:


    `X-Wappier-Api-key: <APIKey>`


    `X-Wappier-token: <token>` 
servers:
  - url: https://apps.wappier.com/pricing/public
    description: Production Server
paths:
  /purchase/reportsByDate:
    post:
      tags:
        - purchaseReports
      summary: Purchase Reports by date range
      description: >-
        This endpoint queries the available Purchase Reports by the specified
        date range and returns the matched documents using pagination.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                start:
                  type: number
                  description: >-
                    pagination parameter, the first document to fetch in the
                    response. In the first page request, the value is by default
                    0.
                end:
                  type: number
                  description: >-
                    pagination parameter, the last document to fetch in the
                    response. If end - start exceeds the page limit then an
                    error is returned.
                dates:
                  type: object
                  properties:
                    from:
                      type: string
                      description: >-
                        date range start timestamp, in ISO format
                        ("YYYY-MM-DDTHH:MM:SS.sssZ").
                    to:
                      type: string
                      description: >-
                        date range end timestamp, in ISO format
                        ("YYYY-MM-DDTHH:MM:SS.sssZ").
                    onlyValid:
                      type: boolean
                      description: >-
                        flag to return only tracked purchases that have been
                        validated using Purchase validation functionality
                        default value is true.
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    type: number
                    description: >-
                      the total number of documents matching - this might be
                      more than the total page limit.
                  next_start:
                    type: number
                    description: >-
                      this field indicates that the response is spawned into
                      multiple pages the user should do a new request with start
                      next_start to get the next page. This field is missing
                      from the response of the last page.
                  purchaseReports:
                    description: >-
                      an array of purchaseReport objects, each one having the
                      form of  Purchase Reports Response.
                    $ref: '#/components/schemas/purchase_reports'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /purchase/reportsByReceipts:
    post:
      tags:
        - purchaseReports
      summary: Purchase Reports by multiple receiptIds
      description: >-
        This endpoint queries the available Purchase Reports by multiple
        receiptIds and returns the matched documents.
      requestBody:
        content:
          application/json:
            schema:
              example:
                receipts:
                  - receiptId1
                  - receiptId2
                onlyValid: bool
              type: object
              properties:
                receipts:
                  type: array
                  items:
                    type: string
                onlyValid:
                  type: boolean
                  description: >-
                    flag to return only tracked purchases that have been
                    validated using Purchase validation functionality default
                    value is true.
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    type: number
                    description: >-
                      the total number of documents matching - this might be
                      more than the total page limit.
                  purchaseReports:
                    description: >-
                      an array of purchaseReport objects, each one having the
                      form of  Purchase Reports Response.
                    $ref: '#/components/schemas/purchase_reports'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /purchase/reports/{receiptId}:
    post:
      tags:
        - purchaseReports
      summary: Purchase Report for specific receiptId
      description: >-
        This endpoint queries the available Purchase Reports for this specific
        receiptId and returns the matched documents.
      parameters:
        - in: path
          name: receiptId
          schema:
            type: string
          required: true
          description: The receipt id
        - in: query
          name: onlyValid
          schema:
            type: boolean
          required: false
          description: >-
            flag to return only tracked purchases that have been validated using
            Purchase validation functionality default value is true.
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  purchaseReports:
                    description: >-
                      an array of purchaseReport objects, each one having the
                      form of  Purchase Reports Response.
                    $ref: '#/components/schemas/purchase_reports'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /stateful/status/{userId}:
    get:
      tags:
        - stateful
      summary: User status
      description: >-
        This endpoint returns pricing status for the specific userId for this
        application.
      parameters:
        - in: path
          name: userId
          schema:
            type: string
          required: true
          description: The user's id
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  isTarget: true
                  isInScope: true
                type: object
                properties:
                  isTarget:
                    type: boolean
                    description: flag indicates if installation pricing is enabled
                  isInScope:
                    type: boolean
                    description: flag indicates if user is in scope
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /stateful/SKUmap/{userId}:
    get:
      tags:
        - stateful
      summary: Global Pricing for specific user
      description: >-
        This endpoint queries the available Global Pricing configuration for the
        specific userId and returns an SKUMap with the data found.
      parameters:
        - in: path
          name: userId
          schema:
            type: string
          required: true
          description: The user's id
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  isTarget: true
                  isInScope: true
                  uuid: f2db8bfb-bc89-5a3d-92d6-52d3c4032f64
                  country: GR
                  data:
                    - key: sku_1
                      value:
                        - id: 612650626b91b67fdc6fdc66
                          proxySku: sku_1.wap_4a67
                          start: 1587714323
                          end: 4102444800
                type: object
                properties:
                  isTarget:
                    type: boolean
                    description: flag indicates if installation pricing is enabled
                  isInScope:
                    type: boolean
                    description: flag indicates if installation is inScope
                  uuid:
                    type: string
                    description: unique uuid generated with data as input
                  country:
                    type: string
                    description: billing country of user
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          description: original sku
                        value:
                          type: array
                          description: >-
                            array with only one object. 1 - 1 relationship of
                            key with value
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                description: pricing offer id
                              proxySku:
                                type: string
                                description: proxy sku
                              start:
                                type: number
                                description: pricingOffer.valid.from with unix format
                              end:
                                type: number
                                description: pricingOffer.valid.to with unix format
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /stateful/offer/{userId}:
    post:
      tags:
        - stateful
      summary: Promotional Pricing offers for specific user
      description: >-
        This endpoint queries the available Promotional Pricing configuration
        for the specific userId and returns a map with data found that matches
        the given tags.
      parameters:
        - in: path
          name: userId
          schema:
            type: string
          required: true
          description: The user's id
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                tags:
                  type: array
                  description: >-
                    personalized pricing offers that contain request body tags
                    will be found
                  items:
                    type: string
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  isTarget: true
                  isInScope: true
                  uuid: f2db8bfb-bc89-5a3d-92d6-52d3c4032f64
                  country: GR
                  data:
                    - key: tag1
                      value:
                        - id: 612650626b91b67fdc6fdc66
                          data:
                            - SKU1
                            - SKU2
                          start: 1587714323
                          end: 4102444800
                type: object
                properties:
                  isTarget:
                    type: boolean
                    description: flag indicates if installation pricing is enabled
                  isInScope:
                    type: boolean
                    description: flag indicates if installation is in scope
                  uuid:
                    type: string
                    description: unique uuid generated with data as input
                  country:
                    type: string
                    description: billing country of user
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          description: sent tag
                        value:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                description: pricing offer id
                              start:
                                type: number
                                description: pricingOffer.valid.from with unix format
                              end:
                                type: number
                                description: pricingOffer.valid.to with unix format
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /stateless/SKUmap:
    get:
      tags:
        - stateless
      summary: Global Pricing for all countries
      description: >-
        This endpoint returns an SKUMap for all countries configured for this
        application.
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  uuid: f2db8bfb-bc89-5a3d-92d6-52d3c4032f64
                  data:
                    - key: GR
                      value:
                        - key: sku_1
                          value:
                            - id: 615ec62d19fa590e5cf13843
                              start: 1587714323
                              end: 4102444800
                              proxySku: testProxySku
                type: object
                properties:
                  uuid:
                    type: string
                    description: unique uuid generated with data as input
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          description: countryCode of pricingConfig.scopeCountries
                        value:
                          type: array
                          items:
                            type: object
                            properties:
                              key:
                                type: string
                                description: original sku
                              value:
                                description: >-
                                  array with only one object. 1 - 1 relationship
                                  of data.value[].keywith data.value[].value[]
                                type: array
                                items:
                                  type: object
                                  properties:
                                    id:
                                      type: string
                                      description: Pricing offer id
                                    proxySku:
                                      type: string
                                      description: The proxy sku
                                    start:
                                      type: number
                                      description: pricingOffer.valid.from with unix format
                                    end:
                                      type: number
                                      description: pricingOffer.valid.to with unix format
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /stateless/SKUmap/{country}:
    get:
      tags:
        - stateless
      summary: Global Pricing for a country
      description: >-
        This endpoint returns an SKUMap for the specific country for this
        application (given country is enabled).
      parameters:
        - in: path
          name: country
          schema:
            type: string
          required: true
          description: The country's code (ISO 2-letter code)
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  uuid: f2db8bfb-bc89-5a3d-92d6-52d3c4032f64
                  data:
                    - key: GR
                      value:
                        - key: sku_1
                          value:
                            - id: 615ec62d19fa590e5cf13843
                              start: 1587714323
                              end: 4102444800
                              proxySku: sku_1.wap_4a67
                type: object
                properties:
                  uuid:
                    type: string
                    description: unique uuid generated with data as input
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          description: countryCode on request url
                        value:
                          type: array
                          description: >-
                            array with only one object. 1 - 1 relationship of
                            key with value
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                description: pricing offer id
                              proxySku:
                                type: string
                                description: proxy sku
                              start:
                                type: number
                                description: pricingOffer.valid.from with unix format
                              end:
                                type: number
                                description: pricingOffer.valid.to with unix format
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /stateless/SKUmap/{country}/{userId}:
    get:
      tags:
        - stateless
      summary: Global Pricing for a user
      description: >-
        This endpoint returns an SKUMap for the specific country and userId for
        this application.  This call is only available for Global Pricing and
        doesn't depend on any state for the given  user and the caller has to
        specify the country.
      parameters:
        - in: path
          name: country
          schema:
            type: string
          required: true
          description: The country's code (ISO 2-letter code)
        - in: path
          name: userId
          schema:
            type: string
          required: true
          description: User's id
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  isTarget: true
                  isInScope: true
                  uuid: f2db8bfb-bc89-5a3d-92d6-52d3c4032f64
                  country: GR
                  data:
                    - key: sku_1
                      value:
                        - id: 612650626b91b67fdc6fdc66
                          proxySku: sku_1.wap_4a67
                          start: 1587714323
                          end: 4102444800
                type: object
                properties:
                  isTarget:
                    type: boolean
                    description: flag indicates if user is in target group or not
                  isInScope:
                    type: boolean
                    description: >-
                      flag indicates if given countryCode joins
                      pricingConfig.scopeCountries
                  uuid:
                    type: string
                    description: unique uuid generated with data as input
                  country:
                    type: string
                    description: given countryCode
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          description: original sku
                        value:
                          type: array
                          description: >-
                            array with only one object. 1 - 1 relationship of
                            key with value
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                description: pricing offer id
                              proxySku:
                                type: string
                                description: proxy sku
                              start:
                                type: number
                                description: pricingOffer.valid.from with unix format
                              end:
                                type: number
                                description: pricingOffer.valid.to with unix format
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /stateless/status/{country}/{userId}:
    get:
      tags:
        - stateless
      summary: User status for a user
      description: >-
        This endpoint returns pricing status for a given country and userId for
        this application,  doesn't depend on any state for the given user and
        the caller has to specify the country..
      parameters:
        - in: path
          name: country
          schema:
            type: string
          required: true
          description: The country's code (ISO 2-letter code)
        - in: path
          name: userId
          schema:
            type: string
          required: true
          description: User's id
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  isTarget: true
                  isInScope: true
                type: object
                properties:
                  isTarget:
                    type: boolean
                    description: flag indicates if user is in target group or not
                  isInScope:
                    type: boolean
                    description: >-
                      flag indicates if given countryCode joins
                      pricingConfig.scopeCountries
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /priceSuggestions:
    get:
      tags:
        - priceSuggestions
      summary: Price suggestions
      description: >-
        This endpoint returns information about all the available price
        suggestion documents for this application.
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  apiKey: 32b6bfa5-4296-4409-a090-d99ed9bdb9ff
                  package: com.wappier.game
                  priceSuggestions:
                    - id: 60647c3c2b0daf5e86f3388d
                      status: pending
                      uniqueSkus:
                        - testSKU1
                      createdAt: '2022-03-31T09:43:32.873Z'
                      pendingAt: '2022-03-31T09:43:32.973Z'
                    - id: 60647c3c2b0daa66d6f459a2
                      status: rejected
                      uniqueSkus:
                        - testSKU2
                      createdAt: '2022-03-15T09:43:32.873Z'
                      rejectedAt: '2022-03-16T13:28:09.719Z'
                      comment: Price for ES is too low!!
                    - id: 60647c3c2b0daf6a86f3387e
                      status: completed
                      uniqueSkus:
                        - testSKU3
                      createdAt: '2022-01-15T09:43:32.873Z'
                      completedAt: '2022-02-30T18:21:55.492Z'
                type: object
                properties:
                  apiKey:
                    type: string
                    description: the application api key.
                  package:
                    type: string
                    description: the application package name.
                  priceSuggestions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: the price suggestion doc id.
                        status:
                          type: string
                          description: the price suggestion last given status.
                        createdAt:
                          type: string
                          description: >-
                            date (in ISO string) the price suggestion is
                            created.
                        ${status}At:
                          type: string
                          description: >-
                            the price suggestion last given status date in ISO
                            string.
                        comment:
                          type: string
                          description: the price suggestion last given status comment.
                        uniqueSkus:
                          type: array
                          items:
                            type: string
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
  /priceSuggestions/{suggestionId}:
    get:
      tags:
        - priceSuggestions
      summary: Price suggestion by id
      description: >-
        This endpoint returns detailed information about the specific price
        suggestion document.
      parameters:
        - in: path
          name: suggestionId
          schema:
            type: string
          description: price suggestion doc id
          required: true
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/pendingPriceSuggestion'
                  - $ref: '#/components/schemas/approvedPriceSuggestion'
                  - $ref: '#/components/schemas/rejectedPriceSuggestion'
                  - $ref: '#/components/schemas/completedPriceSuggestion'
                  - $ref: '#/components/schemas/failedPriceSuggestion'
              examples:
                pending:
                  summary: an example of pending
                  value:
                    id: 62ab0fffa6002d316096172f
                    status: pending
                    platform: android
                    apiKey: aa59f030-d3c9-4f8e-b361-7933b496d8ac
                    package: com.xanadu.demo.qa
                    pendingAt: '2022-05-12T09:32:14.518Z'
                    createdAt: '2022-05-12T09:32:14.518Z'
                    skuPrices:
                      length: 1
                      skus:
                        - sku: com.xanadu.demo.sku1
                          basePrice:
                            priceMicros: 1990000
                            priceTier: null
                            currency: USD
                          localPrices:
                            - country: GR
                              appliedPrice: '15000000'
                              appliedPriceTier: null
                              recommendedPrice: '20000000'
                              recommendedPriceTier: null
                              defaultPrice: '10000000'
                              defaultPriceTier: null
                              percChangeFromCurrent: 50%
                              percChangeFromDefault: 100%
                              currency: EUR
                approved:
                  summary: an example of approved
                  value:
                    id: 62ab0fffa6002d316096172f
                    status: approved
                    platform: android
                    apiKey: aa59f030-d3c9-4f8e-b361-7933b496d8ac
                    package: com.xanadu.demo.qa
                    approvedAt: '2022-05-12T09:32:14.518Z'
                    createdAt: '2022-05-12T09:32:14.518Z'
                    skuPrices:
                      length: 1
                      skus:
                        - sku: com.xanadu.demo.sku1
                          basePrice:
                            priceMicros: 1990000
                            priceTier: null
                            currency: USD
                          localPrices:
                            - country: GR
                              appliedPrice: '15000000'
                              appliedPriceTier: null
                              recommendedPrice: '20000000'
                              recommendedPriceTier: null
                              defaultPrice: '10000000'
                              defaultPriceTier: null
                              percChangeFromCurrent: 50%
                              percChangeFromDefault: 100%
                              currency: EUR
                rejected:
                  summary: an example of rejected
                  value:
                    id: 62ab0fffa6002d316096172f
                    status: rejected
                    platform: android
                    apiKey: aa59f030-d3c9-4f8e-b361-7933b496d8ac
                    package: com.xanadu.demo.qa
                    rejectedAt: '2022-05-12T09:32:14.518Z'
                    createdAt: '2022-05-12T09:32:14.518Z'
                    skuPrices:
                      length: 1
                      skus:
                        - sku: com.xanadu.demo.sku1
                          basePrice:
                            priceMicros: 1990000
                            priceTier: null
                            currency: USD
                          localPrices:
                            - country: GR
                              appliedPrice: '15000000'
                              appliedPriceTier: null
                              recommendedPrice: '20000000'
                              recommendedPriceTier: null
                              defaultPrice: '10000000'
                              defaultPriceTier: null
                              percChangeFromCurrent: 50%
                              percChangeFromDefault: 100%
                              currency: EUR
                failed:
                  summary: an example of failed
                  value:
                    id: 62ab0fffa6002d316096172f
                    status: failed
                    platform: android
                    apiKey: aa59f030-d3c9-4f8e-b361-7933b496d8ac
                    package: com.xanadu.demo.qa
                    failedAt: '2022-05-12T09:32:14.518Z'
                    createdAt: '2022-05-12T09:32:14.518Z'
                    skuPrices:
                      length: 1
                      skus:
                        - sku: com.xanadu.demo.sku1
                          basePrice:
                            priceMicros: 1990000
                            priceTier: null
                            currency: USD
                          localPrices:
                            - country: GR
                              appliedPrice: '15000000'
                              appliedPriceTier: null
                              recommendedPrice: '20000000'
                              recommendedPriceTier: null
                              defaultPrice: '10000000'
                              defaultPriceTier: null
                              percChangeFromCurrent: 50%
                              percChangeFromDefault: 100%
                              currency: EUR
                completed:
                  summary: an example of completed
                  value:
                    id: 62ab0fffa6002d316096172f
                    status: completed
                    platform: android
                    apiKey: aa59f030-d3c9-4f8e-b361-7933b496d8ac
                    package: com.xanadu.demo.qa
                    completedAt: '2022-05-12T09:32:14.518Z'
                    createdAt: '2022-05-12T09:32:14.518Z'
                    skuPrices:
                      length: 1
                      skus:
                        - sku: com.xanadu.demo.sku1
                          basePrice:
                            priceMicros: 1990000
                            priceTier: null
                            currency: USD
                          localPrices:
                            - country: GR
                              appliedPrice: '15000000'
                              appliedPriceTier: null
                              recommendedPrice: '20000000'
                              recommendedPriceTier: null
                              defaultPrice: '10000000'
                              defaultPriceTier: null
                              percChangeFromCurrent: 50%
                              percChangeFromDefault: 100%
                              currency: EUR
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
  /priceSuggestions/pending:
    get:
      tags:
        - priceSuggestions
      summary: Pending price suggestion
      description: >-
        This endpoint returns detailed information about any pending price
        suggestion document for this application.
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pendingPriceSuggestion'
              example:
                id: 62ab0fffa6002d316096172f
                status: pending
                platform: android
                apiKey: aa59f030-d3c9-4f8e-b361-7933b496d8ac
                package: com.xanadu.demo.qa
                pendingAt: '2022-05-12T09:32:14.518Z'
                createdAt: '2022-05-12T09:32:14.518Z'
                skuPrices:
                  length: 1
                  skus:
                    - sku: com.xanadu.demo.sku1
                      basePrice:
                        priceMicros: 1990000
                        priceTier: null
                        currency: USD
                      localPrices:
                        - country: GR
                          appliedPrice: '15000000'
                          appliedPriceTier: null
                          recommendedPrice: '20000000'
                          recommendedPriceTier: null
                          defaultPrice: '10000000'
                          defaultPriceTier: null
                          percChangeFromCurrent: 50%
                          percChangeFromDefault: 100%
                          currency: EUR
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
  /priceSuggestions/reject:
    post:
      tags:
        - priceSuggestions
      summary: Reject price suggestion
      description: >-
        This endpoint updates the status and history of the specific price
        suggestions document to rejected
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  description: the suggestionId we want to reject (update).
                comment:
                  type: string
                  description: the reason for rejection
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rejectedPriceSuggestion'
              example:
                id: 62ab0fffa6002d316096172f
                status: rejected
                apiKey: aa59f030-d3c9-4f8e-b361-7933b496d8ac
                platform: android
                package: com.xanadu.demo.qa
                rejectedAt: '2022-05-12T09:32:14.518Z'
                createdAt: '2022-05-12T09:32:14.518Z'
                skuPrices:
                  length: 1
                  skus:
                    - sku: com.xanadu.demo.sku1
                      basePrice:
                        priceMicros: 1990000
                        priceTier: null
                        currency: USD
                      localPrices:
                        - country: GR
                          appliedPrice: '15000000'
                          appliedPriceTier: null
                          recommendedPrice: '20000000'
                          recommendedPriceTier: null
                          defaultPrice: '10000000'
                          defaultPriceTier: null
                          percChangeFromCurrent: 50%
                          percChangeFromDefault: 100%
                          currency: EUR
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /priceSuggestions/approve:
    post:
      tags:
        - priceSuggestions
      summary: Approve price suggestion
      description: >-
        This endpoint updates the status and history of the specific price
        suggestions document to approved
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: string
                  description: the suggestionId we want to approve (update).
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/approvedPriceSuggestion'
              example:
                id: 62ab0fffa6002d316096172f
                status: approved
                platform: android
                apiKey: aa59f030-d3c9-4f8e-b361-7933b496d8ac
                package: com.xanadu.demo.qa
                approvedAt: '2022-05-12T09:32:14.518Z'
                createdAt: '2022-05-12T09:32:14.518Z'
                skuPrices:
                  length: 1
                  skus:
                    - sku: com.xanadu.demo.sku1
                      basePrice:
                        priceMicros: 1990000
                        priceTier: null
                        currency: USD
                      localPrices:
                        - country: GR
                          appliedPrice: '15000000'
                          appliedPriceTier: null
                          recommendedPrice: '20000000'
                          recommendedPriceTier: null
                          defaultPrice: '10000000'
                          defaultPriceTier: null
                          percChangeFromCurrent: 50%
                          percChangeFromDefault: 100%
                          currency: EUR
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /service_account/android:
    put:
      tags:
        - serviceAccount
      summary: Google service account
      description: >-
        This endpoint sets the service account for Google Play Console for this
        application.  This enables wappier platform to perform operation on the
        application listing on Google Play Console using the provided API.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                client_x509_cert_url:
                  type: string
                  description: value from google json key.
                auth_provider_x509_cert_url:
                  type: string
                  description: value from google json key.
                token_uri:
                  type: string
                  description: value from google json key.
                auth_uri:
                  type: string
                  description: value from google json key.
                client_id:
                  type: string
                  description: value from google json key.
                client_email:
                  type: string
                  description: value from google json key.
                private_key:
                  type: string
                  description: value from google json key.
                private_key_id:
                  type: string
                  description: value from google json key.
                project_id:
                  type: string
                  description: value from google json key.
                type:
                  type: string
                  description: value from google json key.
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  message: googleServiceAccount updated successfully
                type: object
                properties:
                  message:
                    type: string
                    example: googleServiceAccount updated successfully
                    description: message that googleServiceAccount is added
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /service_account/android/file:
    put:
      tags:
        - serviceAccount
      summary: Google service account by uploading file.
      description: >-
        This endpoint sets the service account for Google Play Console for this
        application.  This enables wappier platform to perform operation on the
        application listing on Google Play Console using the provided API.
      requestBody:
        description: The Request Body of this request is a form containing .
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                fileName:
                  type: string
                  format: binary
      responses:
        '200':
          description: The created in app item.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: appleServiceAccount updated successfully
                    description: >-
                      message that appleServiceAccount is added in wappier
                      platform
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
  /service_account/ios:
    put:
      tags:
        - serviceAccount
      summary: Apple service account
      description: >-
        This endpoint sets the service account for App Store Connect API for
        this application.  This enables wappier platform to perform operation on
        the application listing on Apple App Store.
      requestBody:
        description: The Request Body of this request is a form containing .
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                issuerId:
                  type: string
                apiKeyId:
                  type: string
                appId:
                  type: string
                privateKey:
                  type: string
                  format: binary
                reviewScreenshot:
                  type: string
                  format: binary
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  message: appleServiceAccount updated successfully
                type: object
                properties:
                  message:
                    type: string
                    description: >-
                      message that appleServiceAccount is added in wappier
                      platform
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
  /pricingConfig/mailing-list:
    put:
      tags:
        - pricingConfig
      summary: Mailing list
      description: >-
        This endpoint sets the mailing list to receive email notifications for
        price suggestion updates for this application.
      requestBody:
        content:
          application/json:
            schema:
              example:
                - mail1@org1.com
                - mail2@org1.com
              type: array
              items:
                type: string
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                example:
                  message: Mailing list updated successfully
                type: object
                properties:
                  message:
                    type: string
                    description: message that list is updated in wappier platform
        '400':
          description: failure - bad request
          content:
            application/json:
              schema:
                example:
                  message: 'Error: ''No emails provided'' '
                type: object
                properties:
                  message:
                    type: string
                    description: message that list is not updated in wappier platform
        '401':
          $ref: '#/components/responses/401'
  /pricingConfig/billingsku:
    get:
      tags:
        - pricingConfig
      summary: Get billing sku from pricing config
      description: Get billing sku from pricing config
      responses:
        '200':
          description: Successful API call
          content:
            application/json:
              schema:
                type: object
                properties:
                  sku:
                    type: string
                    description: The billing sku from pricing config
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
components:
  schemas:
    pendingPriceSuggestion:
      type: object
      properties:
        id:
          type: string
          description: the price suggestion doc id
        status:
          type: string
          description: the suggestion status
          enum:
            - pending
            - approved
        apiKey:
          type: string
          description: the price suggestion doc api key
        package:
          type: string
          description: the price suggestion package name
        platform:
          type: string
          description: the price suggestion platform
          enum:
            - android
            - ios
        pendingAt:
          type: string
          description: the date of the status updated to pending
        createdAt:
          type: string
          description: the date price suggestion doc created
        skuPrices:
          type: object
          properties:
            length:
              type: number
              description: the skus length
            skus:
              type: array
              items:
                type: object
                properties:
                  sku:
                    type: string
                    description: the sku name
                  basePrice:
                    type: object
                    properties:
                      priceMicros:
                        type: integer
                        description: base price micros
                      priceTier:
                        type: integer
                        description: base price tier
                      currency:
                        type: string
                        description: base price currency
                  localPrices:
                    type: array
                    items:
                      type: object
                      properties:
                        country:
                          type: string
                          description: The country code of the suggested price
                        appliedPrice:
                          type: number
                          description: The current local price the players see in the game
                        appliedPriceTier:
                          type: number
                          description: >-
                            The current local price tier the players see in the
                            game
                        recommendedPrice:
                          type: number
                          description: The wappier optimal price we are proposing
                        recommendedPriceTier:
                          type: number
                          description: The wappier optimal price tier we are proposing
                        defaultPrice:
                          type: number
                          description: >-
                            The USD Default price converted based on the current
                            exchange
                        defaultPriceTier:
                          type: number
                          description: >-
                            The USD Default price Tier converted based on the
                            current exchange
                        percChangeFromCurrent:
                          type: string
                          description: >-
                            The difference in price that the current players are
                            going to see if we apply our optimal prices
                        percChangeFromDefault:
                          type: string
                          description: >-
                            The actual % difference from the SKU price that the
                            players would have seen if it was up to the normal
                            exchange rates
                        currency:
                          type: string
                          description: The currency code of the suggested price
    approvedPriceSuggestion:
      type: object
      properties:
        id:
          type: string
          description: the price suggestion doc id
        status:
          type: string
          description: the suggestion status
          enum:
            - pending
            - approved
        apiKey:
          type: string
          description: the price suggestion doc api key
          example: aa59f030-d3c9-4f8e-b361-7933b496d8ac
        package:
          type: string
          description: the price suggestion package name
          example: com.xanadu.demo.qa
        platform:
          type: string
          description: the price suggestion platform
          enum:
            - android
            - ios
        approvedAt:
          type: string
          description: the date of the status updated to pending
        createdAt:
          type: string
          description: the date price suggestion doc created
        skuPrices:
          type: object
          properties:
            length:
              type: number
              description: the skus length
            skus:
              type: array
              items:
                type: object
                properties:
                  sku:
                    type: string
                    description: the sku name
                  basePrice:
                    type: object
                    properties:
                      priceMicros:
                        type: integer
                        description: base price micros
                      priceTier:
                        type: integer
                        description: base price tier
                      currency:
                        type: string
                        description: base price currency
                  localPrices:
                    type: array
                    items:
                      type: object
                      properties:
                        country:
                          type: string
                          description: The country code of the suggested price
                        appliedPrice:
                          type: number
                          description: The current local price the players see in the game
                        appliedPriceTier:
                          type: number
                          description: >-
                            The current local price tier the players see in the
                            game
                        recommendedPrice:
                          type: number
                          description: The wappier optimal price we are proposing
                        recommendedPriceTier:
                          type: number
                          description: The wappier optimal price tier we are proposing
                        defaultPrice:
                          type: number
                          description: >-
                            The USD Default price converted based on the current
                            exchange
                        defaultPriceTier:
                          type: number
                          description: >-
                            The USD Default price Tier converted based on the
                            current exchange
                        percChangeFromCurrent:
                          type: string
                          description: >-
                            The difference in price that the current players are
                            going to see if we apply our optimal prices
                        percChangeFromDefault:
                          type: string
                          description: >-
                            The actual % difference from the SKU price that the
                            players would have seen if it was up to the normal
                            exchange rates
                        currency:
                          type: string
                          description: The currency code of the suggested price
    failedPriceSuggestion:
      type: object
      properties:
        id:
          type: string
          description: the price suggestion doc id
        status:
          type: string
          description: the suggestion status
          enum:
            - pending
            - approved
        apiKey:
          type: string
          description: the price suggestion doc api key
          example: aa59f030-d3c9-4f8e-b361-7933b496d8ac
        package:
          type: string
          description: the price suggestion package name
          example: com.xanadu.demo.qa
        platform:
          type: string
          description: the price suggestion platform
          enum:
            - android
            - ios
        failedAt:
          type: string
          description: the date of the status updated to pending
        createdAt:
          type: string
          description: the date price suggestion doc created
        skuPrices:
          type: object
          properties:
            length:
              type: number
              description: the skus length
            skus:
              type: array
              items:
                type: object
                properties:
                  sku:
                    type: string
                    description: the sku name
                  basePrice:
                    type: object
                    properties:
                      priceMicros:
                        type: integer
                        description: base price micros
                      priceTier:
                        type: integer
                        description: base price tier
                      currency:
                        type: string
                        description: base price currency
                  localPrices:
                    type: array
                    items:
                      type: object
                      properties:
                        country:
                          type: string
                          description: The country code of the suggested price
                        appliedPrice:
                          type: number
                          description: The current local price the players see in the game
                        appliedPriceTier:
                          type: number
                          description: >-
                            The current local price tier the players see in the
                            game
                        recommendedPrice:
                          type: number
                          description: The wappier optimal price we are proposing
                        recommendedPriceTier:
                          type: number
                          description: The wappier optimal price tier we are proposing
                        defaultPrice:
                          type: number
                          description: >-
                            The USD Default price converted based on the current
                            exchange
                        defaultPriceTier:
                          type: number
                          description: >-
                            The USD Default price Tier converted based on the
                            current exchange
                        percChangeFromCurrent:
                          type: string
                          description: >-
                            The difference in price that the current players are
                            going to see if we apply our optimal prices
                        percChangeFromDefault:
                          type: string
                          description: >-
                            The actual % difference from the SKU price that the
                            players would have seen if it was up to the normal
                            exchange rates
                        currency:
                          type: string
                          description: The currency code of the suggested price
    rejectedPriceSuggestion:
      type: object
      properties:
        id:
          type: string
          description: the price suggestion doc id
        status:
          type: string
          description: the suggestion status
          enum:
            - pending
            - approved
        apiKey:
          type: string
          description: the price suggestion doc api key
          example: aa59f030-d3c9-4f8e-b361-7933b496d8ac
        package:
          type: string
          description: the price suggestion package name
          example: com.xanadu.demo.qa
        platform:
          type: string
          description: the price suggestion platform
          enum:
            - android
            - ios
        rejectedAt:
          type: string
          description: the date of the status updated to pending
        createdAt:
          type: string
          description: the date price suggestion doc created
        skuPrices:
          type: object
          properties:
            length:
              type: number
              description: the skus length
            skus:
              type: array
              items:
                type: object
                properties:
                  sku:
                    type: string
                    description: the sku name
                  basePrice:
                    type: object
                    properties:
                      priceMicros:
                        type: integer
                        description: base price micros
                      priceTier:
                        type: integer
                        description: base price tier
                      currency:
                        type: string
                        description: base price currency
                  localPrices:
                    type: array
                    items:
                      type: object
                      properties:
                        country:
                          type: string
                          description: The country code of the suggested price
                        appliedPrice:
                          type: number
                          description: The current local price the players see in the game
                        appliedPriceTier:
                          type: number
                          description: >-
                            The current local price tier the players see in the
                            game
                        recommendedPrice:
                          type: number
                          description: The wappier optimal price we are proposing
                        recommendedPriceTier:
                          type: number
                          description: The wappier optimal price tier we are proposing
                        defaultPrice:
                          type: number
                          description: >-
                            The USD Default price converted based on the current
                            exchange
                        defaultPriceTier:
                          type: number
                          description: >-
                            The USD Default price Tier converted based on the
                            current exchange
                        percChangeFromCurrent:
                          type: string
                          description: >-
                            The difference in price that the current players are
                            going to see if we apply our optimal prices
                        percChangeFromDefault:
                          type: string
                          description: >-
                            The actual % difference from the SKU price that the
                            players would have seen if it was up to the normal
                            exchange rates
                        currency:
                          type: string
                          description: The currency code of the suggested price
    completedPriceSuggestion:
      type: object
      properties:
        id:
          type: string
          description: the price suggestion doc id
        status:
          type: string
          description: the suggestion status
          enum:
            - pending
            - approved
        apiKey:
          type: string
          description: the price suggestion doc api key
          example: aa59f030-d3c9-4f8e-b361-7933b496d8ac
        package:
          type: string
          description: the price suggestion package name
          example: com.xanadu.demo.qa
        platform:
          type: string
          description: the price suggestion platform
          enum:
            - android
            - ios
        completedAt:
          type: string
          description: the date of the status updated to pending
        createdAt:
          type: string
          description: the date price suggestion doc created
        skuPrices:
          type: object
          properties:
            length:
              type: number
              description: the skus length
            skus:
              type: array
              items:
                type: object
                properties:
                  sku:
                    type: string
                    description: the sku name
                  basePrice:
                    type: object
                    properties:
                      priceMicros:
                        type: integer
                        description: base price micros
                      priceTier:
                        type: integer
                        description: base price tier
                      currency:
                        type: string
                        description: base price currency
                  localPrices:
                    type: array
                    items:
                      type: object
                      properties:
                        country:
                          type: string
                          description: The country code of the suggested price
                        appliedPrice:
                          type: number
                          description: The current local price the players see in the game
                        appliedPriceTier:
                          type: number
                          description: >-
                            The current local price tier the players see in the
                            game
                        recommendedPrice:
                          type: number
                          description: The wappier optimal price we are proposing
                        recommendedPriceTier:
                          type: number
                          description: The wappier optimal price tier we are proposing
                        defaultPrice:
                          type: number
                          description: >-
                            The USD Default price converted based on the current
                            exchange
                        defaultPriceTier:
                          type: number
                          description: >-
                            The USD Default price Tier converted based on the
                            current exchange
                        percChangeFromCurrent:
                          type: string
                          description: >-
                            The difference in price that the current players are
                            going to see if we apply our optimal prices
                        percChangeFromDefault:
                          type: string
                          description: >-
                            The actual % difference from the SKU price that the
                            players would have seen if it was up to the normal
                            exchange rates
                        currency:
                          type: string
                          description: The currency code of the suggested price
    Header:
      type: object
      properties:
        wappierId:
          type: string
        username:
          type: string
        clientId:
          type: string
        clientSequence:
          type: string
        apiKey:
          type: string
        app:
          type: string
        platform:
          type: string
        sdkVersion:
          type: string
        clientSha:
          type: string
        timezone:
          type: string
        unixTime:
          type: string
        appVersion:
          type: string
        language:
          type: string
        deviceId:
          type: string
        sessionId:
          type: string
        utcTime:
          type: string
    purchase_reports:
      example:
        _id: 613736bdb3b404367007252b
        header:
          wappierId: c7b97449-00ea-547b-a829-bf858dfb0ea2
          username: 259f07150ce974f3
          clientId: 11196ac8-4f5c-4ef0-bd3f-cb551d0585a0
          clientSequence: '416'
          apiKey: 4a1c70fd-8654-49dc-882a-54eef5e7b897
          app: com.wappier.trivitap
          platform: android
          sdkVersion: 4.0.2
          clientSha: e0cedcdb
          timezone: America/New_York
          unixTime: '1631008445472'
          appVersion: 10.5.1
          language: en-US
          deviceId: WAP_5ab587b0-bba0-4171-8f63-43446bf71f8e
          sessionId: 80960695-2c72-44de-b277-48175c1c817e
          utcTime: '2021-09-07T09:54:05.472Z'
        payload:
          revenue: 4.99
          purchaseType: ''
          currency: USD
          iApReceipt: GPA.3323-0083-0776-16137
          purchaseData:
            productId: com.xanadu.demo.sku1.wap_4de6
            purchaseToken: >-
              cndcdlpalioadpgoamkdfngg.AO-J1OywlC3UcS8Q6nU1-LftPu01e0n_cbPwwvHgO0pu66yOwoS0E2jXLivQLNCgjiKO7R00IiTVoBHdVnkPsKkf6OAGNgnCJmriNv2fzSU3igHdDl7KEro
            purchaseTime: '1631008435889'
            purchaseState: PURCHASED
          dpData:
            pricingTestId: 60118eef82eef848d10a2a93
            group: B
            productId: com.xanadu.demo.sku1.wap_4de6
            originalSku: com.xanadu.demo.sku1
          iApReceiptSdk: GPA.3323-0083-0776-16137
          revenueUsd: 4.99
          data:
            validPurchase: true
            firstPurchase: null
        points: 0
        validPurchase: true
        pricing: true
        country: US
        createdAt: '2021-09-07T09:54:05.879Z'
      type: object
      properties:
        _id:
          type: string
          description: Internal document unique ID
        header:
          description: End-user information
          $ref: '#/components/schemas/Header'
        payload:
          description: Purchase information
          type: object
          properties:
            revenue:
              type: number
              description: Purchase revenue
            purchaseType:
              type: string
              description: Purchase product type
            currency:
              type: string
              description: Purchase currency
            iApReceipt:
              type: string
              description: Purchase receipt as reported in store
            purchaseData:
              type: object
              description: Purchase product type
              properties:
                productId:
                  type: string
                  description: Purchased product unique id
                purchaseToken:
                  type: string
                  description: Purchased product token
                purchaseTime:
                  type: string
                  description: Purchased product time
                purchaseState:
                  type: string
                  description: Purchased product state
            dpData:
              type: object
              properties:
                pricingTestId:
                  type: string
                group:
                  type: string
                productId:
                  type: string
                originalSku:
                  type: string
            iApReceiptSdk:
              type: string
            revenueUsd:
              type: number
            data:
              type: object
              properties:
                validPurchase:
                  type: boolean
                firstPurchase:
                  type: string
        points:
          type: number
        validPurchase:
          type: string
        pricing:
          type: string
        country:
          type: string
        createdAt:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-wappier-api-key
    SecurityTokenAuth:
      type: apiKey
      in: header
      name: x-wappier-token
  responses:
    '400':
      description: error cases
      content:
        application/json:
          schema:
            example:
              success: false
              message: some message
              errorDetails:
                errorMesage: some error message
            type: object
            properties:
              success:
                type: boolean
              message:
                type: string
              errorDetails:
                type: object
                properties:
                  errorMesage:
                    type: string
    '401':
      description: error cases (Unauthorized)
      content:
        application/json:
          schema:
            example:
              code: 908
              error: You are not authorized for this action
            type: object
            properties:
              code:
                type: integer
              error:
                type: string
    '403':
      description: Forbidden
tags:
  - name: purchaseReports
    description: >-
      This set of endpoints allows the caller to get detailed Purchase Reports
      about all the transactions that have been tracked on wappier's platform.
  - name: priceSuggestions
    description: >-
      This set of endpoints allows the caller to interact with price
      suggestions.  Price suggestions are generated whenever wappier platform
      decides to modify the SKU prices for an application.
  - name: stateful
    description: >-
      This set of endpoints allows the calling application to integrate with
      wappier Global Pricing and Promotional Pricing services.  It works in a
      user-centric way requiring wappier to maintain a full state for
      application users (events, transactions, etc.).
  - name: stateless
    description: >-
      This set of endpoints allows the calling application to integrate with
      wappier Global Pricing service only.  It works in a user agnostic way
      without keeping any state for application users.
  - name: serviceAccount
    description: >-
      These APIs allows the calling application to setup the specific store
      service account details.  The service account is used by wappier manage
      application IAP using the store specific API.
  - name: pricingConfig
    description: >-
      This endpoint allows the calling application to set the specific
      configuration parameters needed for the correct operation of wappier
      Pricing services.
