Prairie Mountain CollectiveStart Fundraising
← Integrations

Embed API Reference

REST API for embedding team stores on WordPress, Podium HQ, or any platform. All endpoints support CORS for cross-origin requests.

GET /api/embed/:teamSlug

Returns team info, products, and embed URLs as JSON.

curl /api/embed/calgary-u16-ringette

{
  "team": {
    "slug": "calgary-u16-ringette",
    "name": "Calgary U16 Ringette",
    "affiliateCode": "CALGARYU16-ABC123",
    "affiliateUrl": "/team/calgary-u16-ringette?ref=...",
    "affiliateChain": {
      "grandparent": { "tier": "grandparent", "code": "PRAIRIEMOUNTAIN-PMC", "name": "Prairie Mountain Collective" },
      "parent": { "tier": "parent", "code": "PMC-CALGARYRINGETTE-DEMO", "name": "Calgary Ringette Association" },
      "child": { "tier": "child", "code": "CALGARYU16-ABC123", "name": "Calgary U16 Ringette" }
    }
  },
  "products": [
    {
      "id": "...",
      "name": "Honey Jar",
      "priceCents": 1500,
      "priceFormatted": "$15.00",
      "category": "goods"
    }
  ],
  "embed": {
    "iframeUrl": "/embed/calgary-u16-ringette",
    "scriptUrl": "/api/embed/calgary-u16-ringette?format=script",
    "checkoutUrl": "/team/calgary-u16-ringette/shop"
  }
}

GET /api/embed/:teamSlug?format=script

Returns JavaScript that injects an iframe into any element withdata-pmc-store="teamSlug".

POST /api/checkout

Create a checkout session attributed to a team.

POST /api/checkout
Content-Type: application/json

{
  "teamSlug": "calgary-u16-ringette",
  "affiliateCode": "CALGARYU16-ABC123",
  "items": [{ "productId": "...", "quantity": 2 }],
  "customerEmail": "buyer@example.com",
  "embedSource": "wordpress"
}

// Response: { "checkoutUrl": "..." } or { "successUrl": "..." }

GET /api/teams

List all active teams.

POST /api/teams

Register a new team (child affiliate). Optional parentAffiliateCode links the team to a parent organization; PMC is always the grandparent.

POST /api/affiliate-partners

Register a PSO (parent affiliate) with a commission rate.

GET /api/affiliate-partners/:slug

PSO dashboard stats and affiliated clubs.

POST /api/stripe/webhook

Stripe webhook for checkout and subscription renewals. Distributes club and PSO commissions (PSO share is transferred from the club Connect account when both are onboarded).