# Process purchase command

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


[Idempotency Supported](/docs/api/idempotency)

Verifies an in-app purchase made by your customer and creates a subscription in Chargebee.

**Note:** If App Store or Play Store products have not been imported to Chargebee and this API is invoked, Chargebee will automatically create plans that correspond to the store product IDs. However, if historical subscriptions are to be imported using the [import receipt](/docs/api/in_app_subscriptions/import-receipt) API, importing products is mandatory. [Learn more](https://www.chargebee.com/docs/billing/2.0/mobile-subscriptions/mobile_subscriptions_manage).

Apple App Store

This section provides details of the Process Purchase Command operation when performed for the Apple App Store. This API processes only the latest in-app transaction on the receipt. Sync historical subscriptions into Chargebee using [bulk import](https://www.chargebee.com/docs/2.0/mobile-app-store-product-iap.html#import-in-app-purchase-receipts) of In-App Purchase receipts.

**Important**

-   [Integrate Chargebee](https://www.chargebee.com/docs/mobile-app-store-connect.html#connnect-with-your-chargebee-site) with your Apple App Store account using your shared secret from Apple.
-   It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only.
-   For updates to existing subscriptions, we recommend that you configure Apple App Store to send server notifications to Chargebee.

Chargebee validates the `receipt` with Apple App Store and does the following once validation succeeds:

1.  Look for `[item_family.id](/docs/api/item_families/item_family-object#id)` that matches the value Apple-App-Store, and create such a product family if not found.
2.  Look for `[item.id](/docs/api/items/item-object#id)` that matches `product[id]` and if not found, create such a plan-item under the item family described in the previous step.
3.  Look for `[item_price.id](/docs/api/item_prices/item_price-object#id)` that matches the concatenation of `product[id]` and `product[currency_code]`, and if not found, create such an item price under the item described in the previous step.
4.  Create/update a subscription:

-   If the receipt is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details:
    
-   `id` set to `[original_transaction_id](https://developer.apple.com/documentation/appstorereceipts/original_transaction_id?language=objc)`
    
-   `start_date` set to `[responseBody.Latest_receipt_info.purchase_date_ms](https://developer.apple.com/documentation/appstorereceipts/responsebody/latest_receipt_info?language=objc)`
    
-   `current_term_end` set to `responseBody.Latest_receipt_info.expires_date_ms`
    
-   Instead, if the receipt belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Apple.
    

1.  The payment is recorded against the subscription invoice. The associated transaction is updated with the following details:

-   The `[transaction.reference_number](/docs/api/transactions/transaction-object#reference_number)` is set to the `[transaction_id](https://developer.apple.com/documentation/appstorereceipts/transaction_id?language=objc)` of the payment.
-   The `[transaction.payment_method](/docs/api/transactions/transaction-object#payment_method)` is set to `apple_pay`.

Google Play Store

This section provides details of the Process Purchase Command operation when performed for the Google Play Store. This API processes only the latest in-app transaction using the purchase token.

**Important**

-   [Integrate Chargebee](https://www.chargebee.com/docs/2.0/mobile-playstore-connect.html#chargebee-configuration) with your Google Play Store account using the service account credentials JSON.
-   It is strongly recommended to use this endpoint to notify Chargebee of **new** purchases only.
-   For updates to existing subscriptions, we recommend that you configure Chargebee to receive Google's server notifications through pub/sub topic. [Learn more](https://developer.android.com/google/play/billing/getting-ready#setup-pubsub).

Chargebee validates the purchase **token** with Google Play Store and does the following once validation succeeds:

1.  Look for `[item_family.id](/docs/api/item_families/item_family-object#id)` that matches the value `Google-Play-Store`, and create such a product family if not found.
2.  Look for `[item.id](/docs/api/items/item-object#id)` that matches `product[id]` and if not found, create such a [plan-item](/docs/api/items/item-object#type) under the item family described in the previous step.
3.  Look for `[item_price.id](/docs/api/item_prices/item_price-object#id)` that matches the concatenation of `product[id]` and `[priceCurrencyCode](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en#SubscriptionPurchase.FIELDS.price_currency_code)`, and if not found, create such an item price under the item described in the previous step.
4.  Create/update a subscription:

-   If this token is for a new purchase, a new subscription is created for the plan-item price described in the previous step. The subscription has the following details:
    
-   `id` set to unique identifier generated by Chargebee and mapped to **token** of the `[SubscriptionPurchase](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en)` object from Google response.
    
-   `start_date` set to `SubscriptionPurchase.startTimeMillis`.
    
-   `current_term_end` set to `SubscriptionPurchase.expiryTimeMillis`.
    
-   Instead, if the token belongs to an existing subscription in Chargebee, it is updated to reflect the current state of the subscription at Google.
    

1.  The payment is recorded against the subscription invoice. The associated transaction is updated with the following details:

-   The `[transaction.reference_number](/docs/api/transactions/transaction-object#reference_number)` is set to the `[orderId](https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions?hl=en#SubscriptionPurchase.FIELDS.order_id)` of the payment.
-   The `[transaction.payment_method](/docs/api/transactions/transaction-object#payment_method)` is set to `play_store`.

## Path Parameter[](#path-parameter)

`{in_app_subscription_app_id}`: The handle created by Chargebee for your Apple App Store or Google Play Store app. It can be obtained from the Chargebee web app.

The following are instructions to obtain the value of the path parameter for the Apple App Store and Google Play Store.

-   **Apple App Store**: To obtain the value for `{in_app_subscription_app_id}`, click **View Keys** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-app-store-product-iap.html#resource-id).
-   **Google Play Store**: To obtain the value for `{in_app_subscription_app_id}`, click **Set up notifications** within the **Sync Overview** page of the web app and use the value of generated **App ID** for this parameter. See detailed steps [here](https://www.chargebee.com/docs/1.0/mobile-playstore-notifications.html#app-id).

## Sample Request

### Create an In app subscription for Apple App Store

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/in_app_subscriptions/cb-pjp7hcmrcbfmtjhle3smlwicu4/process_purchase_command \
     -u {site_api_key}:\
     -d receipt="Apple Based64 Encoded Receipt" \
     -d "product[id]"="app_store_plan_id" \
     -d "product[price]"=3399 \
     -d "product[price_in_decimal]"="33.99" \
     -d "product[currency_code]"="USD" \
     -d "customer[id]"="customer-123"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = InAppSubscription.ProcessReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4")
		.Receipt("Apple Based64 Encoded Receipt")
		.ProductId("app_store_plan_id")
		.ProductPrice(3399)
		.ProductPriceInDecimal("33.99")
		.ProductCurrencyCode("USD")
		.CustomerId("customer-123")
		.Request();

InAppSubscription inAppSubscription = result.InAppSubscription;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    inappsubscriptionAction "github.com/chargebee/chargebee-go/v3/actions/inappsubscription"
    "github.com/chargebee/chargebee-go/v3/models/inappsubscription"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := inappsubscriptionAction.ProcessReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", &inappsubscription.ProcessReceiptRequestParams{
        Receipt : "Apple Based64 Encoded Receipt",
        Product : &inappsubscription.ProcessReceiptProductParams{
            Id : "app_store_plan_id",
            Price : chargebee.Int64(3399),
            PriceInDecimal : "33.99",
            CurrencyCode : "USD",
        },
        Customer : &inappsubscription.ProcessReceiptCustomerParams{
            Id : "customer-123",
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        InAppSubscription := res.InAppSubscription
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.InAppSubscriptionProcessReceiptRequest{
    Receipt : "Apple Based64 Encoded Receipt",
    Product : &chargebee.InAppSubscriptionProcessReceiptProduct{
        Id : "app_store_plan_id",
        Price : chargebee.Int64(3399),
        PriceInDecimal : "33.99",
        CurrencyCode : "USD",
    },
    Customer : &chargebee.InAppSubscriptionProcessReceiptCustomer{
        Id : "customer-123",
    },
}
  res, err := client.InAppSubscription.ProcessReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", req)
      if err != nil {
        fmt.Println(err)
    } else {
        InAppSubscription := res.InAppSubscription
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = InAppSubscription.processReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4")
            .receipt("Apple Based64 Encoded Receipt")
            .productId("app_store_plan_id")
            .productPrice(3399L)
            .productPriceInDecimal("33.99")
            .productCurrencyCode("USD")
            .customerId("customer-123")
            .request();

        InAppSubscription inAppSubscription = result.inAppSubscription();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.inAppSubscription.InAppSubscription;
import com.chargebee.v4.models.inAppSubscription.params.InAppSubscriptionProcessReceiptParams;
import com.chargebee.v4.models.inAppSubscription.responses.InAppSubscriptionProcessReceiptResponse;

public class InAppSubscriptionProcessReceipt {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        InAppSubscriptionProcessReceiptParams.ProductParams productParams =
            InAppSubscriptionProcessReceiptParams.ProductParams.builder()
                .id("app_store_plan_id")
                .price(3399L)
                .priceInDecimal("33.99")
                .currencyCode("USD")
                .build();

        InAppSubscriptionProcessReceiptParams.CustomerParams customerParams =
            InAppSubscriptionProcessReceiptParams.CustomerParams.builder()
                .id("customer-123")
                .build();

        InAppSubscriptionProcessReceiptParams params = InAppSubscriptionProcessReceiptParams.builder()
            .receipt("Apple Based64 Encoded Receipt")
            .product(productParams)
            .customer(customerParams)
            .build();

        InAppSubscriptionProcessReceiptResponse response = client
            .inAppSubscriptions()
            .processReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", params);

        InAppSubscription inAppSubscription = response.getInAppSubscription();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.inAppSubscription.processReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", {
        receipt: "Apple Based64 Encoded Receipt",
        product: {
            id: "app_store_plan_id",
            price: 3399,
            price_in_decimal: 33.99,
            currency_code: "USD"
        },
        customer: {
            id: "customer-123"
        }
    });

    console.log(result);
    const inAppSubscription = result.in_app_subscription;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->inAppSubscription()->processReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", [
    "receipt" => "Apple Based64 Encoded Receipt",
    "product" => [
        "id" => "app_store_plan_id",
        "price" => 3399,
        "price_in_decimal" => "33.99",
        "currency_code" => "USD"
    ],
    "customer" => [
        "id" => "customer-123"
    ]
]);
$inAppSubscription = $result->in_app_subscription;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.InAppSubscription.process_receipt("cb-pjp7hcmrcbfmtjhle3smlwicu4",
    cb_client.InAppSubscription.ProcessReceiptParams(
        receipt="Apple Based64 Encoded Receipt",
        product=cb_client.InAppSubscription.ProcessReceiptProductParams(
            id="app_store_plan_id",
            price=3399,
            price_in_decimal="33.99",
            currency_code="USD"
        ),
        customer=cb_client.InAppSubscription.ProcessReceiptCustomerParams(
            id="customer-123"
        )
    )
)
in_app_subscription = response.in_app_subscription
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::InAppSubscription.process_receipt("cb-pjp7hcmrcbfmtjhle3smlwicu4",{
  :receipt => "Apple Based64 Encoded Receipt",
  :product => {
    :id => "app_store_plan_id",
    :price => 3399,
    :price_in_decimal => "33.99",
    :currency_code => "USD"
  },
  :customer => {
    :id => "customer-123"
  }
})

in_app_subscription = result.in_app_subscription
```

### Create an In app subscription for Google Play Store

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/in_app_subscriptions/cb-pjp7hcmrcbfmtjhle3smlwicu4/process_purchase_command \
     -u {site_api_key}:\
     -d receipt="Google purchase token" \
     -d "product[id]"="play_store_plan_id" \
     -d "customer[id]"="customer-123"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = InAppSubscription.ProcessReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4")
		.Receipt("Google purchase token")
		.ProductId("play_store_plan_id")
		.CustomerId("customer-123")
		.Request();

InAppSubscription inAppSubscription = result.InAppSubscription;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    inappsubscriptionAction "github.com/chargebee/chargebee-go/v3/actions/inappsubscription"
    "github.com/chargebee/chargebee-go/v3/models/inappsubscription"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := inappsubscriptionAction.ProcessReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", &inappsubscription.ProcessReceiptRequestParams{
        Receipt : "Google purchase token",
        Product : &inappsubscription.ProcessReceiptProductParams{
            Id : "play_store_plan_id",
        },
        Customer : &inappsubscription.ProcessReceiptCustomerParams{
            Id : "customer-123",
        },
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        InAppSubscription := res.InAppSubscription
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.InAppSubscriptionProcessReceiptRequest{
    Receipt : "Google purchase token",
    Product : &chargebee.InAppSubscriptionProcessReceiptProduct{
        Id : "play_store_plan_id",
    },
    Customer : &chargebee.InAppSubscriptionProcessReceiptCustomer{
        Id : "customer-123",
    },
}
  res, err := client.InAppSubscription.ProcessReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", req)
      if err != nil {
        fmt.Println(err)
    } else {
        InAppSubscription := res.InAppSubscription
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = InAppSubscription.processReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4")
            .receipt("Google purchase token")
            .productId("play_store_plan_id")
            .customerId("customer-123")
            .request();

        InAppSubscription inAppSubscription = result.inAppSubscription();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.inAppSubscription.InAppSubscription;
import com.chargebee.v4.models.inAppSubscription.params.InAppSubscriptionProcessReceiptParams;
import com.chargebee.v4.models.inAppSubscription.responses.InAppSubscriptionProcessReceiptResponse;

public class InAppSubscriptionProcessReceipt {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        InAppSubscriptionProcessReceiptParams.ProductParams productParams =
            InAppSubscriptionProcessReceiptParams.ProductParams.builder()
                .id("play_store_plan_id")
                .build();

        InAppSubscriptionProcessReceiptParams.CustomerParams customerParams =
            InAppSubscriptionProcessReceiptParams.CustomerParams.builder()
                .id("customer-123")
                .build();

        InAppSubscriptionProcessReceiptParams params = InAppSubscriptionProcessReceiptParams.builder()
            .receipt("Google purchase token")
            .product(productParams)
            .customer(customerParams)
            .build();

        InAppSubscriptionProcessReceiptResponse response = client
            .inAppSubscriptions()
            .processReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", params);

        InAppSubscription inAppSubscription = response.getInAppSubscription();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.inAppSubscription.processReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", {
        receipt: "Google purchase token",
        product: {
            id: "play_store_plan_id"
        },
        customer: {
            id: "customer-123"
        }
    });

    console.log(result);
    const inAppSubscription = result.in_app_subscription;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->inAppSubscription()->processReceipt("cb-pjp7hcmrcbfmtjhle3smlwicu4", [
    "receipt" => "Google purchase token",
    "product" => [
        "id" => "play_store_plan_id"
    ],
    "customer" => [
        "id" => "customer-123"
    ]
]);
$inAppSubscription = $result->in_app_subscription;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.InAppSubscription.process_receipt("cb-pjp7hcmrcbfmtjhle3smlwicu4",
    cb_client.InAppSubscription.ProcessReceiptParams(
        receipt="Google purchase token",
        product=cb_client.InAppSubscription.ProcessReceiptProductParams(
            id="play_store_plan_id"
        ),
        customer=cb_client.InAppSubscription.ProcessReceiptCustomerParams(
            id="customer-123"
        )
    )
)
in_app_subscription = response.in_app_subscription
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::InAppSubscription.process_receipt("cb-pjp7hcmrcbfmtjhle3smlwicu4",{
  :receipt => "Google purchase token",
  :product => {
    :id => "play_store_plan_id"
  },
  :customer => {
    :id => "customer-123"
  }
})

in_app_subscription = result.in_app_subscription
```

## Sample Response

```json
{
  "in_app_subscription": {
    "subscription_id": "1000000807994664",
    "customer_id": "customer-123",
    "plan_id": "app_store_plan_id-USD"
  }
}
```

## URL Format

**POST** https://[site].chargebee.com/api/v2/in_app_subscriptions/{in-app-subscription-app-id}/process_purchase_command

## Input Parameters

- `receipt` (required, string, max chars=65k)
  **Apple App Store**: The Base64 encoded [App Store in-app purchase receipt](https://developer.apple.com/documentation/storekit/original_api_for_in-app_purchase/validating_receipts_with_the_app_store?language=objc#overview) taken from the Apple device after successful creation of the in-app purchase subscription. **Google Play Store**: The purchase `token` taken from the Android device after the successful creation of an in-app purchase subscription.

- `product` (optional, string)
  Parameters for product
  - `id` (required, string, max chars=96)
    **Google Play Store**: The unique identifier of the product purchased. The value of this parameter is the `productId` /`subscriptionId` or `sku` received from the `[Google Play Store](https://developers.google.com/android-publisher/api-ref/rest/v3/inappproducts/get)`.
    
    **Note:** The `max chars` limit is `95` for Google Play Store.
    
    **Apple App Store**: The [unique identifier](https://developer.apple.com/documentation/storekit/product/id/) (created in [App Store Connect](https://appstoreconnect.apple.com/login) ) of the product purchased.
  - `currency_code` (required, string, max chars=3)
    **Google Play Store**: This parameter is **not applicable** to the Google Play Store. If the value is passed, it will return a validation error.
    
    **Apple App Store**: The currency code (ISO 4217 format) for the product.
  - `price` (required, in cents, min=0)
    **Google Play Store**: This parameter is **not applicable** to the Google Play Store. If the value is passed, it will return a validation error.
    
    **Apple App Store**: The price paid by the customer for this product. The unit [depends on the type of currency](/docs/api/getting-started). Provide either this or `product[price_in_decimal]` .
    
    **Note**:
    
    -   When the value of `product[price]` is passed through this API then it will override the product price configured in Chargebee while creating a subscription.
    -   When no `product[price]` is passed and the `product[id]` does not exist in Chargebee then this API will return an error.
    -   During the reactivation of a subscription, the old price of the subscription will be considered irrespective of the value of the `product[price]` passed through this API.
  - `name` (optional, string, max chars=46)
    **Google Play Store**: The name (created in [Play Store Console](https://play.google.com/console/about/) ) of the product purchased. If not passed then the `product[id]` will be considered as the value of `product[name]` .
    
    optional, string, max chars=46
    
    **Apple App Store**: The name (created in [App Store Connect](https://appstoreconnect.apple.com/login) ) of the product purchased.
  - `price_in_decimal` (optional, string, max chars=39)
    **Google Play Store**: This parameter is **not applicable** to the Google Play Store. If the value is passed, it will return a validation error.
    
    **Apple App Store**: The price paid by the customer for the product. The value is in decimal and in major units of the currency. Provide either this or `product[price]` .
  - `period` (optional, string, max chars=3)
    **Google Play Store**: This parameter is **not applicable** to the Google Play Store. If the value is passed, it will return a validation error.
    
    **Apple App Store**: This is the renewal period of the subscription. For example, 1, 2, 3, and so on. This is an `optional` parameter. The parameter value is `required` if the product(s) are not imported to Chargebee from Apple App Store.
  - `period_unit` (optional, string, max chars=3)
    **Google Play Store**: This parameter is **not applicable** to the Google Play Store. If the value is passed, it will return a validation error.
    
    **Apple App Store**: This is the unit of the renewal period. For example, `0` represents the `day` ,`1` represents the `week` , `2` represents the `month` , and `3` represents the `year`. This is an `optional` parameter. The parameter value is `required` if the product(s) are not imported to Chargebee from Apple App Store.
    
    **Note** Since the Apple App Store receipt does not have the subscription renewal period information for trial subscriptions, `product[period]` and `product[period_unit]` are needed, to create a subscription in Chargebee with the trial period. If these parameters are not passed and the receipt has trial information then Chargebee will return a validation error.

- `customer` (optional, string)
  Parameters for customer
  - `id` (optional, string, max chars=50)
    **Google Play Store**: The unique `[id](/docs/api/customers/create-a-customer#id)` in Chargebee for the customer who made this purchase via Google Play Store. If not provided, `subscription_id` (random unique id) will be the `customer[id]`. If the customer record is not found in Chargebee, it is created.
    
    optional, string, max chars=50
    
    **Apple App Store**: The unique `[id](/docs/api/customers/create-a-customer#id)` in Chargebee for the customer who made this purchase. If not provided, the value is considered to be `[original_transaction_id](https://developer.apple.com/documentation/appstorereceipts/original_transaction_id?language=objc)` (the transaction identifier at Apple, of the original purchase). If the customer record is not found in Chargebee, it is created.
  - `email` (optional, string, max chars=70)
    The email address of the customer who made the purchase.
  - `first_name` (optional, string, max chars=150)
    The first name of the customer who made the purchase.
  - `last_name` (optional, string, max chars=150)
    The last name of the customer who made the purchase.

## Returns

- `in_app_subscription` (In app subscription object)
  Resource object representing in\_app\_subscription
