Skip to Content

GiftCard

A gift card with value, code, expiration, and remaining value.

Type Definition

type GiftCard { value: Float! code: String! expires: String! valueLeft: Float! }

Fields

FieldTypeDescriptionNullableRelationship
valueFloat!The value of the gift card in the order currency.NoScalar
codeString!The code of the gift card.NoScalar
expiresString!The expiration date of the gift card in RFC2822 format.NoScalar
valueLeftFloat!The remaining value of the gift card in the order currency.NoScalar

Relationships

The GiftCard object type contains scalar fields only and does not directly reference other object types. It is used as part of the CartPaymentMethod object under the giftCard field, representing a payment method based on a gift card.

Usage Examples

Basic Query

query { giftCard { value code expires valueLeft } }

Field Selection

query { giftCard { code valueLeft } }

Nested Queries

query { cart(id: "eyJhbGciOiJIUzI1NiJ9...") { paymentMethods { giftCard { code value valueLeft expires } } } }

Filtering and Sorting

The GiftCard type does not support filtering or sorting directly as it is a nested object within payment methods. Filtering and sorting should be applied at the parent query level, such as filtering carts or payment methods.

Implements

This type does not implement any interfaces.

Connections

The GiftCard type is not a connection type and does not support pagination.

  • Float — Scalar type used for monetary values.
  • String — Scalar type used for textual data such as codes and dates.

Best Practices

  • Always check the expires field to ensure the gift card is still valid before applying it.
  • Use the valueLeft field to determine how much credit remains on the gift card.
  • When querying gift cards within cart payment methods, handle cases where the gift card may be absent or expired.
  • Avoid exposing the full gift card code publicly to prevent unauthorized use.
  • Use precise floating-point handling in your client application when working with monetary values.

Notes

  • The expires field uses RFC2822 date format. Ensure your client parses this correctly.
  • The API currently requires no authentication, but this may change in future versions.
  • Gift card values are represented in the order currency and may vary depending on the order context.
  • This object type contains only scalar fields and no computed or derived fields.
  • No field arguments are defined for GiftCard.
  • For performance, minimize querying gift card details unless necessary, especially in lists of payment methods.
Last updated on