You are viewing the documentation for Chargebee API V2. If you're using the older version (V1), click here.

Using the Non-Subscription resource, you can track one-time payments made for consumable, non-consumable, and non-renewing products in Chargebee. Call this API to notify Chargebee of non-subscription purchases made at stores.

Sample non subscription [ JSON ]

{ "invoice_id": "consumable_1000000807994664", "customer_id": "customer-123", "charge_id": "consumable-app_store_charge_id-USD" }

API Index URL GET

https://{site}.chargebee.com/api/v2/non_subscriptions
invoice_id
string, max chars=100

The unique immutable identifier of the invoice imported in Chargebee for which the receipt was sent.


customer_id
optional, string, max chars=100

The unique immutable identifier of the customer object to which the invoice belongs.


charge_id
string, max chars=100

The id of the non-recurring add-on.


This API is used to sync consumable, non-consumable, and non-renewing product payments in Chargebee.

Sample Request
# Record an One Time Purchase for Apple App Store
curl  https://{site}.chargebee.com/api/v2/non_subscriptions/cb-pjp7hcmrcbfmtjhle3smlwicu4/one_time_purchase \
     -X POST  \
     -u {site_api_key}:\
     -d receipt="Apple Based64 Encoded Receipt" \
     -d product[id]="app_store_charge_id" \
     -d product[price]=3399 \
     -d product[price_in_decimal]="33.99" \
     -d product[currency_code]="USD" \
     -d product[type]="consumable" \
     -d customer[id]="customer-123"
copy
# Record an One Time Purchase for Apple App Store
curl  https://{site}.chargebee.com/api/v2/non_subscriptions/cb-pjp7hcmrcbfmtjhle3smlwicu4/one_time_purchase \
     -X POST  \
     -u {site_api_key}:\
     -d receipt="Apple Based64 Encoded Receipt" \
     -d product[id]="app_store_charge_id" \
     -d product[price]=3399 \
     -d product[price_in_decimal]="33.99" \
     -d product[currency_code]="USD" \
     -d product[type]="consumable" \
     -d customer[id]="customer-123"

Sample Response [ JSON ]

Show more...
{"non_subscription": { "invoice_id": "consumable_1000000807994664", "customer_id": "customer-123", "charge_id": "consumable-app_store_charge_id-USD" }}

URL Format POST

https://{site}.chargebee.com/api/v2/non_subscriptions/{non_subscription_app_id}/one_time_purchase
receipt
required, string, max chars=65k
Google Play Store: The purchase token taken from the Android device after successful creation of the in-app purchase.

Apple App Store: The Base64 encoded App Store in-app purchase receipt taken from the Apple device after successful creation of the in-app purchase.
+
product
Parameters for product
pass parameters as product[<param name>]
product[id]
required, string, max chars=70
Google Play Store: The unique identifier of the product purchased. The value of this parameter is the productId or sku received from the Google Play Store.

Apple App Store: The unique identifier (created in App Store Connect) of the product purchased.
product[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.
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. Provide either this or product[price_in_decimal].
product[type]
required, enumerated string

The type of product for one time purchase.

Possible values are
consumable

This value represents a type of one-time purchase that provides users with in-app benefits or effects that can be consumed or depleted over time, such as lives, gems, boosts, or digital tips. Once consumed, the purchased item is no longer available and must be repurchased to obtain its benefits again.

non_consumable

The value represents a type of in-app purchase that provides a permanent benefit to the user and can be purchased once without expiration. This type of purchase is typically used to offer premium features or content that enhance the user experience of the app, such as additional filters or cosmetic items in a game.

non_renewing_subscription

The value represents a type of subscription that grants access to services or content for a limited period of time, such as a season pass to in-game content. Unlike other subscription models, this type of subscription does not renew automatically and requires people to purchase a new subscription once it concludes to continue accessing the content or services.

product[name]
optional, string, max chars=20
Google Play Store: The name (created in Play Store Console) of the product purchased. If not passed then the product[id] will be considered as the value of product[name].

Apple App Store: The name (created in App Store Connect) of the product purchased.
product[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].
+
customer
Parameters for customer
pass parameters as customer[<param name>]
customer[id]
optional, string, max chars=50
Google Play Store: The unique id in Chargebee for the customer who made this purchase via Google Play Store. If not provided, a random unique ID generated for the purchase token will be the customer[id]. If the customer record is not found in Chargebee, it is created.

Apple App Store: The unique id in Chargebee for the customer who made this purchase. If not provided, the value is considered to be original_transaction_id (the transaction identifier at Apple, of the original purchase). If the customer record is not found in Chargebee, it is created.
customer[email]
optional, string, max chars=70
The email address of the customer who made the purchase.
customer[first_name]
optional, string, max chars=150
The first name of the customer who made the purchase.
customer[last_name]
optional, string, max chars=150
The last name of the customer who made the purchase.
always returned
Resource object representing non_subscription