> For the complete documentation index, see [llms.txt](https://docs.webtonative.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.webtonative.com/website-plugins/bubble.io/in-app-purchase/get-iap-canceled-subscription-list-ios.md).

# IAP Canceled Subscription Guide (iOS)

***

**Overview**

This guide walks you through setting up a Bubble.io workflow to fetch canceled In-App Purchase (IAP) subscription data from an iOS app using the "webtonative" plugin. The process triggers when a user interacts with a button (e.g., "Get IAP Canceled Sub"), initiates a search for canceled subscriptions, and retrieves the results for display or further use. This is ideal for managing subscription statuses in your app.

***

#### Prerequisites

* **Bubble.io Account**: An active Bubble.io account with a project.
* **webtonative Plugin**: Installed in your Bubble editor (available under Plugins).
* **Apple Developer Account**: Required for iOS testing via TestFlight (optional for initial setup).
* **Basic Workflow Knowledge**: Familiarity with Bubble’s workflow editor.

***

**Step 1: Set Up the Trigger**

* **Purpose**: Define the event that starts the process (e.g., a button click).
* **Instructions**:
  1. Open your Bubble editor and navigate to the page where you want this feature.
  2. You can add a button element (e.g., name it "Button Get IAP Canceled Sub") via the "Design" tab.
  3. Select the button, then click "Start/Edit Workflow" to open the workflow editor.
  4. In the "When" section, choose "When the Button Get IAP Canceled Sub is clicked."
     * This links the workflow to the button click action.

**Step 2: Initialize the Canceled Subscriptions Check**

<figure><img src="/files/xzmHUhrFd0bNNmCG7jXh" alt=""><figcaption></figcaption></figure>

* **Purpose**: Begin the process of querying canceled subscriptions using the webtonative plugin.
* **Instructions**:
  1. Click "Click here to add an event..." below the trigger in the workflow editor.
  2. Select "Plugins" > "webtonative - Init IAP Canceled Subscriptions (iOS)" from the dropdown.
     * This action prepares the iOS app to start retrieving canceled subscription data.
  3. Leave the default settings (no parameters needed unless specified by the plugin).

**Step 3: Schedule a Delayed Check**

<figure><img src="/files/zJEjAiwqxEnUEG1t816P" alt=""><figcaption></figcaption></figure>

* **Purpose**: Allow a brief delay (1 second) to ensure the initialization completes before fetching results.
* **Instructions**:
  1. After the "Init IAP Canceled Subscriptions" action, click "Click here to add an action..."
  2. Choose "Schedule API Workflow" > "Schedule get IAP Canceled Subs after 1 second."
     * Set the custom event to "get IAP Canceled Subs."
     * This delays the next step to give the system time to process.

**Step 4: Define the Custom Event to Get Canceled Subscriptions**

<div><figure><img src="/files/imFDFSJjxP9WM51sZJMh" alt="" width="375"><figcaption></figcaption></figure> <figure><img src="/files/eSp5qChxbNICrlwYydNj" alt="" width="375"><figcaption></figcaption></figure></div>

* **Purpose**: Execute the action to retrieve the canceled subscription data.
* **Instructions**:
  1. In the workflow editor, locate or create the "get IAP Canceled Subs" custom event.
  2. Click "Click here to add an event..." and select "Plugins" > "webtonative - Get IAP Canceled Subs (iOS)."
     * This fetches the list of canceled subscriptions.
  3. Configure the action:
     * **Secret**: Enter your App Store shared secret (e.g., vs234bd34f404fd31bd2ac22)
     * **Is Test**: Set to "Yes" for testing purposes.
     * **Receipt Data**: Check this option to include subscription receipt details.

**Step 5: Retrieve Transaction Data**

<figure><img src="/files/x4SsMcpS1g4fwtYpSk1H" alt="" width="375"><figcaption></figcaption></figure>

* **Purpose**: Extract and inspect the transaction data associated with canceled subscriptions (for testing or debugging).
* **Instructions**:
  1. After the "Get IAP Canceled Subs" action, click "Click here to add an action..."
  2. Select "Plugins" > "webtonative - Grab IAP Transaction Data (only for checking)."
     * This pulls detailed transaction data, such as whether a subscription was already purchased or canceled.
  3. The result will be available as "Result of step 1 (webtonative - Get...)" with fields like "success" and "message."

**Step 6: Display Results for Testing**

* **Purpose**: Show the retrieved data as an alert to verify the workflow works (optional).
* **Instructions**:
  1. After the "Grab IAP Transaction Data" action, click "Click here to add an action..."
  2. Choose "Show an alert" or "Display data."
     * Set the content to "Result of step 1 (webtonative - Get...)" > "message" to display the result (e.g., "Is Already Purchased" or "success").
  3. Set "Only when" to "Click" to trigger on the button press.
     * Note: This step is for testing only. In a live app, you might save the data to a database or display it in a list.

**Note**: Whenever a user triggers the action to get canceled subscriptions, it will always provide a list of all canceled subscriptions.

***

#### Full Workflow Summary

* **Trigger**: When "Button Get IAP Canceled Sub" is clicked.
* **Steps**:
  1. Initialize the canceled subscriptions check with "webtonative - Init IAP Canceled Subscriptions."
  2. Schedule "get IAP Canceled Subs" to run after 1 second.
  3. Fetch canceled subscriptions with "webtonative - Get IAP Canceled Subs."
  4. Grab transaction data with "webtonative - Grab IAP Transaction Data."
  5. (Optional) Show the result as an alert for testing.

***

#### Testing and Deployment

* **Testing**:
  * Use the "Is Test" option and deploy to TestFlight for iOS testing.
  * Verify that the alert displays the expected data (e.g., canceled subscription details).
* **Production**:
  * Replace the alert with actions to save data to your Bubble database (e.g., create a "Canceled Subs" data type).
  * Remove testing flags and ensure the plugin is configured for live use.

***

#### Troubleshooting

* **No Data Returned**: Check the "Secret" key and ensure the webtonative plugin is properly set up.
* **Errors**: Review the plugin documentation or the Bubble community for support.

***
