Dispatched after a successful plan signup.
This event will be fired for all plan types, including free plans.
const handleConversion = ({ detail }) => {
const { order, membership, member } = detail;
console.log('order', order);
console.log('membership', membership);
console.log('member', member);
};
document.addEventListener('MemberSpace.conversion', handleConversion);
{
membership: {
id: 13579,
planId: 151,
publicPlanId: "abc123",
name: "Super plan",
// type [ 'free' | 'one_time_payment' | 'subscription' | 'multi_payment' ]
type: "subscription",
createdAt: "2021-03-24T15:31:55Z",
status: "active",
// expiresOn [ ISO-8601 | udnefined ] indicate that a **non-subscription** is
// due to expire at a specific date.
expiresOn: "2022-03-24T15:31:55Z"
// cancelsOn [ ISO-8601 | undefined ] indicates that a recurring
// **subscription** is being cancelled at the billing period end
cancelsOn: "2022-03-24T15:31:55Z",
// billingPeriodEnd [ ISO-8601 | udnefined ] indicates that when the next charge
// on a **subscription or non-completed multi_payment** is due.
billingPeriodEnd: "2021-06-24T15:31:55Z"
paymentFailure: true,
welcomeUrl: "/welcome-to-super-plan",
contentUrl: "/super-plan-content"
},
order: {
id: "string",
subTotal: 12.35,
subTotalCents: 1235,
grandTotal: 12.35,
grandTotalCents: 1235
},
member: {
id: 678910,
name: 'John Doe',
firstName: 'John',
lastName: 'Doe',
email: 'john@doe.com',
stripeCustomerId: 'cus_xxxxxxxxxxxxxx',
}
}