Skip to content

feat: add wallet customizations for each wallets#1565

Merged
ArushKapoorJuspay merged 6 commits into
mainfrom
feat/wallets-config
May 14, 2026
Merged

feat: add wallet customizations for each wallets#1565
ArushKapoorJuspay merged 6 commits into
mainfrom
feat/wallets-config

Conversation

@aritro2002

@aritro2002 aritro2002 commented May 14, 2026

Copy link
Copy Markdown
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Adds support for per-wallet button style configuration objects for Apple Pay, Google Pay, and PayPal, while maintaining full backward compatibility with the existing shared wallets.style string-based API.
What changed
New per-wallet config objects
Merchants can now pass a config object for each wallet instead of (or alongside) the existing "auto" / "never" string:

wallets: {
  applePay: {
    display: "auto",
    buttonStyle: "black",       // "black" | "white" | "white-outline"
    buttonType: "buy",          // "default" | "plain" | "buy" | "donate" | ...
    height: 48,
    buttonRadius: 4,
  },
  googlePay: {
    display: "auto",
    buttonColor: "black",       // "default" | "black" | "white"
    buttonType: "buy",
    buttonBorderType: "rounded",
    buttonRadius: 4,
  },
  payPal: {
    display: "auto",
    color: "gold",              // "gold" | "blue" | "silver" | "black" | "white"
    shape: "rect",             // "rect" | "pill" | "sharp"
    label: "paypal",
    height: 48,
    borderRadius: 4,
  },
}

Fallback chain
If a field is omitted from a per-wallet config object, it falls back to the shared wallets.style value, then to the SDK default. The existing string form ("auto" / "never") continues to work unchanged.
Type-safe variant names
Wallet field types are now named GooglePayConfigString / GooglePayConfigObj, PaypalConfigString / PaypalConfigObj, ApplePayConfigString / ApplePayConfigObj for clarity.
Apple Pay

  • All official -apple-pay-button-type CSS values supported ("default", "plain", "buy", "check-out", "add-money", "top-up", etc.)
  • Default variant added for backward compatibility
  • Continue type removed (not part of the official Apple Pay on the Web spec)
  • buttonStyle and buttonType are non-optional with sane defaults
    Google Pay
  • buttonColor, buttonType, buttonBorderType as typed enums with defaults
  • buttonRadius as option (omitted from JS object when not set)
  • GPayDefaultBorder omits the key from the JS object entirely
    PayPal
  • color, layout, shape, label as typed enums with defaults
  • height and borderRadius fall back to shared style values
  • disableMaxWidth hardcoded to true (always applied, not configurable)
  • PayPal SDK style record passed directly — no Obj.magic serialization
    Files changed
    File Change
    src/Types/PaymentType.res New enum types, config records, variant types, decoders
    src/Types/PaypalSDKTypes.res style record updated; styleToJson removed
    src/Payments/ApplePay.res Per-wallet config resolution with shared style fallback
    src/Payments/GPay.res Per-wallet config resolution with enum-to-string switches
    src/Payments/PayPal.res Per-wallet config resolution
    src/Payments/PaypalSDK.res Per-wallet config resolution with shared style fallback
    src/Payments/PaypalSDKHelpers.res ~buttonStyle typed as PaypalSDKTypes.style
    src/Utilities/PaymentUtils.res Updated variant pattern matches
    src/hyper-loader/Elements.res Updated variant pattern matches; Apple Pay Never check

How did you test it?

  wallets: {
    walletReturnUrl: window.location.origin,
    // applePay: "auto",
    applePay: {
      display: "auto", // "auto" | "never"  (required if using object form)
      // Button style — overrides theme-derived color
      buttonStyle: "white-outline", // "black" | "white" | "white-outline"
      // Button label type (official Apple Pay on the Web values)
      buttonType: "topup", // "plain" | "buy" | "donate" | "set-up" | "book" | "check-out" | "subscribe" | "add-money" | "contribute" | "order" | "reload" | "rent" | "support" | "tip" | "top-up" |

      // Button height in px — overrides shared style.height
      height: 48,
      // Border radius in px — overrides shared style.buttonRadius
      buttonRadius: 40,
    },
    // googlePay: "auto",
     googlePay: {
      display: "auto", // "auto" | "never"  (required if using object form)
      // Button color — overrides theme-derived color
      buttonColor: "default", // "default" | "black" | "white"
      // Button type — controls the label shown on the button
      buttonType: "subscribe", // "book" | "buy" | "checkout" | "donate" | "order" | "pay" | "plain" | "subscribe"
      // Button height in px — overrides shared style.height
      height: 48,
      // Border radius in px — overrides shared style.buttonRadius
      buttonRadius: 40,
      // Button border type
      buttonBorderType: "no_border", // "no_border" | "shadow" | "stroke"
    },
    payPal: {
      display: "auto", // "auto" | "never"  (required if using object form)
      // Button color — overrides theme-derived color
      color: "white", // "gold" | "blue" | "silver" | "black" | "white"
      // Button label — overrides shared style.type
      label: "paypal", // "paypal" | "checkout" | "buynow" | "pay" | "installment"
      // Button height in px 
      height: 48,

      borderRadius: 40, // is given more priority over shape
      shape: "pill", // "rect" (default) | "pill" | "sharp"
    },
    style: {
      theme: "dark",
      type: "default",
      height: 55,
    },
  },
  
image

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

@semanticdiff-com

Copy link
Copy Markdown

Review changes with  SemanticDiff

@github-actions

Copy link
Copy Markdown
Contributor

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@aritro2002 aritro2002 linked an issue May 14, 2026 that may be closed by this pull request
@ArushKapoorJuspay ArushKapoorJuspay merged commit 9583f7d into main May 14, 2026
11 of 12 checks passed
@ArushKapoorJuspay ArushKapoorJuspay deleted the feat/wallets-config branch May 14, 2026 22:30
@github-actions github-actions Bot added the Closed Label will be automatically added when the PR will get merged to main label May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Closed Label will be automatically added when the PR will get merged to main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add wallet customizations for each wallets

2 participants