Skip to main content

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

HeaderDescription
api-keyYour API key for authentication.
Content-TypeMust be set to application/json.

Request Body

The API supports the following parameters:

ParameterTypeDescriptionRequired
product_idstringThe unique product ID of the subscription.Optional
custom_idstringYour custom ID used to track the subscription.Optional
user_idstringThe unique user ID for the subscriber.Optional

Note: At least one of product_id, custom_id, or user_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

FieldTypeDescription
user_idstringThe unique user ID for the subscriber.
custom_idstringYour custom ID for tracking the subscription.
business_user_idstringThe ID of the business user associated with the subscription.
product_idstringThe product ID of the subscription.
start_dateDateThe start date of the subscription.
last_paid_dateDateThe last successful payment date.
next_paid_dateDateThe next scheduled payment date.
expire_dateDateThe expiration date of the subscription.
statusnumberThe status of the subscription (e.g., active, canceled).
failed_to_paidbooleanWhether the last payment attempt failed.
next_paidbooleanWhether the subscription is set to auto-renew.
interval_timestringThe interval of the subscription (e.g., Monthly, Yearly).

Notes

  • At least one parameter (product_id, custom_id, or user_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.