---
title: "DiscountCodeBxgy"
description: "A code discount that gives customers a Buy X Get Y (BXGY) deal."
doc_type: graphql
doc_category: adminGraphQL
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-code-bxgy'
  md: 'https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-code-bxgy.md'
---
# DiscountCodeBxgy

A code discount that gives customers a Buy X Get Y (BXGY) deal.

- **API Version:** v20270301
- **API Type:** Admin
- **API Protocol:** GraphQL
- **Operation Type:** Object

## Type Signature

`DiscountCodeBxgy`

## Fields

* `appliesTimesPerCustomer`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  Limit on the number of uses per customer, null means no limit

* `asyncUsageCount`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  The count of times the discount has been used.

* `codeCount`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  The number of redeem codes for the discount.

* `codes`

  [[String]](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  It returns the first 20 codes of the discount

* `combinesWith`

  [DiscountCombinesWith](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-combines-with.md)

  Determines which discount classes the discount can combine with.

* `createdAt`

  [Date](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/date.md)

  The date and time when the discount was created.
  
  

* `customerBuys`

  [DiscountCustomerBuys](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-customer-buys.md)

  Eligible items for the discount and the quantity of each item the customer must buy.

* `customerGets`

  [DiscountCustomerGets](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-customer-gets.md)

  Eligible items in the order, the quantity of each item, and the total discount value.

* `customerSelection`

  [DiscountCustomerSelection](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/unions/discount-customer-selection.md)

  The customers that can use the discount.

* `discountClass`

  [MerchandiseDiscountClass](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/enums/merchandise-discount-class.md)

  The class of the discount for combining purposes.

* `endsAt`

  [Date](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/date.md)

  The date and time when the discount ends. For open-ended discounts, use null.

* `shareableUrls`

  [[DiscountShareableUrl]](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/objects/discount-shareable-url.md)

  URLs that can be used to share the discount.

* `startsAt`

  [Date](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/date.md)

  The date and time when the discount starts.

* `status`

  [DiscountStatus](https://developer.shopline.com/docs/admin-graph-ql-api/discounts-and-marketing/enums/discount-status.md)

  The status of the discount.
  
  

* `summary`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  A detailed summary of the discount.
  
  

* `title`

  [String](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/string.md)

  The title of the discount.
  
  

* `totalSales`

  [MoneyV2](https://developer.shopline.com/docs/admin-graph-ql-api/common-objects/objects/money-v2.md)

  The total sales from orders where the discount was used.

* `updatedAt`

  [Date](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/date.md)

  The date and time when the discount was updated.

* `usageLimit`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  The maximum number of times the discount can be used.

* `usesPerOrderLimit`

  [Int](https://developer.shopline.com/docs/admin-graph-ql-api/common/scalars/int.md)

  The maximum number of times that the discount can be applied to an order.
  
  

## Schema Definition

```graphql
type DiscountCodeBxgy { 
	appliesTimesPerCustomer: Int
	asyncUsageCount: Int
	codeCount: Int
	codes: [String]
	combinesWith: DiscountCombinesWith
	createdAt: Date
	customerBuys: DiscountCustomerBuys
	customerGets: DiscountCustomerGets
	customerSelection: DiscountCustomerSelection
	discountClass: MerchandiseDiscountClass
	endsAt: Date
	shareableUrls: [DiscountShareableUrl]
	startsAt: Date
	status: DiscountStatus
	summary: String
	title: String
	totalSales: MoneyV2
	updatedAt: Date
	usageLimit: Int
	usesPerOrderLimit: Int 
}
```

## Error Handling

For detailed information about common codes, see [Status and error codes](https://developer.shopline.com/docs/apps/api-instructions-for-use/graph-ql-admin-api/overview.md#status-and-error-codes).

