Skip to main content

Create Product Access

Creates a new product access in your 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.

Access lasts as long as the variant's access expiry allows: active_days days from the grant, or until access_until. A variant with neither grants lifetime access. The end date shows as active_until on the customer's products[] entry.

Request​

POST /product-access

Request Body​

ParameterTypeRequiredDescription
variant_idstringYesProduct variant UUID
full_namestringYesCustomer full name (max 50 characters)
emailstringYesCustomer email address (max 100 characters)
langstringYesLanguage 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": "d91c65aa-b221-4aa4-b626-cf0d8a198749",
"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​

Not Found Error (404)​

{
"message": "Product with ID d91c65aa-b221-4aa4-b626-cf0d8a198749 not found"
}

Stripe Account Required (422)​

{
"message": "Product access could not be created. Connect your Stripe account first."
}

Validation Error (422 Unprocessable Entity)​

{
"message": "The given data was invalid.",
"errors": {
"variant_id": [
"This field is required."
],
"full_name": [
"This field is required."
],
"email": [
"This field is required."
],
"lang": [
"The lang field must be one of: pl, en."
]
}
}