Custom attributes

A custom attribute is a field that your organisation defines, for example a campaign id. Repejo stores its value on the payers, subscriptions, receivables and transactions that a checkout creates, and sends it in their metadata.

Create an attribute

  1. Click Settings (Inställningar) in the top menu.
  2. Click Custom attributes (Anpassade attribut) in the left menu.
  3. Click New attribute (Nytt attribut).
  4. In Label, type the name that users see, for example "Kampanj-ID".
  5. In Key (Programnamn), type the key, for example campaign_id. You cannot change the key later.
  6. If the website must set the value on each page with metadata-* attributes, select Public (Publik). The checkout form in Repejo then shows the field as read-only. See "Public attributes in embedded checkout" below.
  7. Click Save (Spara).

Give a checkout a value

You can give a value to an attribute that is not public. The checkout form shows a public attribute as read-only.

  1. Click Checkouts in the top menu.
  2. Open the checkout.
  3. On the Details (Detaljer) tab, click Edit (Ändra).
  4. Type the value in the attribute field at the bottom of the first step.
  5. Click Next (Nästa), then Save (Spara).

Repejo then sends the value in metadata for the payers, subscriptions, receivables and transactions that the checkout creates.

Definition fields

  • label is the name that users see in Repejo (Label).
  • value is the key in metadata and in webhook payloads (Key).
  • public decides whether the embed code on a web page can set the value (Public).

Rules

  • value is unique and can only contain a-z, 0-9, and _. Repejo removes spaces at the ends and makes it lowercase.
  • You cannot change the value after you created the attribute.
  • A value can be at most 1000 characters.
  • Repejo keeps only the keys of defined attributes and values that are strings and not blank.
  • When Repejo creates a payer, subscription, receivable or transaction, its metadata gets every defined custom attribute. An attribute without a value is an empty string "", so the records and the webhook payloads always have the same keys.
  • From a web page, Repejo accepts only attributes that are public. It ignores unknown keys, private keys and values that are too long.

Public attributes in embedded checkout

The embed code can set a public attribute with one HTML attribute for each key. The attribute name starts with metadata-.


        <repejo-checkout
          short_code="my_checkout"
          host="https://app.repejo.se"
          metadata-member_id="12345"
        ></repejo-checkout>

        <repejo-checkout-button
          short_code="my_checkout"
          host="https://app.repejo.se"
          metadata-member_id="12345"
        ></repejo-checkout-button>

        <repejo-sticky-checkout
          short_code="my_checkout"
          host="https://app.repejo.se"
          metadata-member_id="12345"
        ></repejo-sticky-checkout>
      
  • Repejo reads them when the donor's checkout session starts.
  • Repejo stores the accepted values on the session and adds them to the metadata of what the checkout creates.
  • If the page and checkout.metadata have a value for the same key, the value from the page wins for that session.
  • Repejo ignores a key that is not public and logs it.

Metadata lifecycle

  • checkout.metadata gives the default values for the metadata of everything that the checkout creates.
  • The checkout form in Repejo shows a public attribute as read-only.
  • payer.metadata, subscription.metadata, receivable.metadata, and transaction.metadata hold the values from the time Repejo created the record. They contain every defined custom attribute, with an empty string "" for attributes that had no value.
  • You cannot change them later.
  • Repejo copies the metadata from the checkout to the payer and the subscription, and from there to their receivables and transactions.

Completed event

The repejo:completed browser event has a metadata object in its detail.


        type RepejoCompletedEventDetail = {
          checkout_short_code: string;
          type: "recurring" | "onetime" | "gift_card";
          payer: {
            name: string | null;
            phone_number: string | null;
            email: string | null;
          };
          metadata: Record<string, string>;
        };
      
  • Only public attributes are included in detail.metadata.
  • Repejo keeps private attributes on the records, but never puts them in this event.
  • The event shows the values that Repejo accepted, not the raw HTML attributes on the page.