Links between Store Credit Module and Other Modules

This document showcases the module links defined between the Store Credit Module and other Commerce Modules.

Summary#

The Store Credit Module has the following links to other modules:

First Data Model

Second Data Model

Type

Description

StoreCreditAccount in Store Credit Module

Customer in Customer Module

Read-only

Learn more

GiftCard in Loyalty Module

StoreCreditAccount in Store Credit Module

Stored - many-to-one

Learn more


Customer Module#

Medusa defines a read-only link between the StoreCreditAccount data model and the Customer Module's Customer data model. This means you can retrieve the customer associated with a store credit account, but you don't manage the links in a pivot table in the database. The customer of a store credit account is determined by the customer_id property of the StoreCreditAccount data model.

Retrieve with Query#

To retrieve the customer of a store credit account with Query, pass customer.* in fields:


Loyalty Module#

Medusa defines a link between the GiftCard in the Loyalty Module and StoreCreditAccount data models. This link is created when a gift card is created (alongside its store credit account) or when a gift card is redeemed.

This allows you to retrieve the store credit account associated with a gift card.

Retrieve with Query#

To retrieve the store credit account of a gift card with Query, pass store_credit_account.* in fields:

To manage the store credit account of a gift card, use Link:

Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break
⇧↵