UseePay Open API
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
  1. Embedded Checkout
  • Integration
    • Welcome to the UseePay Demo Page
    • About Payment Methods
      • Card
      • Apple Pay Web Integration (API Integration)
      • Apple Pay(Hosted Checkout)
      • Google Pay
      • Klarna
      • Naver pay
      • Kakao Pay
      • Toss Pay
      • Payco
      • Affirm
      • Blik
      • trustly
      • Cashapp
    • subscription
      • Get started with Subscription
    • online payment
      • Get started with online payments
    • Payment Capabilities
      • Adaptive Price
      • Supported Payment Methods for Checkout
    • checkout session
      • Checkout Session Guide
  • developer
    • Introduction
    • Authentication
    • Errors
    • error code
      • last_payment_error documentation
    • Best Integration
      • Quickly create a paymentIntent for a subscription
      • Auto-Charge Subscription Guide
    • Payment Intents
      • Payment Intent Overview
      • Quickly create a paymentIntent
      • Create a PaymentIntent
      • Retrieve a PaymentIntent
      • Update a PaymentIntent
      • Confirm a PaymentIntent
      • Cancel a PaymentIntent
      • Capture a PaymentIntent
      • List all payment intents
    • Customers
      • Create a customer
      • Retrieves a customer
      • Update a customer
      • List all customers
    • Subscriptions
      • Create a subscription
      • Retrieves a subscription
      • Update a subscription
      • List all subscriptions
      • Cancel a subscription
    • Invoices
      • Create a invoice
      • Retrieves a invoice
      • List all invoices
      • Pay a invoice
    • Payment Methods
      • Create a payment method
      • Retieve Payment Method Session
      • Retrieves a payment method
      • Update a payment method
      • List all payment methods
    • Mandates
      • Create a mandate
      • Retrieves a mandate
      • List all mandates
    • Refunds
      • Create a refund
      • Retrieves a refund
      • List all refunds
    • Webhooks
      • Webhook events
      • Webhook Activation/Signature Verification Steps
      • Webhook Events Documentation (testing)
      • Create a webhook
      • Retrieves a webhook
      • Update a webhook
      • List all webhooks
    • Embedded Checkout
      • Payment Element
      • Payment Element (Deferred Intent)
      • Express Checkout Element
      • Checkout Session Element
    • case
    • objects
    • About Testing
      • Test Cards
      • ApplePay&GooglePay
    • Payment Method Configuration
      • Retieve Payment Method Configuration
    • Checkout Session
      • Create Checkout Session
      • Retrieve Checkout Session
    • Trackers
      • upload trackers
      • Retrieve a tracker
    • Schemas
      • CheckoutSessionCreateRequest
      • LineItem
      • Customer
      • Address
      • ProductData
      • Shipping
      • SubscriptionData
      • Error
      • DiscountPeriodConfig
      • DeviceData
      • CheckoutSessionResponse
      • ErrorResponse
      • Order
      • Product
      • PaymentMethodOptions
      • RiskControlOptions
      • Mandate
      • PaymentIntent
      • PaymentMethod
      • Billing
      • Card
      • AliPay
      • Wallet
      • Klarna
      • WechatPay
      • Refund
      • Subscription
      • Recurring
      • PriceData
      • SubscriptionItem
      • Invoice
      • NextAction
      • Webhook
      • CollectableOptions
      • PaymentLink
      • last_payment_error
      • discount_period_config
      • CreatePaymentIntentRequest
  • message
    • Messaging Element
  • FAQ
    • Unable to receive Webhook notifications
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
UseePay PortalMechant Dashboard
Product Docs
Product Docs
  • V2.0
  • V1.0
  1. Embedded Checkout

Payment Element (Deferred Intent)

Overview#

Payment Element is an integrated payment interface component that supports multiple payment methods (credit cards, debit cards, Apple Pay, Google Pay, etc.). It provides a unified interface to collect customer payment information, simplifying payment flow integration.

Payment Flow Diagram#

┌─────────────────────────────────────────────────────────────┐
│  1. Page Load - Initialize UseePay SDK                      │
│     UseePay(publicKey) → elements(options)                  │
└────────────────────────┬────────────────────────────────────┘
                         ↓
┌─────────────────────────────────────────────────────────────┐
│  2. Create and Mount Payment Element                        │
│     elements.create('payment', options)                     │
│     paymentElement.mount(domId)                             │
└────────────────────────┬────────────────────────────────────┘
                         ↓
┌─────────────────────────────────────────────────────────────┐
│  3. ready Event Triggered                                   │
│     → Payment Element is Ready                              │
└────────────────────────┬────────────────────────────────────┘
                         ↓
┌─────────────────────────────────────────────────────────────┐
│  4. Customer Fills Payment Information                      │
│     → Select payment method (card, Apple Pay, Google Pay)   │
│     → Fill required information                             │
└────────────────────────┬────────────────────────────────────┘
                         ↓
┌─────────────────────────────────────────────────────────────┐
│  5. Customer Clicks Pay Button                              │
│     → Call elements.submit() to validate form               │
└────────────────────────┬────────────────────────────────────┘
                         ↓
         ┌───────────────┴───────────────┐
         │  Validation Passed?            │
         └───────┬───────────────┬───────┘
                 │ No             │ Yes
                 ↓               ↓
    ┌──────────────────┐  ┌──────────────────────┐
    │ Show validation  │  │ 6. Call backend API   │
    │ errors, let      │  │    Create payment     │
    │ customer correct │  │    intent, return     │
    └──────────────────┘  │    paymentIntentId    │
                          │    and clientSecret   │
                          └──────────┬───────────┘
                                     ↓
                          ┌──────────────────────┐
                          │ 7. Confirm Payment    │
                          │ useepay.confirmPayment│
                          └──────────┬───────────┘
                                     ↓
                  ┌──────────────────┴──────────────────┐
                  │  Payment Result                      │
                  └──────┬───────────────────┬──────────┘
                         │ Success            │ Failure
                         ↓                   ↓
              ┌──────────────────┐  ┌──────────────────┐
              │ 8a. Redirect to  │  │ 8b. Show error   │
              │     success page │  │     message, let │
              │                  │  │     customer retry│
              └──────────────────┘  └──────────────────┘

Quick Start#

Step 1: Include SDK#

Include the UseePay SDK in your HTML page:
The sdk url for the production environment has not been launched yet. Below is the address for the sandbox environment

Step 2: Verify SDK Loading#

Before using the SDK, verify that it has loaded successfully:
Best Practices:
Check if SDK is loaded in window.onload or DOMContentLoaded event
If SDK fails to load, display a friendly error message to the user
Consider adding retry mechanism or fallback options

Step 3: Initialize SDK#

Initialize UseePay with your public key generated from the MC merchant dashboard:
Public Key Format:
Production Environment: Starts with UseePay_PK_ (e.g., UseePay_PK_1234567890abcdef...)
Test Environment: Starts with UseePay_PK_TEST_ (e.g., UseePay_PK_TEST_1234567890abcdef...)
⚠️ Important: Please obtain the correct public key from the MC management dashboard. Never use test public keys in production environment.

Step 4: Create Elements Instance#

Initialize Elements to manage the payment interface:

Creating Payment Element#

Basic Setup#

Configuration Options#

Elements Instance Options#

When creating an Elements instance, you can configure the following options:
ParameterTypeRequiredDescription
modeStringYesPayment mode, options: 'payment' (one-time payment) or 'subscription' (subscription payment)
amountNumberYesPayment amount (actual amount)
currencyStringYesCurrency code (e.g., 'USD', 'EUR', 'CNY')
paymentMethodTypesArrayNoArray of available payment method strings. Options include: 'card' (credit/debit card), 'apple_pay' (Apple Pay), 'google_pay' (Google Pay), etc. If not provided, all supported payment methods will be displayed
paymentMethodTypes Examples:

Payment Element Options#

ParameterTypeRequiredDescription
applePayObjectNoApple Pay specific configuration options. Required when mode is 'subscription'

ApplePay Object#

Apple Pay specific configuration for advanced features like subscription payments.
📖 Detailed Parameter Documentation
For detailed parameters and configuration for Apple Pay recurring payments, please refer to Apple's official documentation:
Apple Pay on the Web - Recurring Payments
ParameterTypeRequiredDescription
recurringPaymentRequestObjectNoRecurring payment request configuration for subscription-type payments

recurringPaymentRequest Object#

ParameterTypeRequiredDescription
paymentDescriptionStringYesPayment description explaining the purpose of this recurring payment to the customer
managementURLStringYesManagement URL where customers can manage their subscription
regularBillingObjectYesRegular billing configuration
billingAgreementStringNoBilling agreement text

regularBilling Object#

ParameterTypeRequiredDescription
amountNumberYesRecurring payment amount (actual amount)
labelStringYesBilling label, the billing item name displayed to the customer
recurringPaymentStartDateDateYesRecurring payment start date
recurringPaymentEndDateDateYesRecurring payment end date
recurringPaymentIntervalUnitStringYesRecurring payment interval unit, options: 'year', 'month', 'day', 'hour', 'minute'
recurringPaymentIntervalCountNumberYesRecurring payment interval count, e.g., 2 for every 2 months

Configuration Examples#

Basic Configuration Example (One-time Payment)#

Subscription Payment Configuration Example#

When using mode: 'subscription', you must configure Apple Pay's recurring payment functionality:

Methods#

mount(domId)#

Mounts the payment element to a DOM element.
Parameters:
domId (String): The ID of the DOM element where the component should be mounted

unmount()#

Removes the payment element from the DOM.

update(options)#

Dynamically updates the payment element's configuration options.
Parameters:
options (Object): Update options
applePay (Object, optional): Apple Pay specific configuration updates

Events#

Payment Element emits events that you can listen to for handling user interactions.

ready#

Triggered when the payment element is fully loaded and ready for interaction.
Event Parameters:
event (Object): Event object

Elements Methods and Events#

elements.update(options)#

Dynamically updates the Elements instance configuration.
Parameters:
options (Object): Update options
mode (String, optional): Payment mode ('payment' or 'subscription')
amount (Number, optional): Payment amount
currency (String, optional): Currency code
paymentMethodTypes (Array, optional): Array of available payment method strings, e.g., ['card', 'google_pay']

elements.on('update-end')#

Triggered when Elements update is complete.

elements.submit()#

Submits and validates the payment form. This method must be called for validation before creating a payment intent.
Return Value:
ParameterTypeDescription
selectedPaymentMethodStringThe payment method selected by the customer (e.g., 'card', 'apple_pay', 'google_pay')
errorObjectError information object, null if validation succeeds
error Object:
ParameterTypeDescription
typeStringError type
messageStringError message
Possible error.type Values:
ValueDescription
no_select_payment_methodNo payment method selected
validation_errorForm validation error (e.g., invalid card number, missing required fields)
google_pay_cancelGoogle Pay payment was cancelled
apple_pay_cancelApple Pay payment was cancelled

useepay.confirmPayment()#

Confirms the payment and completes the transaction.
Parameters:
ParameterTypeRequiredDescription
elementsElementsYesElements instance
paymentIntentIdStringYesPayment intent ID returned from backend API
clientSecretStringYesClient secret returned from backend API
Return Value:
ParameterTypeDescription
paymentIntentObjectPayment intent object (when payment succeeds)
errorObjectError information object (when payment fails)

Complete Payment Flow#

Complete Payment Example#

Complete Integration Example#

Important Notes#

1.
Subscription Payments: When mode is 'subscription', you must provide the applePay configuration when creating the Payment Element.
2.
Form Validation: Before creating a payment intent, always call elements.submit() for form validation.
3.
Error Handling: Always check the error object in the return values of submit() and confirmPayment().
4.
Security:
Never hardcode payment amounts on the client side
Always create payment intents on the server side
Use the correct public key for your environment
5.
User Experience:
Display loading status during payment process
Provide clear error messages
Redirect to confirmation page after successful payment
Modified at 2026-02-04 03:54:36
Previous
Payment Element
Next
Express Checkout Element
Built with