M2Squared Finance Logo

Integrate M2Square in Minutes

Step-by-step guides to integrate stablecoin payments into your platform. Choose from direct API, SDKs, plugins, or no-code solutions.

Choose Your Integration Method

Direct API Integration

Full control with RESTful APIs

  • Complete API access
  • Custom implementation
  • Maximum flexibility
Advanced

SDKs & Libraries

Pre-built client libraries

  • JavaScript/TypeScript
  • Python
  • Go & PHP
Intermediate

Plugins

Ready-made integrations

  • WooCommerce
  • Shopify
  • Coming soon
Beginner

No-Code Solutions

Dashboard-based setup

  • No programming required
  • Quick setup
  • Limited customization
Beginner

Official SDKs & Libraries

JavaScript/TypeScript

npm install @m2square/sdk
View Documentation

Python

pip install m2square
View Documentation

Go

go get m2square.com/sdk
View Documentation

PHP

composer require m2square/sdk
View Documentation

Step-by-Step Integration Guides

Payment Collection Integration

15 min

Accept payments from customers globally

1. Install SDK2. Configure API keys3. Create payment form4. Handle webhooks
Start Guide

Payout Integration

20 min

Disburse funds to recipients worldwide

1. Set up payout recipients2. Create payout request3. Monitor payout status4. Handle notifications
Start Guide

KYC Verification

10 min

Verify user identities automatically

1. Initiate KYC flow2. Collect user documents3. Submit for verification4. Receive verification status
Start Guide

Real Implementation Examples

Complete Payment Flow Example

// 1. Initialize M2Square SDK
import M2Square from '@m2square/sdk';

const m2square = new M2Square({
  apiKey: process.env.M2SQUARE_API_KEY,
  environment: 'production'
});

// 2. Create a payment
async function processPayment(orderData) {
  try {
    const payment = await m2square.payments.create({
      amount: orderData.amount,
      currency: orderData.currency,
      customer: {
        email: orderData.customerEmail,
        name: orderData.customerName
      },
      metadata: {
        orderId: orderData.id
      },
      returnUrl: 'https://yoursite.com/payment/complete'
    });
    
    return payment;
  } catch (error) {
    console.error('Payment failed:', error);
    throw error;
  }
}

// 3. Handle webhook notifications
app.post('/webhooks/m2square', async (req, res) => {
  const signature = req.headers['m2square-signature'];
  
  // Verify webhook signature
  const event = m2square.webhooks.verify(
    req.body,
    signature,
    process.env.WEBHOOK_SECRET
  );
  
  // Handle different event types
  switch (event.type) {
    case 'payment.completed':
      await handlePaymentCompleted(event.data);
      break;
    case 'payment.failed':
      await handlePaymentFailed(event.data);
      break;
  }
  
  res.json({ received: true });
});

Test in Sandbox Environment

Try all M2Square features risk-free in our sandbox environment. Test credentials and unlimited test transactions included.

Access Sandbox

Need Help with Integration?

Our developer support team is here to help you integrate successfully.