> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GetLoyaltyTransaction

# Package: accounts

# Namespace: LoyaltyTransactions

# Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/accounts/transactions/get-loyalty-transaction.md

## Permission Scopes:
Read Loyalty: SCOPE.DC-LOYALTY.READ-LOYALTY

## Introduction

Retrieves a transaction.

---

## REST API

### Schema

```
 Method: getLoyaltyTransaction
 Description: Retrieves a transaction.
 URL: https://www.wixapis.com/loyalty-transactions/v1/loyalty-transactions/{loyaltyTransactionId}
 Method: GET
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  loyaltyTransactionId
 Method parameters: 
   param name: loyaltyTransactionId | type:   none | required: true 
 Return type: GetLoyaltyTransactionResponse
  - name: loyaltyTransaction | type: LoyaltyTransaction | description: Retrieved loyalty transaction.  
     - ONE-OF: 
        - name: earnInfo | type: EarnInfo | description: Information on points earned.  
           - ONE-OF: 
              - name: followedSocialMedia | type: FollowedSocialMedia | description: Details on following on social media.  
                 - name: channel | type: string | description: Social media channel. For example, `"FACEBOOK"` or `"INSTAGRAM"`.  | validation: maxLength 32
           - name: appId | type: string | description: GUID of the app that generated the earned points.  | read-only: true | validation: minLength 1
           - name: activityType | type: string | description: Activity type.  
           - name: orderId | type: string | description: Order GUID.  | validation: maxLength 512
           - name: limitApplied | type: boolean | description: Whether the points amount was adjusted by an earn points limit provider.  | read-only: true 
        - name: redeemInfo | type: RedeemInfo | description: Information on points redeemed.  
           - name: rewardId | type: string | description: GUID of the reward that was redeemed.  | read-only: true | validation: format GUID
           - name: rewardType | type: string | description: Type of reward that was redeemed.  | read-only: true 
           - name: referenceEntityId | type: string | description: GUID of the specific item that was redeemed in this transaction.  Each reward that's redeemed has a unique `referenceEntityId`.  | read-only: true | validation: format GUID
        - name: adjustInfo | type: AdjustInfo | description: Information on points adjusted.  
           - name: appId | type: string | description: GUID of the app that initiated the points adjustment.  | read-only: true | validation: minLength 1
           - name: amountBefore | type: integer | description: Amount before adjustment.  
           - name: amountAfter | type: integer | description: Amount after adjustment.  
        - name: refundInfo | type: RefundInfo | description: Information on points refunded.  
           - name: appId | type: string | description: GUID of the app that refunded points.  | read-only: true | validation: minLength 1
           - name: refundedTransactionId | type: string | description: GUID of the transaction that was refunded.  | read-only: true | validation: format GUID
        - name: expireInfo | type: ExpireInfo | description: Information on points expired.  
           - name: amountBefore | type: integer | description: Amount before expiration.  
           - name: amountAfter | type: integer | description: Amount after expiration.  
        - name: earnAttemptInfo | type: EarnAttemptInfo | description: Information on a limited earn attempt recorded with 0 points.  
           - name: appId | type: string | description: GUID of the app that generated the earn operation.  | read-only: true | validation: minLength 1
           - name: activityType | type: string | description: Activity type.  
           - name: orderId | type: string | description: Order GUID.  | validation: maxLength 512
     - name: id | type: string | description: Transaction GUID.  | validation: format GUID
     - name: accountId | type: string | description: Account GUID.  | validation: format GUID
     - name: createdDate | type: string | description: Date and time the transaction was created.  | read-only: true | validation: format date-time
     - name: amount | type: integer | description: The number of points earned, adjusted, redeemed, or expired in the transaction.  + `EARN`: Number of points earned by a customer taking an action. + `REDEEM`: The number of points redeemed by a customer for a reward. + `ADJUST`: The number of points adjusted to a customer's balance. + `REFUND`: The number of points refunded for a previously redeemed reward. + `EXPIRE`: The number of points that expired due to customer inactivity for a configured period.  
     - name: transactionType | type: TransactionType | description: Type of transaction.  
         - enum:
         -     UNKNOWN: Unknown transaction type.
         -     EARN: Number of points earned by a customer taking an action. See [Earn Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/earn-points.md).
         -     REDEEM: Number of points redeemed by a customer for a reward.
         -     ADJUST: Number of points adjusted to a customer's balance. See [Adjust Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/adjust-points.md).
         -     REFUND: Number of points refunded for a previously redeemed reward.
         -     EXPIRE: Number of points that expired due to customer inactivity for a configured period.
         -     EARN_ATTEMPT: Record of an earn attempt that was limited to 0 points.
     - name: description | type: string | description: Transaction description.  | validation: maxLength 100
     - name: idempotencyKey | type: string | description: Unique identifier, generated by the client. Used to recognize repeated attempts of the same request. Only present when manually adding points with [Earn Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/earn-points.md).  | validation: maxLength 128


```

### Examples

### Get loyalty transaction
```curl
curl -X GET \
  'https://www.wixapis.com/loyalty-transactions/v1/loyalty-transactions/18ddc2a5-248b-47ac-8ec0-603550f1f6b9' \
  -H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.loyalty.transactions.getLoyaltyTransaction(loyaltyTransactionId)
 Description: Retrieves a transaction.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  loyaltyTransactionId
 Method parameters: 
   param name: loyaltyTransactionId | type: string | description: GUID of the loyalty transaction to retrieve. | required: true | validation: format GUID
 Return type: PROMISE<LoyaltyTransaction>
  - ONE-OF: 
     - name: earnInfo | type: EarnInfo | description: Information on points earned.  
        - ONE-OF: 
           - name: followedSocialMedia | type: FollowedSocialMedia | description: Details on following on social media.  
              - name: channel | type: string | description: Social media channel. For example, `"FACEBOOK"` or `"INSTAGRAM"`.  | validation: maxLength 32
        - name: appId | type: string | description: GUID of the app that generated the earned points.  | read-only: true | validation: minLength 1
        - name: activityType | type: string | description: Activity type.  
        - name: orderId | type: string | description: Order GUID.  | validation: maxLength 512
        - name: limitApplied | type: boolean | description: Whether the points amount was adjusted by an earn points limit provider.  | read-only: true 
     - name: redeemInfo | type: RedeemInfo | description: Information on points redeemed.  
        - name: rewardId | type: string | description: GUID of the reward that was redeemed.  | read-only: true | validation: format GUID
        - name: rewardType | type: string | description: Type of reward that was redeemed.  | read-only: true 
        - name: referenceEntityId | type: string | description: GUID of the specific item that was redeemed in this transaction.  Each reward that's redeemed has a unique `referenceEntityId`.  | read-only: true | validation: format GUID
     - name: adjustInfo | type: AdjustInfo | description: Information on points adjusted.  
        - name: appId | type: string | description: GUID of the app that initiated the points adjustment.  | read-only: true | validation: minLength 1
        - name: amountBefore | type: integer | description: Amount before adjustment.  
        - name: amountAfter | type: integer | description: Amount after adjustment.  
     - name: refundInfo | type: RefundInfo | description: Information on points refunded.  
        - name: appId | type: string | description: GUID of the app that refunded points.  | read-only: true | validation: minLength 1
        - name: refundedTransactionId | type: string | description: GUID of the transaction that was refunded.  | read-only: true | validation: format GUID
     - name: expireInfo | type: ExpireInfo | description: Information on points expired.  
        - name: amountBefore | type: integer | description: Amount before expiration.  
        - name: amountAfter | type: integer | description: Amount after expiration.  
     - name: earnAttemptInfo | type: EarnAttemptInfo | description: Information on a limited earn attempt recorded with 0 points.  
        - name: appId | type: string | description: GUID of the app that generated the earn operation.  | read-only: true | validation: minLength 1
        - name: activityType | type: string | description: Activity type.  
        - name: orderId | type: string | description: Order GUID.  | validation: maxLength 512
  - name: _id | type: string | description: Transaction GUID.  | validation: format GUID
  - name: accountId | type: string | description: Account GUID.  | validation: format GUID
  - name: _createdDate | type: Date | description: Date and time the transaction was created.  | read-only: true 
  - name: amount | type: integer | description: The number of points earned, adjusted, redeemed, or expired in the transaction.  + `EARN`: Number of points earned by a customer taking an action. + `REDEEM`: The number of points redeemed by a customer for a reward. + `ADJUST`: The number of points adjusted to a customer's balance. + `REFUND`: The number of points refunded for a previously redeemed reward. + `EXPIRE`: The number of points that expired due to customer inactivity for a configured period.  
  - name: transactionType | type: TransactionType | description: Type of transaction.  
     - enum:
     -     UNKNOWN: Unknown transaction type.
     -     EARN: Number of points earned by a customer taking an action. See [Earn Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/earn-points.md).
     -     REDEEM: Number of points redeemed by a customer for a reward.
     -     ADJUST: Number of points adjusted to a customer's balance. See [Adjust Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/adjust-points.md).
     -     REFUND: Number of points refunded for a previously redeemed reward.
     -     EXPIRE: Number of points that expired due to customer inactivity for a configured period.
     -     EARN_ATTEMPT: Record of an earn attempt that was limited to 0 points.
  - name: description | type: string | description: Transaction description.  | validation: maxLength 100
  - name: idempotencyKey | type: string | description: Unique identifier, generated by the client. Used to recognize repeated attempts of the same request. Only present when manually adding points with [Earn Points](https://dev.wix.com/docs/rest/crm/loyalty-program/accounts/earn-points.md).  | validation: maxLength 128


```

### Examples

### Get loyalty transaction (with elevated permissions)
```javascript
import { transactions } from "@wix/loyalty";
import { auth } from "@wix/essentials";

/* Sample loyaltyTransactionId value:
 *
 * {
 *     "loyaltyTransactionId": "32ec5722-8727-475b-b499-3fe78af3ee99"
 * }
 */

const elevatedGetLoyaltyTransaction = auth.elevate(transactions.getLoyaltyTransaction);

async function getLoyaltyTransaction(loyaltyTransactionId) {
  try {
    const result =
      await elevatedGetLoyaltyTransaction(loyaltyTransactionId);
    return result;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Promise resolves to:
 *
 * {
 *   "_createdDate": "2024-06-06T13:18:13.233Z",
 *   "_id": "32ec5722-8727-475b-b499-3fe78af3ee99",
 *   "accountId": "d0dc5ba3-4a10-4cfc-b304-c976d8ac7303",
 *   "amount": 20,
 *   "description": "Refund",
 *   "idempotencyKey": "32ec5722-8727-475b-b499-3fe78af3ee99",
 *   "transactionType": "REFUND",
 *   "refundInfo": {
 *     "appId": "553c79f3-5625-4f38-b14b-ef7c0d1e87df"
 *   }
 * }
 */
```

### Get loyalty transaction
```javascript
import { transactions } from "@wix/loyalty";

/* Sample loyaltyTransactionId value:
 *
 * {
 *     "loyaltyTransactionId": "32ec5722-8727-475b-b499-3fe78af3ee99"
 * }
 */

async function getLoyaltyTransaction(loyaltyTransactionId) {
  try {
    const result =
      await transactions.getLoyaltyTransaction(loyaltyTransactionId);
    return result;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/* Promise resolves to:
 *
 * {
 *   "_createdDate": "2024-06-06T13:18:13.233Z",
 *   "_id": "32ec5722-8727-475b-b499-3fe78af3ee99",
 *   "accountId": "d0dc5ba3-4a10-4cfc-b304-c976d8ac7303",
 *   "amount": 20,
 *   "description": "Refund",
 *   "idempotencyKey": "32ec5722-8727-475b-b499-3fe78af3ee99",
 *   "transactionType": "REFUND",
 *   "refundInfo": {
 *     "appId": "553c79f3-5625-4f38-b14b-ef7c0d1e87df"
 *   }
 * }
 */ 

```

### getLoyaltyTransaction (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { transactions } from '@wix/loyalty';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { transactions },
  // Include the auth strategy and host as relevant
});


async function getLoyaltyTransaction(loyaltyTransactionId) {
  const response = await myWixClient.transactions.getLoyaltyTransaction(loyaltyTransactionId);
};
```

---