Help Center

Help Center

Search our help center for quick answers.

How can I add custom Metadata?

2 minute read

If you need to pass custom data along with a customer’s purchase/account you can use Plasso’s Metadata feature. Plasso will store any metadata you send and pass that metadata along in our web-hooks and API. We’ll also send metadata to the payment gateway (Stripe/PayPal) for each charge. You’ll also be able to view the metadata from the Plasso dashboard, directly on the Order and/or Subscription dashboard page.

When a customer places an order Plasso creates a few different records that you can store metadata on. You can store metadata on the order record, member record, subscription record, and charge record.

Metadata is limited to 10 keys (per record type), with a 40 character limit for key names. Values are limited to 500 characters. Values can be of type: string, number or boolean

Passing metadata to Plasso will look something like:

metadata: {
  order: { ... },
  member: { ... },
  plans: { ... },
  gateway: { ... }
}

You do not need to specify all these keys (order, member, plans, gateway). They are all optional. You get to decide where you’d like your metadata to be stored.

To store metadata on a subscription record at the time of order, you’ll need to use the plans type and specify your metadata for the desired plan_id. Here is how you can do that:

metadata: {
  order: { ... },
  plans: {
    "my_plan_id": { ... },
    "super_plan_two": { ... }
  }
}

 

Here are descriptions of how metadata is used on each record type:

  • order: Stored and visible in the Plasso dashboard on order record pages.
  • member: Stored and visible in the Plasso dashboard on member record pages.
  • plans: Stored and visible in the Plasso dashboard on subscription record pages. Included in the sent data for any subscription related webhooks.
  • gateway: Stored and sent to the payment processing gateway when charging for an order. If you want to send metadata to Stripe/PayPal for the charge, add it here.

Storefront Cart

To add custom metadata to when using the Storefront Cart, you’ll need to add a metadata parameter to the Plasso.Cart.setup() code snippet. It will end up looking something like:

<script>
  Plasso.Cart.setup({ 
    spaceId: "abc123",
    metadata: {
      order: { ... },
      member: { ... },
      plans: { ... },
      gateway: { ... }
    }
  });
</script>

 

To update the metadata you can use the setMetadata method:

Plasso.Cart.setMetadata({
  order: { ... },
  member: { ... },
  plans: { ... },
  gateway: { ... }
});

Flexkit

To add custom metadata to when using Flexkit, you’ll need to add a form field with the name pl-metadata to your Flexkit order form. You’ll need to JSON Stringify your data before putting it into the value attribute of the pl-metadata field.

JSON.stringify({
  order: { ... },
  member: { ... },
  plans: { ... },
  gateway: { ... }
});

 

An example of the final form field might look like:

<input type="hidden" name="pl-metadata" value='{"order": {"key": "value"}}'>

 

To make this process easier Flexkit has a setMetadata method that will automatically setup/update the pl-metadata field for you. You’ll need to pass the Flexkit ID for the form you want to set metadata on. This can be found in the data-flexkit-id value on the <form> element. Flexkit generates unique IDs for each of your Flexkit forms after it is first run.

Plasso.Flexkit.setMetadata('flexkit_id_here', {
  order: { ... },
  member: { ... },
  plans: { ... },
  gateway: { ... }
});

Was this article helpful?

3 found this helpful.

Can't find your answer?

We want to answer all of your questions. Get in touch and we’ll get back to you as soon as we can. Email us.

Policy questions?

Take a look at our Terms of Service and review our Privacy Policy.