ChargebeeAPI

Record a purchase

Idempotency Supported
Try in API Explorer

The Record a Purchase API allows you to record in-app purchases made through channels such as the Apple App Store and Google Play Store in Chargebee. When you invoke this API, it initiates a purchase recording job and returns the recorded_purchase resource in the response. As part of the job, the API verifies the provided source specific request payload like transaction_id for Apple App Store or purchase_token for Google Play Store with the source such as apple_app_store or google_play_store respectively. If the verification is successful, the corresponding purchase is recorded in Chargebee. Upon completion, the recorded_purchase resource will include the relevant omnichannel_transaction_id and omnichannel_subscription_id. Since this operation is asynchronous, you need to check the status attribute of the recorded_purchase resource to track the job status: in_process, completed, or failed. Note: Upon successful completion of this asynchronous operation, Chargebee triggers the omnichannel_subscription_created event. If the recorded_purchase status is failed, review the error_detail attribute and take corrective action to re-record the purchase. You can use this API to record new and older purchases made on Apple App Store or Google Play Store by passing the transaction_id or purchase_token respectively received during the subscription purchase. You can record purchases for subscriptions that are in Active or Expired status.

Sample Request

URL Format

POST https://[site].chargebee.com/api/v2/recorded_purchases

Input Parameters

app_id
required, string, max chars=100

App Identifier in Chargebee. This is the handle created by Chargebee for your app. To get the app_id:

customer
optional, string

Parameters for customer

apple_app_store
optional, string

The source specific request payload that will be used to record the purchase. Provide parameters as apple_app_store[]

google_play_store
optional, string

Parameters for google_play_store

omnichannel_subscription
optional, string

Parameters for omnichannel_subscriptions

Returns

recorded_purchaseRecorded purchase object

Resource object representing Recorded purchase

customerCustomer object

Resource object representing Customer