A simple Express application for testing PayMe payment integration in iframes.
The application makes direct API calls from the frontend to the PayMe API endpoint you configure. The request includes:
{
"seller_payme_id": "your_configured_id",
"sale_price": "100",
"currency": "ILS",
"product_name": "Test Product",
"language": "en",
"sale_payment_method": "multi",
"sale_type": "sale"
}The PayMe API returns:
{
"status_code": 0,
"sale_url": "https://...",
"payme_sale_id": "SALE...",
"payme_sale_code": 16,
"price": 100,
"currency": "ILS",
"sale_payment_method": "multi",
"session": "..."
}Returns Apple Pay domain verification certificate.
Form for sale generation with two payment options:
- Generate Sale: Standard payment flow
- Apple Pay: Apple Pay payment flow
Calls core endpoint and renders "sale_url" from response in iframe
Creates an Apple Pay sale and renders the Apple Pay payment page with:
- Apple Pay SDK integration
- PayMe SDK integration
- Apple Pay button
- Payment flow handling
Renders CORE_API_URL/sale/generate/{saleId} directly in an iframe without any API calls
Configuration form for the Hosted Fields tokenization test (see below).
Renders the live Hosted Fields page that runs the PayMe SDK tokenization flow
(PayMe.create → hostedFields().create()/mount() → tokenize()) with the chosen
configuration.
Exercises the SDK's core PCI flow — the part not covered by the hosted sale page or the Apple/Google Pay flows. From the home page (with defaults set) click Hosted Fields.
- Card fields to mount as iframes:
cardNumber,cardExpiration,cvc(all on by default — needed for a card token). - Payer fields to optionally mount as hosted iframe inputs: first/last name, email, phone, social ID, zip code.
- Payer values passed to
tokenize()for any payer field not mounted as a hosted field (prefilled with sample values; clear one to test required-field validation errors). - Tokenize total: amount, currency, item label, and language (en/he).
- Uses the MPL (
seller_payme_id) as thePayMe.create()auth token, the same way the SDK's ownfully-featuredexample does. - Passes
testModeand (in test mode)apiUrltocreate(), so multi-env routing is exercised against the configured server. - Mounts the selected fields and wires their events:
validity-changed/keyupdrive inline per-field validation messages, andcard-type-changedshows the detected card brand — useful for testing the card validators. - Tokenize button calls
instance.tokenize()and shows the full token result (success) or the field-keyed error object (failure) plus a live event log. - Teardown button calls
instance.teardown()to verify cleanup.
Note: card entry and the final tokenization require a real MPL and a (test) card number, so the actual submit is a manual step. To validate a staging SDK build, enable Use staging SDK URL in the home-page defaults.
- Apple Pay Merchant ID: Contact PayMe Partners (partners@payme.io) to get your merchant ID
- PayMe API Key: Get this from your PayMe dashboard Settings page
- Domain Verification Certificate: Obtain the Apple Pay certificate content
Add the following variables to your .env file:
# PayMe API Configuration
CORE_API_URL=https://your-payme-api-url.com
DEFAULT_SELLER_PAYME_ID=your-seller-id
# PayMe API Key (required for Apple Pay)
PAYME_API_KEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
# Test Mode (set to 'true' for test environment)
PAYME_TEST_MODE=true
# Apple Pay Configuration
APPLE_PAY_MERCHANT_ID=merchant.paymeproduction
APPLE_PAY_CERTIFICATE=your-apple-pay-certificate-content
# Server Configuration
PORT=3000-
The application automatically serves the Apple Pay domain association file at:
/.well-known/apple-developer-merchantid-domain-association -
Contact PayMe Partners (partners@payme.io) after deploying to verify your domain was approved by Apple
- User fills in the payment form at
/generate-sale-form - User clicks the Apple Pay button
- Backend creates a sale with
sale_payment_method: "apple-pay" - User is redirected to the Apple Pay payment page
- Page checks Apple Pay availability on the device
- PayMe SDK initializes the Apple Pay session
- User completes payment using Apple Pay
- Payment status is displayed in real-time
Requirements for Testing:
- macOS with Safari browser, or
- iOS device with Safari, or
- Any device with Apple Pay enabled
Steps:
- Ensure all environment variables are configured
- Start the server:
npm start - Navigate to
/generate-sale-form - Fill in the payment details
- Click Apple Pay button
- The Apple Pay payment page will check device compatibility
- If supported, the Apple Pay button will appear
- Click the Apple Pay button to test the payment flow
Console Logging: The Apple Pay page includes a detailed console log that shows:
- Apple Pay availability checks
- SDK initialization steps
- Payment flow progression
- Any errors or issues
"Apple Pay is not available on this device"
- Apple Pay requires a compatible device (Mac with Touch ID, iPhone, iPad, or Apple Watch)
- Ensure you're using Safari browser
- Check that Apple Pay is enabled in device settings
"PayMe SDK not loaded"
- Check your internet connection
- Verify the PayMe CDN is accessible
- Check browser console for network errors
"Merchant ID not configured"
- Verify
APPLE_PAY_MERCHANT_IDis set in your.envfile - Contact PayMe Partners to ensure your merchant ID is active
"Failed to initialize PayMe"
- Verify
PAYME_API_KEYis correct - Check
PAYME_TEST_MODEmatches your environment - Ensure your API key has Apple Pay permissions