← All API sections

Billing

Plans, subscriptions, and billing management

4 endpoints
Menu

Endpoints

MethodPathDescription
POST/v1/billing/checkoutCreate a Stripe Checkout session for upgrading to a paid plan. Returns the checkout URL that the client should redirect to.
GET/v1/billing/plansList all available plans with their prices and limits.
POST/v1/billing/portalCreate a Stripe Customer Portal session for managing the subscription. Returns the portal URL.
GET/v1/billing/subscriptionGet the current account's subscription status.

POST /v1/billing/checkout

The first period is charged at checkout; there is no trial. The plan's full sending allowance applies once that payment settles. billing_period is monthly (the default) or annual, and a plan with no annual price is refused for annual rather than checked out monthly.

Request Body

FieldTypeRequiredDescription
billing_periodstring | nullNo"monthly" (default) or "annual"
cancel_urlstringYes
planstringYes
success_urlstringYes

Responses

StatusDescription
200Checkout session created, with the URL to redirect to
401Unauthorized
403No billing access (an API key without account:admin, or a session below admin), or a sub-account, whose billing the parent manages
422Unknown plan or billing_period

Example

curl -X POST https://api.euromail.dev/v1/billing/checkout \
  -H "Authorization: Bearer em_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "cancel_url": "https://yourdomain.com/webhooks/euromail",
  "plan": "...",
  "success_url": "https://yourdomain.com/webhooks/euromail"
}'
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.createBilling({
  cancel_url: "https://yourdomain.com/webhooks/euromail",
  plan: "...",
  success_url: "https://yourdomain.com/webhooks/euromail"
});
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.create_billing(
    cancel_url="https://yourdomain.com/webhooks/euromail",
    plan="...",
    success_url="https://yourdomain.com/webhooks/euromail",
)
use euromail::{EuroMail, CreateBillingParams};

let client = EuroMail::new("em_live_...");

let result = client.create_billing(&CreateBillingParams {
    cancel_url: "https://yourdomain.com/webhooks/euromail".into(),
    plan: "...".into(),
    success_url: "https://yourdomain.com/webhooks/euromail".into(),
    ..Default::default()
}).await?;
client := euromail.NewClient("em_live_...")

result, err := client.CreateBilling(ctx, euromail.CreateBillingParams{
    CancelURL: "https://yourdomain.com/webhooks/euromail",
    Plan: "...",
    SuccessURL: "https://yourdomain.com/webhooks/euromail",
})

GET /v1/billing/plans

List all available plans with their prices and limits.

Responses

StatusDescription
200Available billing plans

Example

curl -X GET https://api.euromail.dev/v1/billing/plans \
  -H "Authorization: Bearer em_live_..."
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.getBilling();
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.get_billing()
use euromail::EuroMail;

let client = EuroMail::new("em_live_...");

let result = client.get_billing().await?;
client := euromail.NewClient("em_live_...")

result, err := client.GetBilling(ctx)

POST /v1/billing/portal

Create a Stripe Customer Portal session for managing the subscription. Returns the portal URL.

Request Body

FieldTypeRequiredDescription
return_urlstringYes

Responses

StatusDescription
200Portal session created, with the URL to redirect to
401Unauthorized
403No billing access (an API key without account:admin, or a session below admin), or a sub-account, whose billing the parent manages
422The account has no Stripe customer yet

Example

curl -X POST https://api.euromail.dev/v1/billing/portal \
  -H "Authorization: Bearer em_live_..." \
  -H "Content-Type: application/json" \
  -d '{
  "return_url": "https://yourdomain.com/webhooks/euromail"
}'
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.createBilling({
  return_url: "https://yourdomain.com/webhooks/euromail"
});
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.create_billing(
    return_url="https://yourdomain.com/webhooks/euromail",
)
use euromail::{EuroMail, CreateBillingParams};

let client = EuroMail::new("em_live_...");

let result = client.create_billing(&CreateBillingParams {
    return_url: "https://yourdomain.com/webhooks/euromail".into(),
    ..Default::default()
}).await?;
client := euromail.NewClient("em_live_...")

result, err := client.CreateBilling(ctx, euromail.CreateBillingParams{
    ReturnURL: "https://yourdomain.com/webhooks/euromail",
})

GET /v1/billing/subscription

Get the current account's subscription status.

Responses

StatusDescription
200Current subscription details
401Unauthorized
403No billing access: an API key without account:admin, or a session below admin

Example

curl -X GET https://api.euromail.dev/v1/billing/subscription \
  -H "Authorization: Bearer em_live_..."
import { EuroMail } from "@euromail/sdk";

const euromail = new EuroMail({ apiKey: "em_live_..." });

const result = await euromail.getBilling();
from euromail import EuroMail

client = EuroMail(api_key="em_live_...")

result = client.get_billing()
use euromail::EuroMail;

let client = EuroMail::new("em_live_...");

let result = client.get_billing().await?;
client := euromail.NewClient("em_live_...")

result, err := client.GetBilling(ctx)