> 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`). > - 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/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"`. - name: appId | type: string | description: GUID of the app that generated the earned points. - name: activityType | type: string | description: Activity type. - name: orderId | type: string | description: Order GUID. - name: limitApplied | type: boolean | description: Whether the points amount was adjusted by an earn points limit provider. - name: redeemInfo | type: RedeemInfo | description: Information on points redeemed. - name: rewardId | type: string | description: GUID of the reward that was redeemed. - name: rewardType | type: string | description: Type of reward that was redeemed. - 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`. - name: adjustInfo | type: AdjustInfo | description: Information on points adjusted. - name: appId | type: string | description: GUID of the app that initiated the points adjustment. - 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. - name: refundedTransactionId | type: string | description: GUID of the transaction that was refunded. - 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. - name: activityType | type: string | description: Activity type. - name: orderId | type: string | description: Order GUID. - name: id | type: string | description: Transaction GUID. - name: accountId | type: string | description: Account GUID. - name: createdDate | type: string | description: Date and time the transaction was created. - 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. - 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). ``` ### Examples ### Get loyalty transaction ```curl curl -X GET \ 'https://www.wixapis.com/loyalty-transactions/v1/loyalty-transactions/18ddc2a5-248b-47ac-8ec0-603550f1f6b9' \ -H 'Authorization: ' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.accounts.LoyaltyTransactions.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 Return type: PROMISE - 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"`. - name: appId | type: string | description: GUID of the app that generated the earned points. - name: activityType | type: string | description: Activity type. - name: orderId | type: string | description: Order GUID. - name: limitApplied | type: boolean | description: Whether the points amount was adjusted by an earn points limit provider. - name: redeemInfo | type: RedeemInfo | description: Information on points redeemed. - name: rewardId | type: string | description: GUID of the reward that was redeemed. - name: rewardType | type: string | description: Type of reward that was redeemed. - 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`. - name: adjustInfo | type: AdjustInfo | description: Information on points adjusted. - name: appId | type: string | description: GUID of the app that initiated the points adjustment. - 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. - name: refundedTransactionId | type: string | description: GUID of the transaction that was refunded. - 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. - name: activityType | type: string | description: Activity type. - name: orderId | type: string | description: Order GUID. - name: _id | type: string | description: Transaction GUID. - name: accountId | type: string | description: Account GUID. - name: _createdDate | type: Date | description: Date and time the transaction was created. - 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. - 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). ``` ### 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-hosted) Self-hosted 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); }; ``` ---