Discounts

These endpoints allow you to retrieve, create, update, and delete Discount(s).


List all Discounts

This query allows you to retrieve a paginated list of all your Discounts. By default, a maximum of 25 Discounts are shown per page.

Arguments

  • Name
    query
    Type
    String!
    Description

    Supported filter parameters: order_by order_dir

  • Name
    after
    Type
    String
    Description

    Returns the elements that come after the specified cursor.

  • Name
    first
    Type
    String
    Description

    Returns up to the first n elements from the list.

Fields

  • Label
    Discount!
    Description

    The discount query type.

Request

POST
https://services.lightfunnels.com/api/v2
query DiscountsQuery($first: Int, $after: String, $query: String!){
	discounts(query: "order_by:id order_dir:desc", after: "WzVE4OTA5LDEe/4OTA5XQ==", first: 10){
		edges{
			node{
				id
				code
				value
				type
				usage_limit
				one_time_usage_per_customer
				started_at
				expired_at
				active
				limited_usage
				usage
			}
		}
		pageInfo{
			endCursor
			hasNextPage
		}
	}
}

Response

{
		"data": {
			"edges": [
				{
					"node": {
						"id": "RGlzY291bnQ6MzQw",
						"code": "test discount",
						"value": 15,
						"type": "percentage",
						"usage_limit": 25,
						"one_time_usage_per_customer": false,
						"started_at": "2023-01-03 00:00:00",
						"expired_at": "2023-01-24 00:00:00",
						"active": true,
						"limited_usage": true,
						"usage": 2,
					}
				}
			],
			"pageInfo": {
				"endCursor": "WzE5OTY4LDE5OTY4XQ==",
				"hasNextPage": false
			}
		}
	}

Create a Discount

This query allows you to add a new Discount.

Arguments

Fields

  • Label
    Discount!
    Description

    The discount query type.

Request

POST
https://services.lightfunnels.com/api/v2
mutation mutationName($input: createDiscountMutationInput!) {
	createDiscount(input: $input){
		# createDiscountMutationPayload
	}
}

Response

{
		"data": {
			"createDiscount": {
				"clientMutationId": "Y291bnQ6MzQw",
				"discount": {
					"id": "RGlzY291bnQ6MzQw",
					"code": "test discount",
					"value": 15,
					"type": "percentage",
					"usage_limit": 25
					...
				}
			}
		}
	}

Retrieve a Discount

This query allows you to retrieve a Discount by providing its id.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The Discount id.

Fields

  • Label
    Discount!
    Description

    The Discount! query type.

Request

POST
https://services.lightfunnels.com/api/v2
	query DiscountQuery($id: ID!){
		node(id: $id){
			... on Discount{
				# Discount type fields
			}
		}
	}

Response

	{
		"data": {
			"node": {
				"id": "RGlzY291bnQ6MzQw",
				"code": "test discount",
				"value": 15,
				"type": "percentage",
				"usage_limit": 25
				...
			}
		}
	}

Update a Discount

This query allows you to perform an update on a Discount.

Arguments

Fields

  • Label
    Discount!
    Description

    The Discount! query type.

Request

Post
https://services.lightfunnels.com/api/v2
mutation updateDiscountMutation($input: updateDiscountMutationInput!){
		updateDiscount(input: $input){
			# updateDiscountMutationPayload type fields
		}
	}

Response

{
		"data": {
			"updateDiscount": {
				"id": "RGlzY291bnQ6MzQw",
				"code": "test discount",
				"value": 15,
				"type": "percentage",
				"usage_limit": 25
				...
			}
		}
	}

Delete a Discount

This query allows you to delete Discounts.

Arguments

  • Name
    items
    Type
    [ID!]!
    Description

    The Discount ids.

Fields

  • Name
    [ID]
    Description

    List of Discount ids.

Request

POST
https://services.lightfunnels.com/api/v2
	mutation deleteDiscountsMutation($items: [ID!]!){
		deleteDiscounts(items: $items){
			# [ID] type fields
		}
	}

Response

{
	"data": {
		"deleteDiscounts": [
			"UHJvZHVjdDoxNTUxMQ==",
			"UHJvZHVjdFKWATUxMQ=="
		]
	}
}