Adds points to a loyalty account.
The earnPoints() function returns a Promise that resolves to the updated loyalty account.
Only a positive amount can be added using the earnPoints() function, to manually adjust an account's balance for a negative amount, use adjustPoints().
The earnPoints() function allows customers to manually earn points to their loyalty accounts. To use this function you must include an appId and an idempotencyKey. Any string can be set as the appId or idempotencyKey. In contrast to when an account earns points through an action taken on your site, the appId automatically sets to the source app that generates the points. The transaction type is "EARN" for points earned this way.
Note: Only visitors with Manage Loyalty permissions can earn loyalty points.
This function requires elevated permissions and runs only on the backend and on dashboard pages.
Loyalty account ID.
Earn points info.
This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.