IAP.createSubscriptionPurchaseOrder
Feature description
Go to the subscription in-app purchase order page. Like one-time purchases options / onEvent / onError It's an event style.
options.sku: This is the subscription product ID.options.offerId: This is the offer ID to apply. If omitted, the default price is applied.options.processProductGrant: Called when granting the product after order creation.{ orderId, subscriptionId? }It is received.
The returned cleanup function must be called when the feature is finished.
Toss app Android 5.248.0, iOS 5.249.0 It can be used on versions above. If called in an unsupported version, UNSUPPORTED_APP_VERSION an error occurs.
Type
IAP.createSubscriptionPurchaseOrder(params: CreateSubscriptionPurchaseOrderOptions): () => void;Params
interface CreateSubscriptionPurchaseOrderOptions {
options: {
sku: string;
offerId?: string | null;
processProductGrant: (params: {
orderId: string;
subscriptionId?: string;
}) => boolean | Promise<boolean>;
};
onEvent: (event: {
type: "success";
data: IapCreateSubscriptionPurchaseOrderResult;
}) => void | Promise<void>;
onError: (error: unknown) => void | Promise<void>;
}
type IapCreateSubscriptionPurchaseOrderResult =
IapCreateOneTimePurchaseOrderResult;Response
Returns a cleanup function to release resources when the payment flow ends (() => void).
Error
Error codes are onErrorcan be received as, or wrapped around the try/catcherrors caught in error.code value.
UNSUPPORTED_APP_VERSION
If the running version of the Toss app doesn't support this feature, it occurs immediately upon call. IAP.createSubscriptionPurchaseOrder.isSupported()Check in advance with error.messageand, if it occurs, show the user the (update guidance message).
Example code
Was this helpful?