🔧 API Documentation

Powerful Payment APIs

Build advanced payment solutions with our comprehensive APIs. Handle subscriptions, analytics, invoicing, and disputes with enterprise-grade reliability.

Why Developers Love Our API

Built for developers, by developers. Our API is designed to be intuitive, reliable, and powerful.

RESTful API

Clean, intuitive REST API with JSON responses. Easy to understand and implement.

Real-time Webhooks

Get instant notifications for payment events with reliable webhook delivery.

Secure Authentication

API keys with fine-grained permissions and optional OAuth 2.0 support.

Global Infrastructure

99.99% uptime with globally distributed servers for lightning-fast responses.

Advanced API Endpoints

Powerful endpoints for subscriptions, analytics, invoicing, and dispute management

POST/v1/subscriptions

Create a recurring subscription

{
  "customer_id": "cus_9876543210",
  "plan_id": "plan_premium_monthly",
  "amount": 2999,
  "currency": "USD",
  "billing_cycle": "monthly",
  "trial_period_days": 14,
  "metadata": {
    "user_id": "user_abc123",
    "plan_type": "premium"
  }
}
GET/v1/analytics/dashboard

Retrieve analytics dashboard data

{
  "period": "last_30_days",
  "total_revenue": 125000.50,
  "total_transactions": 847,
  "success_rate": 98.3,
  "top_payment_methods": [
    {"type": "card", "percentage": 78.2},
    {"type": "bank_transfer", "percentage": 15.1},
    {"type": "digital_wallet", "percentage": 6.7}
  ],
  "revenue_by_day": [
    {"date": "2025-06-01", "amount": 4200.00},
    {"date": "2025-06-02", "amount": 3800.50}
  ]
}
POST/v1/invoices

Generate and send invoice

{
  "customer_email": "client@business.com",
  "due_date": "2025-07-15",
  "items": [
    {
      "description": "Website Development",
      "quantity": 1,
      "unit_price": 5000.00,
      "tax_rate": 0.08
    },
    {
      "description": "Monthly Hosting",
      "quantity": 12,
      "unit_price": 99.99,
      "tax_rate": 0.08
    }
  ],
  "notes": "Payment due within 30 days"
}
GET/v1/disputes/{id}

Retrieve dispute information

{
  "id": "dp_1234567890",
  "payment_intent": "pi_9876543210",
  "amount": 2500,
  "currency": "USD",
  "reason": "fraudulent",
  "status": "under_review",
  "evidence_due_by": 1687123200,
  "created": 1686518400,
  "metadata": {
    "merchant_response": "pending",
    "customer_contacted": true
  }
}

Enterprise SDKs

Production-ready SDKs with advanced features for modern programming languages

Go

Installation:

go get github.com/mosenpay/mosenpay-go

Example usage:

package main

import (
    "github.com/mosenpay/mosenpay-go"
    "log"
)

func main() {
    client := mosenpay.New("sk_test_...")
    
    subscription, err := client.Subscriptions.Create(&mosenpay.SubscriptionParams{
        CustomerID:       "cus_9876543210",
        PlanID:          "plan_premium_monthly",
        Amount:          2999,
        Currency:        "USD",
        BillingCycle:    "monthly",
        TrialPeriodDays: 14,
    })
    if err != nil {
        log.Fatal(err)
    }
}

Java

Installation:

implementation 'com.mosenpay:mosenpay-java:1.0.0'

Example usage:

import com.mosenpay.MosenPay;
import com.mosenpay.model.Invoice;
import com.mosenpay.param.InvoiceCreateParams;

public class MosenPayExample {
    public static void main(String[] args) {
        MosenPay.apiKey = "sk_test_...";
        
        InvoiceCreateParams params = InvoiceCreateParams.builder()
            .setCustomerEmail("client@business.com")
            .setDueDate("2025-07-15")
            .addItem(InvoiceCreateParams.Item.builder()
                .setDescription("Website Development")
                .setQuantity(1)
                .setUnitPrice(5000.00)
                .setTaxRate(0.08)
                .build())
            .build();
            
        Invoice invoice = Invoice.create(params);
    }
}

C#

Installation:

Install-Package MosenPay.net

Example usage:

using MosenPay;

class Program 
{
    static void Main()
    {
        MosenPayConfiguration.SetApiKey("sk_test_...");
        
        var service = new AnalyticsService();
        var options = new AnalyticsDashboardOptions
        {
            Period = "last_30_days",
            IncludeRevenue = true,
            IncludeTransactions = true
        };
        
        var dashboard = service.GetDashboard(options);
        Console.WriteLine($"Total Revenue: {dashboard.TotalRevenue}");
    }
}

Rust

Installation:

mosenpay = "1.0"

Example usage:

use mosenpay::{Client, DisputeId};
use tokio;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new("sk_test_...");
    
    let dispute_id = DisputeId::from("dp_1234567890");
    let dispute = client
        .disputes()
        .retrieve(&dispute_id)
        .await?;
    
    println!("Dispute status: {:?}", dispute.status);
    Ok(())
}

Quick Start Guide

1

Get API Keys

Create your MosenPay account and generate sandbox & production API keys from your dashboard.

2

Choose Your SDK

Install our enterprise SDK for Go, Java, C#, or Rust with full type safety and async support.

3

Deploy & Scale

Launch your payment infrastructure with webhooks, analytics, and automated dispute handling.