Build payments into your product with TPE virtual. Start integrating →
Logo

Build a form

Define the data you want from the payer and attach the form to payment links.

A form is a reusable set of fields the payer fills in at checkout, such as a name or an order reference. Forms are optional: a payment link without a form asks only for the payment. Your token needs the forms:write scope.

  1. Create the form. It's ready to use as soon as you create it.

    curl -X POST https://api.mytpe.app/api/ext/forms \
      -H "Authorization: Bearer $MYTPE_ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{ "name": "Checkout details" }'
  2. Optional: add a section to group fields. Text fields hold one value per locale.

    curl -X POST https://api.mytpe.app/api/ext/forms/your-form-id/sections \
      -H "Authorization: Bearer $MYTPE_ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{ "title": { "en": "Delivery", "fr": "Livraison" }, "position": 1 }'
  3. Add the fields. input_name starts with a lowercase letter, and uses only lowercase letters, digits and underscores.

    curl -X POST https://api.mytpe.app/api/ext/forms/your-form-id/fields \
      -H "Authorization: Bearer $MYTPE_ACCESS_TOKEN" \
      -H "Content-Type: application/json" \
      -d '{
        "input_name": "full_name",
        "label": { "en": "Full name", "fr": "Nom complet" },
        "data_type": "string",
        "is_required": true
      }'

    A choice field (select, multi_select, radio or checkbox) also needs options.

  4. Attach the form by sending its ID as form_id when you create a payment link.

When a payer submits, MyTPE stores the answers encrypted, with a snapshot of the form. Later edits don't change past submissions. MyTPE then sends a form.submitted webhook event.

For every field, see Forms.

On this page

No Headings