POST /recorded_purchases
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.
Servers
- {protocol}://{site}.{environment}:{port}/api/v2
- {protocol}://{site}-test.{environment}:{port}/api/v2
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
chargebee-request-origin-device |
String | No |
The device from which the customer has made the request |
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/x-www-form-urlencoded" |
chargebee-event-webhook |
String | No |
skip only webhooks Valid values:
|
chargebee-business-entity-id |
String | No |
If the site has multiple business entities, you can use this custom HTTP header to specify the business entity for which Chargebee should perform the operation. |
chargebee-event-actions |
String | No |
skip all actions to be done on the events Valid values:
|
chargebee-request-origin-user |
String | No |
The email address of your customer/user. Use this when the email address has only ASCII characters. |
chargebee-request-origin-ip |
String | No |
The IP address of the customer where the request originated |
chargebee-request-origin-user-encoded |
String | No |
The Base64-encoded email address of your customer/user. Use this if the email address has UTF-8 characters. When this header is provided, the header chargebee-request-origin-user is ignored. |
chargebee-event-email |
String | No |
skip only emails Valid values:
|
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
customer |
Object | No |
Parameters for customer |
customer.id |
String | Yes |
The |
omnichannel_subscription |
Object | No |
Parameters for |
omnichannel_subscription.id |
String | No |
Specifies the |
app_id |
String | Yes |
App Identifier in Chargebee. This is the handle created by Chargebee for your app. To get the
|
google_play_store |
Object | No |
Parameters for |
google_play_store.order_id |
String | No |
The |
google_play_store.purchase_token |
String | No |
The |
google_play_store.product_id |
String | No |
InApp |
apple_app_store |
Object | No |
The source specific request payload that will be used to record the purchase. Provide parameters as |
apple_app_store.product_id |
String | No |
The |
apple_app_store.transaction_id |
String | No |
The |
apple_app_store.receipt |
String | No |
The |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.