Actions47
- Template Actions
- Communication Actions
- Card Actions
- Create
- Get
- Get All
- Update
- Delete
- Get Balance
- Add Points
- Deduct Points
- Add Amount
- Deduct Amount
- Add Stamps
- Deduct Stamps
- Transfer Points
- Transfer Amount
- Block Card
- Unblock Card
- Generate QR Code
- Get Operations
- Add Visits
- Deduct Visits
- Add Reward
- Deduct Reward
- Receive Reward
- Redeem Coupon
- Set Expiration Date
- Set Membership Tier
- Customer Actions
- Company Actions
- Analytics Actions
- System Actions
Overview
The "Deduct Visits" operation on the Card resource allows you to subtract a specified number of visits from a loyalty card in a digital wallet system. This is useful in scenarios where a customer redeems or uses some of their accumulated visits, such as attending events, appointments, or services tracked by visit counts.
Practical examples include:
- A gym membership card where each visit corresponds to a workout session; deducting visits when a member attends.
- A salon loyalty card that tracks the number of visits; deducting visits after each appointment.
- Any loyalty program where visits are a currency or metric that can be spent or reduced.
This operation ensures accurate tracking and management of visit balances on customer cards.
Properties
| Name | Meaning |
|---|---|
| Amount | The number of visits to deduct from the card (must be a non-negative number with up to 2 decimals). |
| Description | Optional text describing the reason or details for the deduction operation. |
| Transaction ID | Optional unique identifier for the transaction to help with tracking and idempotency. If not provided, one will be generated automatically. |
Output
The output JSON contains the response from the API after deducting visits from the specified card. It typically includes updated card information reflecting the new visit balance and metadata about the transaction.
The exact structure depends on the API response but generally includes fields like:
- Updated visit count on the card.
- Confirmation of the transaction.
- Possibly timestamps and identifiers related to the deduction.
No binary data is involved in this operation.
Dependencies
- Requires an active connection to the Digital Wallet Cards API.
- Needs an API authentication token or API key credential configured in n8n to authorize requests.
- The node uses internal utility functions for making HTTP requests, validating inputs, and formatting responses.
Troubleshooting
- Missing Required Fields: Ensure the
cardIdandamountare provided and valid. The amount must be zero or positive. - Invalid Card ID: If the card ID does not exist or is incorrect, the API will return an error. Verify the card ID before running the operation.
- Insufficient Visits: Attempting to deduct more visits than available may cause an error or rejection by the API.
- Transaction ID Conflicts: If a duplicate transaction ID is used, the API might reject the request or treat it as a duplicate. Use unique IDs or omit to auto-generate.
- API Connectivity Issues: Network problems or invalid credentials will prevent successful execution. Check API keys and network access.
- Error Messages: Errors returned from the API are passed through. Common messages relate to validation failures or authorization errors. Review the message for guidance.
Links and References
- Digital Wallet Cards API Documentation (hypothetical link for reference)
- n8n documentation on Creating Custom Nodes
- General best practices for handling transactions and idempotency in APIs.
If you need details on other operations or resources, feel free to ask!