INNER CODE UNIT · TypeScript

alias

Flaque/quirk · src/payments/index.ts:60

export const alias = (txt: string) => {
  Purchases.createAlias(txt);
};

/**
 * Attempts to purchase a subscription,
 */
export const purchaseSubscription = async (): Promise<
  "error" | "canceled" | "success"
> => {
  try {
    const product = await getCurrentPurchasableSubscription();
    const { purchaserInfo } = await Purchases.makePurchase(product.identifier);

    return isValidPurchaserInfo(purchaserInfo) ? "success" : "error";
  } catch (err) {
    if (err.userCanceled) {
      userCanceledPayment();

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…