Subscription Detail API
The Subscription Detail API allows you to retrieve subscription details for a specific user or product. It provides information such as subscription status, payment dates, and expiration details.
Endpoint
URL:
For development:
https://api-dev.1buy.io/api/business/transactions/user_subscription
For production:
https://api.1buy.io/api/business/transactions/user_subscription
HTTP Method
POST
Headers
Header | Description |
---|---|
api-key | Your API key for authentication. |
Content-Type | Must be set to application/json . |
Request Body
The API supports the following parameters:
Parameter | Type | Description | Required |
---|---|---|---|
product_id | string | The unique product ID of the subscription. | Optional |
custom_id | string | Your custom ID used to track the subscription. | Optional |
user_id | string | The unique user ID for the subscriber. | Optional |
Note: At least one of
product_id
,custom_id
, oruser_id
is required.
Example Request Body
{
"product_id": "SPECIFY_PRODUCT_ID",
"custom_id": "SPECIFY_CUSTOM_ID",
"user_id": "SPECIFY_USER_ID"
}
Example CURL Command
The following example demonstrates how to query subscription details using the Subscription Detail API.
curl --location "https://api-dev.1buy.io/api/business/transactions/user_subscription" \
--header "api-key: YOUR_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"product_id": "SPECIFY_PRODUCT_ID",
"custom_id": "SPECIFY_CUSTOM_ID",
"user_id": "SPECIFY_USER_ID"
}'
Response
The API returns detailed subscription information.
Example Successful Response
{
"user_id": "string",
"custom_id": "string",
"business_user_id": "string",
"product_id": "string",
"start_date": "Date",
"last_paid_date": "Date",
"next_paid_date": "Date",
"expire_date": "Date",
"status": "number",
"failed_to_paid": "boolean",
"next_paid": "boolean",
"interval_time": "string"
}
Response Fields
Field | Type | Description |
---|---|---|
user_id | string | The unique user ID for the subscriber. |
custom_id | string | Your custom ID for tracking the subscription. |
business_user_id | string | The ID of the business user associated with the subscription. |
product_id | string | The product ID of the subscription. |
start_date | Date | The start date of the subscription. |
last_paid_date | Date | The last successful payment date. |
next_paid_date | Date | The next scheduled payment date. |
expire_date | Date | The expiration date of the subscription. |
status | number | The status of the subscription (e.g., active, canceled). |
failed_to_paid | boolean | Whether the last payment attempt failed. |
next_paid | boolean | Whether the subscription is set to auto-renew. |
interval_time | string | The interval of the subscription (e.g., Monthly, Yearly). |
Notes
- At least one parameter (
product_id
,custom_id
, oruser_id
) must be provided in the request body. - Use the Development Endpoint for testing and the Production Endpoint for live environments.
- Ensure your API key has the necessary permissions to access subscription details.