# IAP on Apple devices

## Enabling in-app purchases

To enable in-app purchases for Apple, fill in the required fields in the *Settings* tab.

### Private key

The private key must be generated in App Store Connect.

{% stepper %}
{% step %}

### Navigate to the right section

Go to *App Store Connect → Users and Access → Integrations → In-App Purchase*.
{% endstep %}

{% step %}

### Create a new key

Click the *+ symbol* to create a new key.
{% endstep %}

{% step %}

### Download key file

Download the key file and upload it in the Settings tab.<br>
{% endstep %}
{% endstepper %}

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FZwFy0GiG2zTAu0V9rLVX%2Fimage.png?alt=media&#x26;token=66e28ca9-f6b2-4a00-85de-965ed38d5ece" alt=""><figcaption></figcaption></figure>

If you’re part of an Apple Enterprise developer account, a specific permission level is required to create this key. If you don’t have access, contact your company administrator.

### Key ID

Copy the Key ID generated in the previous step and paste it into the **Key ID** field in the Settings tab.

### App Apple ID

The App Apple ID must also be generated in App Store Connect.

{% stepper %}
{% step %}

### Navigate to the right section

Go to *App Store Connect → Apps → Distribution → General → App Information → General Information*.
{% endstep %}

{% step %}

### Copy the Apple ID

Copy the *Apple ID* and paste it into the *Settings* tab.

<figure><img src="https://34394582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M5sbzwG7CljeZdkntrL%2Fuploads%2FuXYB8Pk6ywl0MBbNsH5W%2Fimage.png?alt=media&#x26;token=d2f94b8b-8f04-4a16-ace3-495d8f262b2e" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Confirm

Once all fields are filled in, click *Validate* to confirm that everything is connected correctly.
{% endstep %}
{% endstepper %}

## Handling billing notification events

Because in-app purchases are completed through Apple’s interface, your app needs a way to detect when a user performs actions such as subscribing to or canceling a plan. Apple StoreKit sends server-side billing notifications whenever these events occur. This step ensures your app’s backend is correctly connected to Apple’s billing system.

Click *Connect billing notification events*. This automatically registers the correct endpoint URL for your app with Apple StoreKit.

It can take up to five minutes for Apple to update and recognize the new endpoint.

If you encounter an error, confirm that your API key has admin access. See [this article](https://manual.bubble.io/publishing-your-app/native-mobile-app/ios-app-store#id-1-create-a-new-api-key) for instructions.

## Testing setup

{% stepper %}
{% step %}

### Send test notification

Click *Send test notification*. Make sure at least five minutes have passed since connecting the billing notification events.
{% endstep %}

{% step %}

### Confirm

Check that the notification has been successfully received.
{% endstep %}
{% endstepper %}

If an error occurs, check *App Store Connect → Apps → App Information → App Store Server Notifications*.&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.bubble.io/help-guides/getting-started/building-for.../native-ios-and-android/in-app-purchases/iap-on-apple-devices.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
