POST

Charge Membership


Developer Preview

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:

  • Deduct the item's redemption cost from the membership's balance and record the charge.
  • Treat 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.

Endpoint
POST
{DEPLOYMENT-URI}/v1/charge-membership
Errors
MembershipDoesNotApplyToItemobjectstatus code: 400
MembershipCannotBeChargedobjectstatus code: 428
MembershipAlreadyChargedobjectstatus code: 409
Did this help?