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[0..n]
Parameters for customer
pass parameters as customer[<param name>]
apple_app_store[0..n]
Parameters for apple_app_store
pass parameters as apple_app_store[<param name>]
google_play_store[0..n]
Parameters for google_play_store
pass parameters as google_play_store[<param name>]
omnichannel_subscription[0..n]
Parameters for omnichannel_subscription
pass parameters as omnichannel_subscription[<param name>]

Returns

recorded_purchaseRecorded purchase object
Resource object representing recorded_purchase
customerCustomer object
Resource object representing customer