m2pfintech
Integration Guide

Security Best Practices

Encryption, PCI-DSS compliance, PIN security, webhook verification, and IP whitelisting for M2P integrations.


Encryption Standards

LayerStandardDetails
In TransitTLS 1.3All API calls over HTTPS
At RestAES-256All sensitive data encrypted in storage
PIN ManagementHSM (Thales/Utimaco)Hardware Security Module for PIN operations
Card DataPCI-DSS Level 1Full PAN never exposed in logs or responses
JWT TokensRS256RSA-signed JSON Web Tokens

PCI-DSS Compliance

RequirementImplementation
No PAN in logsCard numbers masked in all system logs
Encrypted storageAll card data encrypted at rest
TokenizationFull card details returned only via dedicated secure endpoint with OTP
Access controlRole-based access with audit trail
Network segmentationCard processing in isolated network zone

Never log or store full card numbers (PAN), CVV, or PIN data in your systems. Use the masked card number (XXXX1234) from API responses for display purposes.


PIN Security

OperationSecurity Measure
Set PINRSA-encrypted before transmission
Change PINRequires current PIN + OTP verification
Validate PINRead-only check, no PIN change
Failed AttemptsAccount locked after max attempts (configurable, default: 3)
PIN StorageHSM-managed, never stored in plaintext

Webhook Security

Verify webhook origin using signature validation:

MethodDetails
IP WhitelistingWhitelist M2P webhook delivery IPs
Signature VerificationValidate X-M2P-Signature header using HMAC-SHA256
HTTPS OnlyOnly HTTPS endpoints accepted
TLS 1.2+Minimum TLS version for webhook endpoints
const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(JSON.stringify(payload))
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

API Security Checklist

CheckRecommendation
Credential storageUse environment variables or secret managers
Token cachingCache JWT tokens, refresh before expiry
Credential rotationRotate API credentials every 90 days
IP whitelistingRegister production server IPs
IdempotencyUse X-Request-ID for duplicate detection
Rate limitingImplement client-side rate limiting
Error handlingNever expose raw error details to end users
Audit loggingLog all API calls with request IDs

On this page