Skip to content

Tempo HTML payment script should respect text.pay config #335

@starc007

Description

@starc007

Description

The Tempo payment method's built-in HTML script hardcodes the pay button as "Continue with {Tempo SVG logo}" and ignores the text.pay config that the server correctly passes through Html.init.

Current behavior

// src/tempo/server/internal/html/main.ts:76
button.innerHTML = 'Continue with <svg aria-label="Tempo" ...>...</svg>'

Setting text.pay has no effect on the button:

tempo.charge({
  html: {
    text: { pay: "Buy Now" }
  }
})
// Button still shows "Continue with {Tempo logo}"

Expected behavior

The button text should update when text.pay is set, while preserving the default "Continue with {Tempo logo}" when no override is provided.

What works

The data pipeline is correct. Verified each step:

  1. Charge.ts passes text to the html options
  2. Mppx.ts:938 serializes text (including pay) into the page's JSON data
  3. Html.init exposes it as c.text.pay on the context
  4. main.ts ignores c.text.pay entirely

Other text fields work correctly:

  • text.title > <title> tag
  • text.paymentRequired > badge label in header
  • text.expires > expiry prefix

Design question

The tricky part is the default behavior. Right now the default button has the Tempo SVG logo baked in. A few options:

  1. Always show {text.pay} {logo} so custom text still gets the logo ("Buy Now {logo}")
  2. Show logo only for the default, plain text for custom. But there's no clean way to distinguish "user set pay to 'Pay'" from "default 'Pay'" on the client side without adding a flag
  3. Pass a config flag like config.customPayText from the server so the client knows whether to use the branded layout or plain text

Would love to hear the thoughts on this. Happy to open a PR once there's alignment on the approach.

Context

Found while building the MPP Playground HTML builder, which lets developers customize the payment page visually. All other text overrides work, only the button text doesn't update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions