Documentation
Everything you need to integrate MRRX into your application.
Quick Start
Sign up and connect Stripe
Create your MRRX account and securely connect your Stripe account via OAuth.
Create account →Get your API key
Generate an API key from your dashboard under Settings → API Keys.
Create a cancellation session
When a user clicks 'Cancel Subscription' in your app, create a session and redirect them.
// Your cancel subscription handler
async function handleCancel(customerId, subscriptionId) {
const response = await fetch('https://api.mrrx.app/v1/sessions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
customer_id: customerId,
subscription_id: subscriptionId,
return_url: 'https://yourapp.com/account',
}),
});
const { url } = await response.json();
// Redirect user to MRRX cancellation flow
window.location.href = url;
}Handle the return
After the user completes the flow, they're redirected to your return_url with the outcome.
// Your return URL handler
async function handleReturn(sessionId) {
const response = await fetch(
`https://api.mrrx.app/v1/sessions/${sessionId}`,
{
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
}
);
const session = await response.json();
// session.outcome?.action: 'pause' | 'discount' | 'cancel'
if (session.outcome?.action === 'cancel') {
// Subscription was canceled
} else {
// Subscription was saved!
}
}API Reference
POST
/v1/sessionsCreate a new cancellation sessionGET
/v1/sessions/:idGet session status and outcomeGET
/v1/healthCheck API health statusFramework Examples
Next.js
App Router & Pages Router
Express
Node.js with Express
Ruby on Rails
Rails controller example
Python / Django
Django view example
Webhooks
Receive real-time notifications when events occur. Configure webhook endpoints in your dashboard under Settings → Webhooks.
Available Events
session.completedSession completed (saved or canceled)subscription.pausedSubscription was pausedsubscription.discount_appliedDiscount was appliedsubscription.canceledSubscription was canceled