# Use Offer

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v3/{loyalty_club_slug}/members/me/offers/{id}/use:
    post:
      summary: Use Offer
      deprecated: false
      description: >-
        Uses (activates) the offer by member.


        ## Query Parameters


        Parameter | Type | Required? | Default    | Description

        --------- |------| --------- |------------| -----------

        scope     | enum | no        | `standard` | Determines the scope the API
        operates on. See [Offers scoping](doc-341649#scoping)


        ## Body Parameters


        Key | Type | Optional? | Description

        --- | ---- | --------- | -----------

        authorization_token | string | yes | See
        [below](api-3510865#offer-use-authorization)


        ### Offer use authorization


        Some features (like Rewards Program) may require from member to provide
        some code (scanned QR code, for example) sent as

        `authorization_token` param, so we can register his physical presence in
        the store.


        Depending on specific offer setup, the token may be required to register
        usage or be optional.


        When it's required (`authorization_token_required` is `true`), it's
        impossible to register usage.


        When it's optional and token is not provided, the offer use is processed
        as usual, except that some benefits (like Rewards points)

        tied to it may not be granted to the member.


        ## Response Body


        Key | Type  | Description

        --------- | -------- | ---------

        usage | OfferUsage | See [Offer usage
        model](doc-341649#offer-usage-model)


        ## Error Responses


        Status | Response body | Description

        --------- | ----------- | -------- 

        `404` | `{"error": "Offer#10000951 not found"}`| -

        `422` | `{"error": "Already active"}` | The offer has been just used

        `422` | `{"error": "Not granted"}` | The offer is not available to 
        member

        `422` | `{"error": "Usage authorization token missing"}` | Usage token
        is missing

        `422` | `{"error": "Usage authorization token invalid"}` | Provided
        usage token is invalid

        `422` | `{"error": "User limit exceeded"}` | Member exhausted his pool
        of uses

        `422` | `{"error": "Periodic user limit exceeded"}` | Member exhausted
        his pool of uses within current time period 

        `422` | `{"error": "Global limit exceeded"}` | There are no more offers
        available globally (stock is empty)

        `422` | `{"error": "Not in usable timeframes"}` | Offer is not usable
        yet or anymore

        `467` | `{"error": "Member is banned!", "banned_until":
        "2137-10-28T17:24:06.207Z"}` | Member is banned


        ## Example


        ```shell

        curl -X POST \

        "https://api.mpc.placewise.com/v3/infinity-mall/members/me/offers/1000016"
        \
            -H 'content-type: application/json' \
            -H 'authorization: Bearer 8433d608645345a45ce5a0f5ba1225e57546e86ac49e5fec842159dc82218522' \
            -H 'x-client-authorization: B7t9U9tsoWsGhrv2ouUoSqpM' \
            -H 'x-product-name: default' \
            -H 'x-user-agent: CURL manual test' \
            -d '
            {
              "authorization_token": "a1cc4e0b3ab54b7d8"
            }
            '
        ```


        When successful, returns a Offer usage object - See [Offer usage
        model](doc-341649#offer-usage-model)


        ```json

        {
            "usage": {
                "usable": true,
                "max_uses": 100,
                "uses_left": 68,
                "active_until": "2019-05-08T14:47:22.323Z"
            }
        }

        ```
      tags:
        - API Reference/Public API/Offers/Offers
      parameters:
        - name: loyalty_club_slug
          in: path
          description: ''
          required: true
          example: infinity-mall
          schema:
            type: string
        - name: id
          in: path
          description: ''
          required: true
          example: 1
          schema:
            type: integer
        - name: Content-Type
          in: header
          description: '[Details](doc-341635)'
          required: true
          example: application/json
          schema:
            type: string
            default: application/json
            const: application/json
        - name: X-User-Agent
          in: header
          description: Arbitrary identifier of your client. [Details](doc-341635)
          required: true
          example: '{{X_USER_AGENT}}'
          schema:
            type: string
            default: '{{X_USER_AGENT}}'
        - name: X-Product-Name
          in: header
          description: API Product for API context. [Details](doc-341635)
          required: true
          example: '{{PRODUCT_NAME}}'
          schema:
            type: string
            default: '{{PRODUCT_NAME}}'
        - name: X-Loyalty-Club-Slug
          in: header
          description: LoyaltyClub for API context. [Details](doc-342138)
          required: false
          example: '{{LOYALTY_CLUB_SLUG}}'
          schema:
            type: string
            default: '{{LOYALTY_CLUB_SLUG}}'
        - name: X-Customer
          in: header
          description: Customer for API context.  [Details](doc-342139)
          required: false
          example: '{{CUSTOMER_ID}}'
          schema:
            type: string
            default: '{{CUSTOMER_ID}}'
        - name: Authorization
          in: header
          description: '[Member](doc-342129) or [User](doc-342130) Authorization.'
          required: false
          example: Bearer {{_OAUTH_TOKEN}}
          schema:
            type: string
            default: Bearer {{_OAUTH_TOKEN}}
        - name: X-Client-Authorization
          in: header
          description: '[Token](doc-342128) Authorization.'
          example: '{{API_TOKEN}}'
          schema:
            type: string
            default: '{{API_TOKEN}}'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: API Reference/Public API/Offers/Offers
      x-apidog-status: pending
      x-run-in-apidog: https://app.eu.apidog.com/web/project/346351/apis/api-3510865-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.mpc.dev.placewise.com
    description: Staging
security: []

```