Skip to main content

Create Subscription

Create a pending subscription and redirect the user to the payment page. This endpoint integrates with Dodo Payments to handle the payment process.

📝 Endpoint

📋 Request Body

string
required
The email address for the subscription. This will be used to link the subscription to the user’s account.
string
required
The ID of the product/plan to subscribe to.

📤 Request Example

📥 Response

Success (200 OK)

Error Responses

Invalid Product (400 Bad Request)

Invalid Email (400 Bad Request)

Payment Error (500 Internal Server Error)

🔄 Subscription Flow

1. Create Subscription

2. Redirect to Payment

3. Handle Payment Completion

💳 Available Products

Pro Monthly

Pro Yearly

Enterprise

🔐 Security Features

Payment Security

  • PCI Compliance: All payments processed through Dodo Payments
  • Encryption: Payment data encrypted in transit and at rest
  • Tokenization: Sensitive data tokenized for security

Subscription Security

  • Email Verification: Subscription linked to verified email
  • Session Expiration: Payment sessions expire after 1 hour
  • Fraud Protection: Advanced fraud detection systems

📊 Subscription States

Pending

  • Payment session created
  • Waiting for user to complete payment
  • Expires after 1 hour

Active

  • Payment completed successfully
  • Features enabled for the team
  • Billing cycle started

Canceled

  • Subscription canceled by user
  • Features disabled at end of billing period
  • No further charges

Paused

  • Payment failed or paused
  • Features temporarily disabled
  • Retry payment to reactivate

🛠️ Implementation Examples

React Component

Node.js Server

🔄 Webhook Integration

Payment Success Webhook