API Reference
The fype API is organized around REST. All requests should be made tohttps://api.fype.dev/v1.
Payments
Create a Payment
POST /payments
Create a new payment and generate a hosted checkout URL.
Request Body
Headers
Authorization: Bearer <API_KEY>Idempotency-Key: <UNIQUE_STRING>(Optional but recommended)
Retrieve a Payment
GET /payments/{payment_id}
Get the current status and details of a payment.
List Payments
GET /payments
List all payments for your merchant account.
Query Parameters
Refunds
Create a Refund
POST /payments/{payment_id}/refund
Initiate a full or partial refund for a successful payment.
Request Body
Webhook Endpoints
Create Endpoint
POST /webhooks/endpoints
Request Body
List Endpoints
GET /webhooks/endpoints
Delete Endpoint
DELETE /webhooks/endpoints/{endpoint_id}
Toggle Endpoint
POST /webhooks/endpoints/{endpoint_id}/toggle
Enable or disable a webhook endpoint.
List Deliveries
GET /webhooks/deliveries
List recent webhook delivery attempts and their statuses.
Trigger Test Webhook
POST /webhooks/trigger-test
Trigger a simulated payment.succeeded event to your test endpoints.
Providers
Connect Provider
POST /providers/connections
Connect a payment gateway (Razorpay or Cashfree) to your account.
Request Body
List Connections
GET /providers/connections
Delete Connection
DELETE /providers/connections/{connection_id}
Products & Catalog
Create Product
POST /products
Create a new product in the merchant’s catalog.
Request Body
List Products
GET /products
Retrieve all products in your catalog, along with their nested plans and default prices.
Retrieve Product
GET /products/{id}
Retrieve details for a single product.
Create Plan
POST /products/{id}/plans
Create a billing plan (billing cadence/intervals) under a specific product.
Request Body
Retrieve Plan
GET /plans/{id}
Retrieve details of a single billing plan.
Create Price
POST /plans/{id}/prices
Configure a price point for a specific billing plan.
Request Body
Create Entitlement
POST /entitlements
Create a feature authorization gate.
Request Body
List Entitlements
GET /entitlements
Link Entitlement to Product
POST /entitlements/{id}/products
Link a feature gate to a product.
Request Body
Subscriptions
Create Subscription
POST /subscriptions
Creates a new subscription locally, registers it lazily at the payment provider gateway, and registers a checkout session returning the mandate hosted checkout URL.
Headers
Authorization: Bearer <API_KEY>Idempotency-Key: <UNIQUE_STRING>(Optional but recommended to prevent double-mandating)
Retrieve Subscription
GET /subscriptions/{id}
Retrieve the current details, billing periods, trial info, and provider references for a single subscription.
List Subscriptions
GET /subscriptions
Retrieve paginated subscriptions with cursor pagination.
Query Parameters
Pause Subscription
POST /subscriptions/{id}/pause
Temporarily pause an active subscription. Deactivates recurring charging.
Resume Subscription
POST /subscriptions/{id}/resume
Resume charging on a paused subscription.
Cancel Subscription
POST /subscriptions/{id}/cancel
Cancel a subscription.
Query Parameters
Change Subscription Plan (Upgrade/Downgrade)
POST /subscriptions/{id}/change-plan
Upgrade or downgrade a subscription mid-cycle. Calculates proration credits and debits, issues an adjustment invoice/credit-note, and synchronizes the plan with the gateway.
Request Body
Retrieve Subscription Events
GET /subscriptions/{id}/events
Retrieve the state transition history of a subscription.
Retrieve Customer Entitlements
GET /subscriptions/customer/{customer_id}/entitlements
Evaluate and retrieve all active feature gates (entitlements) for a customer across all their active or trialing subscriptions.
Response Body
Offerings & Paywalls
Create Offering
POST /offerings
Request Body
Attach Package to Offering
POST /offerings/{id}/packages
Request Body
Create Package
POST /packages
Request Body
Link Product to Package
POST /packages/{id}/products
Request Body
Create Paywall
POST /paywalls
Request Body
Coupons & Discounts
Create Coupon
POST /coupons
Request Body
Validate Coupon
POST /coupons/validate
Request Body
Metered Billing (Usage)
Report Usage Event
POST /usage/events
Submit consumption event.
Request Body
Retrieve Usage Summary
GET /usage/summary
Retrieve aggregated consumption metrics.
Query Parameters
Growth & Experiments
Create Experiment
POST /experiments
Request Body
Start / Stop Experiment
POST /experiments/{id}/start
POST /experiments/{id}/stop
Toggle running status of A/B test.
Retrieve Experiment Results
GET /experiments/{id}/results
Fetches visitors, conversions, and Bayesian Chance to Win scores.
Resolve Dynamic Offering
POST /offerings/resolve
Resolves the customized paywall and offering matching targeted attributes and bucketing enrollments.
Request Body
Customers
List Customers
GET /customers
Retrieve paginated customer directories for the merchant.
Query Parameters
Retrieve Customer
GET /customers/{id}
Retrieve detailed information about a single customer, including active subscription counts and total lifetime revenue.
Invoices
List Invoices
GET /invoices
Retrieve paginated invoices for the merchant.
Query Parameters
Retrieve Invoice
GET /invoices/{id}
Retrieve detailed information about a single invoice, including CGST, SGST, IGST, and line-item breakdowns.
Billing & Subscription Analytics
Retrieve MRR Metrics
GET /analytics/mrr
Retrieve Monthly Recurring Revenue (MRR) summaries, including active MRR breakdown, upgrades, downgrades, churn, and new additions.
Retrieve Churn Metrics
GET /analytics/churn
Retrieve subscription churn metrics and customer churn rates for current billing periods.
Retrieve Cohort Retention Analysis
GET /analytics/cohorts
Retrieve cohort user retention matrices and heatmaps based on subscription activation dates.
Retrieve Customer LTV Metrics
GET /analytics/ltv
Retrieve customer Lifetime Value (LTV) analytics, average revenue per user (ARPU), and lifetime projections.
Retrieve Quick Ratio
GET /analytics/quick-ratio
Retrieve SaaS Quick Ratio metrics measuring monthly revenue growth efficiency.
Retrieve Autopay Analytics
GET /analytics/autopay
Retrieve success rates and analytics for auto-debit payments and recurring payment mandates.
|