Xsolla-logo

Created subscriptionWebhook POST

When a user creates a subscription, Xsolla sends a webhook with the create_subscription type to the webhook URL.

Request
Request Body schema: application/json
notification_type
required
string

Notification type.

object

Custom project settings (object).

project_id
integer

Project ID. You can find this parameter in your Publisher Account next to the name of the project.

merchant_id
integer

Merchant ID.

object

User details (object).

id
required
string

User ID.

name
string

Username.

object

Subscription details (object).

plan_id
string

Plan ID (external if the plan was created via API).

tags
Array of strings

Plan tags.

subscription_id
integer

Subscription ID in Xsolla database.

product_id
string

Product ID (if sent in the access token).

date_create
string

Subscription creation date. Date and time per ISO 8601.

date_next_charge
string

Next billing date. Date and time per ISO 8601.

object

Trial period (object).

value
integer

Trial period.

type
string

Trial period type: day.

is_gift
boolean

Whether the subscription was gifted. The parameter is passed only if the value is true.

custom_parameters
object

Your custom parameters.

Responses
204

Return to indicate successful processing.

400

Return in case of an error in the provided information (e.g., a required parameter missing, failed authorization, etc.).

500

Return to indicate temporary errors with your servers.

Request samples
curl -v 'https://your.hostname/your/uri' \
-X POST \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Signature 13342703ccaca5064ad33ba451d800c5e823db8f' \
-d '{
        "notification_type": "create_subscription",
        "settings": {
          "project_id": 18404,
          "merchant_id": 2340
        },
        "user": {
            "id": "1234567",
            "name": "John Smith"
        },
        "subscription": {
            "plan_id": "b5dac9c8",
            "subscription_id": "10",
            "product_id": "Demo Product",
            "date_create": "2014-09-22T19:25:25+04:00",
            "date_next_charge": "2015-01-22T19:25:25+04:00",
            "trial": {
                    "value": 90,
                    "type": "day"
                },
            "is_gift": true
        }
    }'
Response samples
application/json
{
  • "error": {
    }
}