Create Product Access
Creates a new product access in your easycart store. This process simulates a purchase with a 100% discount. If the customer account does not exist, it will be created. Email notifications are sent, and any configured automations and webhooks are triggered.
Request
POST /product-access
Request Body
Parameter | Type | Required | Description |
---|---|---|---|
variant_id | string | Yes | Product variant UUID |
full_name | string | Yes | Customer full name (max 50 characters) |
email | string | Yes | Customer email address (max 100 characters) |
lang | string | Yes | Language code for email communication ("pl" or "en") |
Example Request
curl -X POST "https://cart.easy.tools/api/v1/product-access" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"variant_id": "550e8400-e29b-41d4-a716-446655440002",
"full_name": "John Doe",
"email": "john.doe@example.com",
"lang": "en"
}'
Response
Success Response (201)
Returns a success message when product access is created.
{
"message": "Product access created successfully"
}
Error Responses
Product Not Found (404)
{
"message": "Product with ID 550e8400-e29b-41d4-a716-446655440002 not found"
}
Stripe Account Required (422)
{
"message": "Product access could not be created. Connect your Stripe account first."
}
Validation Error (422)
{
"message": "The given data was invalid.",
"errors": {
"variant_id": [
"The variant id field is required."
],
"full_name": [
"The full name field is required."
],
"email": [
"The email field is required."
],
"lang": [
"The lang field must be one of: pl, en."
]
}
}