> 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 the function-style API as well. The function-style 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

It gives the user a reward (Toss Points) using a promotion code.

Toss app **5.232.0** can be used on versions above. Before calling, `Promotion.grantReward.isSupported()`You can check support with it. If called in 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 point amount to award. */
  amount: number;
}
```

**Response**

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

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

### Error

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

| Code                      | Description                                                                                                                                                                                                                                 |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `UNSUPPORTED_APP_VERSION` | If the running Toss app version does not support this feature, it occurs immediately upon calling. `Promotion.grantReward.isSupported()`Check in advance with, and if it occurs `error.message`show the user the (update guidance message). |
| `4100`                    | This is the case when the promotion information cannot be found.                                                                                                                                                                            |
| `4104`                    | This is the case when the promotion is suspended.                                                                                                                                                                                           |
| `4105`                    | This is the case when the promotion has ended.                                                                                                                                                                                              |
| `4108`                    | This is the case when the promotion is not approved.                                                                                                                                                                                        |
| `4109`                    | This is the case when the promotion is not running.                                                                                                                                                                                         |
| `4110`                    | This is the case when rewards cannot be granted/reclaimed.                                                                                                                                                                                  |
| `4112`                    | This is the case when the promotion money is insufficient.                                                                                                                                                                                  |
| `4113`                    | This is the case when it has already been granted/reclaimed.                                                                                                                                                                                |
| `4114`                    | This is the case when the one-time grant amount set for the promotion is exceeded.                                                                                                                                                          |
| `UNKNOWN_ERROR`           | This is the case when an unknown error occurs.                                                                                                                                                                                              |

Functional API `grantPromotionReward`is, like v2, not rejected and instead returns a failure `{ errorCode: string; message: string }` value or `'ERROR'` 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 awarded successfully!", result.key);
  } catch (error) {
    console.error("Failed to award 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.
