Build payments into your product with MyTPE Pay. Start integrating →
Logo
Get started

Forms

Define the data you want collected at checkout and publish a reusable form to attach to payment links.

A form is a reusable set of fields you collect from the payer at checkout — a name, an order reference, a delivery address, or industry‑specific fields. You build it once, publish it, then attach it to any number of payment links.

Forms are optional. A payment link with no form just collects the amount.

Structure

A form is made of sections and fields. Sections group fields; each field has a data type that controls how it is rendered and validated.

Field data types include string, text, integer, number, email, phone, url, date, select, multi_select, radio, checkbox, and more. The choice types (select, multi_select, radio, checkbox) require an options array. See the full list in Statuses & enums.

Build a form

Create the form

Starts in draft.

curl -X POST https://api.mytpe.appp/api/ext/forms \
  -H "X-Api-Key: $MYTPE_API_KEY" \
  -H "X-Api-Secret: $MYTPE_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Checkout details", "industry": "ecommerce" }'
201 Created
{
  "data": {
    "id": "4f5a6b7c-8d9e-0f1a-2b3c-4d5e6f7a8b9c",
    "name": "Checkout details",
    "status": "draft",
    "sections": [],
    "fields": []
  }
}

Add a section (optional)

curl -X POST https://api.mytpe.appp/api/ext/forms/4f5a.../sections \
  -H "X-Api-Key: $MYTPE_API_KEY" \
  -H "X-Api-Secret: $MYTPE_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "title": "Delivery", "position": 1 }'

Add fields

curl -X POST https://api.mytpe.appp/api/ext/forms/4f5a.../fields \
  -H "X-Api-Key: $MYTPE_API_KEY" \
  -H "X-Api-Secret: $MYTPE_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "input_name": "full_name",
    "label": "Full name",
    "data_type": "string",
    "is_required": true,
    "position": 1
  }'

For a choice field, include options:

{
  "input_name": "wilaya",
  "label": "Wilaya",
  "data_type": "select",
  "is_required": true,
  "options": [{ "value": "16", "label": "Alger" }, { "value": "31", "label": "Oran" }]
}

Publish

Only a published form can be attached to a payment link.

curl -X POST https://api.mytpe.appp/api/ext/forms/4f5a.../publish \
  -H "X-Api-Key: $MYTPE_API_KEY" \
  -H "X-Api-Secret: $MYTPE_API_SECRET"

When a payer submits, MyTPE stores an immutable snapshot of the form together with the answers, so later edits to the form never change past submissions. Submitted values are encrypted at rest, and a form.submitted webhook fires.

→ API: Forms

On this page