# MemberSpace.conversion

Dispatched after a successful plan signup.

{% hint style="info" %}
This event will be fired for all plan types, including free plans.
{% endhint %}

```javascript
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);
```

The `detail` object of the event contains the following structure:

```javascript
{
  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,
    // currency [ currency code | undefined ] available on non-free plans only
    currency: "usd"
  },
  member: {
    id: 678910,
    name: "John Doe",
    firstName: "John",
    lastName: "Doe",
    email: "john@doe.com",
    stripeCustomerId: "cus_xxxxxxxxxxxxxx",
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.memberspace.com/javascript-api/overview/events/memberspace.conversion.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
