This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Charges a membership for an item it covers.
Wix calls this method when an order is placed and a membership was selected to pay for one of its items, once per item the membership pays for.
Wix uses the returned transactionId to reference the charge later, in particular to void it if
the order is canceled or refunded.
Your implementation should:
idempotencyKey as the identity of the charge: when you receive a key you've already
processed, report MEMBERSHIP_ALREADY_CHARGED rather than deducting the balance twice.Error handling: Report a membership that doesn't apply to the item as
MEMBERSHIP_DOES_NOT_APPLY_TO_ITEM, and one that applies but can't currently be charged, such as
a membership without enough credits, as MEMBERSHIP_CANNOT_BE_CHARGED. An error prevents the
order from being paid with this membership.