> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/sdk/domains-api/promotion/promotion.grantreward.md).

# Promotion.grantReward

> Functional API `grantPromotionReward`You can use the same functionality with this as well. The function-based API is the same as v2 `{ params: { promotionCode, amount } }` It takes an argument in the form of, and if the app version is unsupported, instead of an error `undefined`is returned.

### Feature description

Use a promotion code to give the user a reward (Toss points).

Toss app **5.232.0** You can use it on version and above. Before calling, `Promotion.grantReward.isSupported()`You can check support status with Promotion.grantReward.isSupported(). If you call it on an unsupported version, `UNSUPPORTED_APP_VERSION` an error occurs.

### Type

```ts
Promotion.grantReward(params: { promotionCode: string; amount: number }): Promise<GrantPromotionRewardResponse>;
```

**Params**

```ts
{
  /** This is the promotion code. */
  promotionCode: string;
  /** This is the amount of points to grant. */
  amount: number;
}
```

**Response**

```ts
type GrantPromotionRewardResponse = {
  /** This is the reward key. */
  key: string;
};
```

* `{ key: string }`: Points were granted successfully. `key`is the reward key.

### Error

If granting points fails, an error containing a failure code is thrown. The error code is the caught error's `error.code` value.

| Code                      | Description                                                                                                                                                                                                                                     |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UNSUPPORTED_APP_VERSION` | If the running version of the Toss app doesn't support this feature, it occurs immediately upon call. `Promotion.grantReward.isSupported()`Check in advance with `error.message`and, if it occurs, show the user the (update guidance message). |
| `4100`                    | This is when the promotion information can't be found.                                                                                                                                                                                          |
| `4104`                    | This is when the promotion has been paused.                                                                                                                                                                                                     |
| `4105`                    | This is when the promotion has ended.                                                                                                                                                                                                           |
| `4108`                    | This is when the promotion hasn't been approved.                                                                                                                                                                                                |
| `4109`                    | This is when the promotion isn't running.                                                                                                                                                                                                       |
| `4110`                    | This is when the reward can't be granted/reclaimed.                                                                                                                                                                                             |
| `4112`                    | This is when there isn't enough promotion money.                                                                                                                                                                                                |
| `4113`                    | This is when it has already been granted/reclaimed.                                                                                                                                                                                             |
| `4114`                    | This is when it exceeds the one-time grant amount set for the promotion.                                                                                                                                                                        |
| `UNKNOWN_ERROR`           | This is when an unknown error has occurred.                                                                                                                                                                                                     |

Functional API `grantPromotionReward`Like v2, it does not reject and returns failure `{ errorCode: string; message: string }` value or `'ERROR'` It returns as a string.

### Example code

```js
import { Promotion } from "@apps-in-toss/web-framework";

async function handleGrantReward() {
  try {
    if (!Promotion.grantReward.isSupported()) {
      console.warn("This app version is not supported.");
      return;
    }

    const result = await Promotion.grantReward({
      promotionCode: "PROMOTION_CODE",
      amount: 1000,
    });

    console.log("Points granted successfully!", result.key);
  } catch (error) {
    console.error("Failed to grant points:", error.code, error.message);
  }
}

document
  .querySelector("#grant-reward")
  .addEventListener("click", handleGrantReward);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-en/sdk/domains-api/promotion/promotion.grantreward.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
