For the complete documentation index, see llms.txt. This page is also available as Markdown.

Promotion.grantReward

Functional API grantPromotionRewardYou 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 undefinedis 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

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

Params

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

Response

type GrantPromotionRewardResponse = {
  /** This is the reward key. */
  key: string;
};
  • { key: string }: Points were granted successfully. keyis 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.messageand, 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 grantPromotionRewardLike v2, it does not reject and returns failure { errorCode: string; message: string } value or 'ERROR' It returns as a string.

Example code

Was this helpful?