---
title: "useGifts"
description: "useGifts, auto-imported in the app: its options, return value and types."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/use-gifts"
---
# useGifts

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

## Interfaces

### UseGiftsOptions

Defined in: [src/runtime/vue/composables/use-gifts.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="api">
        
      </a>
      
       <code>
        api?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#billingapi">
        <code>
          BillingApi
        </code>
      </a>
    </td>
    
    <td>
      Override the injected <code>
        api.billing
      </code>
      
       namespace.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### ClaimGiftOptions

Defined in: [src/runtime/vue/composables/use-gifts.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts)

Per-call options for [UseGiftsReturn.claim](#claim).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="successurl">
        
      </a>
      
       <code>
        successUrl?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Where the provider's $0 checkout returns to, when the pack needs one. Defaults to the current URL.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="redirect">
        
      </a>
      
       <code>
        redirect?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Open that checkout in the same tab instead of a new one.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="workspaceid">
        
      </a>
      
       <code>
        workspaceId?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The workspace to receive the gift into, one the person manages (an owner or an admin of it). Omitted, it goes to their personal workspace. A plan pass goes only to a workspace on the free plan.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### SendGiftOptions

Defined in: [src/runtime/vue/composables/use-gifts.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts)

Per-call options for [UseGiftsReturn.send](#send).

#### Extends

- [`GiftOptions`](https://nuxt-backend.dev/docs/reference/api/use-billing#giftoptions)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Inherited from
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="message">
        
      </a>
      
       <code>
        message?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      A plain-text note of at most 500 characters, no links, shown to the recipient inside the app.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#giftoptions">
        <code>
          GiftOptions
        </code>
      </a>
      
      .<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#message-3">
        <code>
          message
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-billing.ts" rel="nofollow">
        src/runtime/vue/composables/use-billing.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="metadata">
        
      </a>
      
       <code>
        metadata?
      </code>
    </td>
    
    <td>
      <code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        string
      </code>
      
      >
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#giftoptions">
        <code>
          GiftOptions
        </code>
      </a>
      
      .<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#metadata-4">
        <code>
          metadata
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-billing.ts" rel="nofollow">
        src/runtime/vue/composables/use-billing.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="successurl-1">
        
      </a>
      
       <code>
        successUrl?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Where the purchaser returns after paying. Defaults to the current URL.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#giftoptions">
        <code>
          GiftOptions
        </code>
      </a>
      
      .<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#successurl-3">
        <code>
          successUrl
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-billing.ts" rel="nofollow">
        src/runtime/vue/composables/use-billing.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="redirect-1">
        
      </a>
      
       <code>
        redirect?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      Open in the same tab instead of a new one (redirect checkout).
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#giftoptions">
        <code>
          GiftOptions
        </code>
      </a>
      
      .<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#redirect-1">
        <code>
          redirect
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-billing.ts" rel="nofollow">
        src/runtime/vue/composables/use-billing.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="currency">
        
      </a>
      
       <code>
        currency?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The currency to pay in, lower-case ISO 4217: one the catalog prices the pack in (<code>
        usePricing().currencies
      </code>
      
      ); one it does not is refused as <code>
        invalid_input
      </code>
      
       (<code>
        currency
      </code>
      
      ). Omit for the catalog's own.
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#giftoptions">
        <code>
          GiftOptions
        </code>
      </a>
      
      .<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#currency-3">
        <code>
          currency
        </code>
      </a>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-billing.ts" rel="nofollow">
        src/runtime/vue/composables/use-billing.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="recipientemail">
        
      </a>
      
       <code>
        recipientEmail
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Who receives the gift. Never your own address.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="months">
        
      </a>
      
       <code>
        months?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      For a plan pass: how many months, one of the lengths the plan offers (<code>
        gift: { months }
      </code>
      
       in the catalog). Leave it out for a credit pack.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="deliverat">
        
      </a>
      
       <code>
        deliverAt?
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        Date
      </code>
    </td>
    
    <td>
      When the notice goes out and the recipient may claim, up to a year ahead. The purchase is paid at once.
    </td>
    
    <td>
      -
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseGiftsReturn

Defined in: [src/runtime/vue/composables/use-gifts.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="received">
        
      </a>
      
       <code>
        received
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#receivedgift">
        <code>
          ReceivedGift
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The delivered gifts addressed to the signed-in user's email: waiting and claimed, or <code>
        undefined
      </code>
      
       while loading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="unclaimed">
        
      </a>
      
       <code>
        unclaimed
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#receivedgift">
        <code>
          ReceivedGift
        </code>
      </a>
      
      <span>
        
      </span>
      
      >
    </td>
    
    <td>
      Gifts that are delivered but not yet claimed (ready to receive).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="sent">
        
      </a>
      
       <code>
        sent
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#sentgift">
        <code>
          SentGift
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      The gifts the signed-in user sent, newest first: scheduled, delivered, claimed or refunded. <code>
        undefined
      </code>
      
       while loading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isloading">
        
      </a>
      
       <code>
        isLoading
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       until the gift lists have loaded (always <code>
        false
      </code>
      
       when signed out, and once a read failed).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="ispending">
        
      </a>
      
       <code>
        isPending
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       while a send, a claim or a change to a sent gift runs.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="error">
        
      </a>
      
       <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/functions#backenderror">
        <code>
          BackendError
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Why the last action failed, else why a gift list could not be read, else <code>
        null
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="send">
        
      </a>
      
       <code>
        send
      </code>
    </td>
    
    <td>
      (<code>
        item
      </code>
      
      , <code>
        options
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        string
      </code>
      
      >
    </td>
    
    <td>
      Buy a gift for someone else and open the purchaser's checkout, resolving with its URL: a credit pack by its catalog key, or a plan as a pass with <code>
        months
      </code>
      
      . Rejects on failure, which <code>
        error
      </code>
      
       also holds.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="claim">
        
      </a>
      
       <code>
        claim
      </code>
    </td>
    
    <td>
      (<code>
        giftId
      </code>
      
      , <code>
        options?
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      Claim one gift into a workspace the signed-in user manages (their personal one by default). The session's email must be verified. Resolves <code>
        true
      </code>
      
       when the server confirmed the claim: the credits or the plan arrive a moment later, reactively. Resolves <code>
        false
      </code>
      
       after opening the provider's $0 checkout, for a pack that asks for checkout fields. Rejects with the refusal on failure, which <code>
        error
      </code>
      
       also holds.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="resend">
        
      </a>
      
       <code>
        resend
      </code>
    </td>
    
    <td>
      (<code>
        giftId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Send a sent gift's notice again. Refused once it is claimed or refunded, and more than once an hour.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="changerecipient">
        
      </a>
      
       <code>
        changeRecipient
      </code>
    </td>
    
    <td>
      (<code>
        giftId
      </code>
      
      , <code>
        recipientEmail
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Address an unclaimed gift to someone else, under the same checks as a new gift.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="reschedule">
        
      </a>
      
       <code>
        reschedule
      </code>
    </td>
    
    <td>
      (<code>
        giftId
      </code>
      
      , <code>
        deliverAt
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Move the delivery date of a gift not delivered yet. A date that is now delivers it at once.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="cancel">
        
      </a>
      
       <code>
        cancel
      </code>
    </td>
    
    <td>
      (<code>
        giftId
      </code>
      
      ) => <code>
        Promise
      </code>
      
      <<code>
        void
      </code>
      
      >
    </td>
    
    <td>
      Cancel an unclaimed gift and refund the purchase in full. Needs a recent sign-in (<code>
        reauthentication_required
      </code>
      
       otherwise): wrap it in <code>
        useReauthentication().withReauthentication
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts" rel="nofollow">
        src/runtime/vue/composables/use-gifts.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Functions

### useGifts()

```ts
function useGifts(options?): UseGiftsReturn;
```

Defined in: [src/runtime/vue/composables/use-gifts.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-gifts.ts)

Gifts, from both sides. A gift is a credit pack or a plan pass someone
paid for on their own billing account; the recipient receives it by
claiming it, which grants the credits or the plan to a workspace they
manage. Nothing is claimed without the recipient asking — show a "Receive"
button, or the `gift` notice of `<BackendNotices>`. The purchaser sees what
they sent and, until it is claimed, can resend its notice, change its
recipient or date, or cancel it for a refund. The lists never throw (a
failed read shows in `error`); the actions reject on failure.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="#usegiftsoptions">
        <code>
          UseGiftsOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`UseGiftsReturn`](#usegiftsreturn)

#### Example

```vue
<script setup lang="ts">
const gifts = useGifts()
</script>
<template>
  <div v-for="gift in gifts.unclaimed.value" :key="gift.id">
    A gift from {{ gift.purchaserName ?? 'someone' }}
    <button @click="gifts.claim(gift.id)">Receive</button>
  </div>
</template>
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
