TossPay.authorizeSubscription
Functional API
requestTossPayPaysBillingYou can use the same functionality with it as well. The function-style API is the same as v2{ params: { wrappedToken } }It takes an argument in the following form, and if the version is not supported, it logs a warning instead of throwing an error and thenundefinedis returned.
Feature description
Displays the Toss Pay subscription payment window and performs user authentication. When authentication is complete, it returns whether it succeeded.
Actual payment processing must be done separately on the server after authentication succeeds.
Toss app 5.256.0 You can use it on version and above. Before calling, TossPay.authorizeSubscription.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
TossPay.authorizeSubscription(params: RequestTossPayPaysBillingOptions): Promise<RequestTossPayPaysBillingResult>;Params
type RequestTossPayPaysBillingOptions = {
/** This is the subscription payment wrapping token. */
wrappedToken: string;
};Response
type RequestTossPayPaysBillingResult = {
/** Whether authentication succeeded. */
success: boolean;
/** The reason if authentication failed. */
reason?: string;
};Error code
The error code is the error.code value.
UNSUPPORTED_APP_VERSION
If the running version of the Toss app doesn't support this feature, it occurs immediately upon call. TossPay.authorizeSubscription.isSupported()Check in advance with error.messageand, if it occurs, show the user the (update guidance message).
Example code
Was this helpful?