Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>ppe SuiteNew to Visual Studio Code? Get it now.
ppe Suite

ppe Suite

ppe_extension

|
8 installs
| (1) | Free
Advanced integration docs
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PPE VS Code Extension

🤖 NOW AI-POWERED! - Dynamic code generation using GitHub Copilot's Language Model API

A comprehensive VS Code extension for PPE integration with AI-powered code generation, structured slash commands, intelligent detection, and multi-platform support.

✨ What's NEW: AI-Powered Code Generation

🤖 Dynamic AI Code Generation

  • Contextual Code: AI generates code based on your specific requirements
  • Official Documentation: Trained on PPE's official API/SDK documentation
  • Production-Ready: Complete implementations with error handling, OAuth, and examples
  • Smart Fallback: Automatically uses templates if AI is unavailable
  • Always Up-to-Date: AI adapts to latest PPE API patterns

How It Works

  1. You ask: @phonepe /generate php api uat
  2. AI analyzes: PPE documentation, language patterns, environment requirements
  3. AI generates: Complete, contextual code with OAuth, payments, refunds, status checks
  4. You use: Copy or insert the generated code directly into your files

⚡ Quick Start with Slash Commands

The extension uses structured slash commands for predictable, AI-powered interactions.

Show Interactive Menu

@phonepe

Available Commands

@phonepe /generate java production    # Generate integration code
@phonepe /install nodejs              # Install SDK & dependencies
@phonepe /docs                        # Access documentation
@phonepe /troubleshoot token-expired  # Debug issues
@phonepe /setup uat                   # Configure environment
@phonepe /best-practices              # View recommendations

📖 See SLASH_COMMANDS_GUIDE.md for complete command reference


Features

🎯 Structured Slash Commands (NEW!)

  • Predictable Interactions - No more guessing what to type
  • Command Discovery - Interactive menu shows all options
  • Autocomplete - Tab completion for slash commands
  • Followup Suggestions - Recommended next steps after each command
  • Clear Error Messages - Know exactly what went wrong

📦 Automatic SDK Installation & Dependency Management (NEW!)

  • One-Click Installation - Automatically install PPE SDK and dependencies
  • Multi-Language Support - Node.js, Python, Java, PHP, .NET, Android, iOS, Flutter
  • Smart File Management - Creates/updates package.json, requirements.txt, pom.xml, etc.
  • Terminal Integration - Real-time installation progress in VS Code terminal

�🔧 Smart Integration Type Detection

  • API Integration - Direct REST API calls for web applications
  • Backend SDK Integration - Server-side SDK integration for backend services
  • Mobile SDK Integration - Native mobile SDK for iOS/Android applications
  • AutoPay Integration - Recurring payment and subscription management

🤖 AI Chat Assistant (@phonepe)

Interactive chat participant using structured slash commands:

@phonepe /generate java production    # Generate integration code
@phonepe /install nodejs              # Install SDK & dependencies
@phonepe /docs                        # Access documentation
@phonepe /troubleshoot token-expired  # Debug issues
@phonepe /setup uat                   # Configure environment
@phonepe /best-practices              # View recommendations

💡 Tip: Type @phonepe alone to see the interactive menu with all available commands!

📱 Multi-Platform Support

  • Backend: Java, Python, Node.js, PHP, .NET, Go
  • Mobile: Android, iOS, Flutter, React Native, Ionic
  • Web: Direct REST API integration

� Documentation & Tools

  • Quick access to PPE SDK documentation
  • Direct link to PPE Postman collection
  • DevDocs integration for comprehensive API reference

Installation

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "PPE"
  4. Click Install

Integration Types

PhonePe offers two primary integration approaches:


🔌 1. REST API Integration (Direct API)

Best for: Web applications, custom backends, or platforms without SDK support

When to use:

  • ✅ You need full control over HTTP requests
  • ✅ Your platform/language doesn't have an SDK
  • ✅ You prefer direct API interaction
  • ✅ You want to implement custom payment flows

Supported Languages: Any language with HTTP client (Node.js, Python, Java, PHP, .NET, Go, Ruby, etc.)

Key Features:

  • Direct REST API calls via HTTP/HTTPS
  • OAuth 2.0 authentication and token management
  • Manual request signing and validation
  • Payment creation, status checking, and refunds
  • Complete control over request/response handling
  • Webhook integration for callbacks

Integration Flow:

1. Authenticate → Get OAuth 2.0 token
2. Create Payment → POST to payment endpoint
3. Get Status → Poll payment status
4. Handle Callback → Process webhook notifications

Example (Node.js):

// Direct REST API Integration
const axios = require('axios');

// Step 1: Get OAuth Token
const tokenResponse = await axios.post('https://api.phonepe.com/apis/identity-manager/v1/oauth/token', {
    grant_type: 'client_credentials',
    client_id: 'YOUR_CLIENT_ID',
    client_secret: 'YOUR_CLIENT_SECRET'
});

const accessToken = tokenResponse.data.access_token;

// Step 2: Create Payment
const paymentPayload = {
    merchantId: 'YOUR_MERCHANT_ID',
    merchantTransactionId: 'TXN_' + Date.now(),
    amount: 10000, // ₹100.00 in paise
    merchantUserId: 'USER_123',
    callbackUrl: 'https://yourdomain.com/callback',
    paymentInstrument: {
        type: 'PAY_PAGE'
    }
};

const paymentResponse = await axios.post(
    'https://api.phonepe.com/apis/pg/checkout/v2/pay',
    paymentPayload,
    {
        headers: {
            'Authorization': `Bearer ${accessToken}`,
            'Content-Type': 'application/json'
        }
    }
);

// Step 3: Redirect user to payment URL
const paymentUrl = paymentResponse.data.data.instrumentResponse.redirectInfo.url;

API Endpoints:

  • UAT: https://api-preprod.phonepe.com/apis/pg-sandbox/*
  • Production: https://api.phonepe.com/apis/pg/*

Use Cases:

  • Web applications (React, Angular, Vue)
  • Custom server implementations
  • Microservices architecture
  • API-first platforms
  • Legacy systems integration

📦 2. SDK Integration (Pre-built Libraries)

Best for: Applications that want quick integration with pre-built libraries

When to use:

  • ✅ You want faster implementation
  • ✅ Built-in security and best practices
  • ✅ Simplified code with helper methods
  • ✅ Official support and updates
  • ✅ Platform-specific features (mobile)

Supported Platforms:

  • Backend SDKs: Java, Python, Node.js, PHP, .NET
  • Mobile SDKs: Android, iOS, Flutter, React Native, Ionic

2A. Backend SDK Integration

Best for: Server-side applications with official SDK support

Key Features:

  • Pre-built SDK methods and classes
  • Automatic token management
  • Built-in request signing
  • Type-safe implementations
  • Comprehensive error handling
  • Regular updates and bug fixes

Example (Java SDK):

// Java Backend SDK Integration
import com.phonepe.sdk.PhonePeClient;
import com.phonepe.sdk.models.PaymentRequest;

// Initialize SDK
PhonePeClient client = PhonePeClient.builder()
    .merchantId("YOUR_MERCHANT_ID")
    .clientId("YOUR_CLIENT_ID")
    .clientSecret("YOUR_CLIENT_SECRET")
    .environment("PRODUCTION") // or "UAT"
    .build();

// Create Payment using SDK
PaymentRequest paymentRequest = PaymentRequest.builder()
    .merchantTransactionId("TXN_" + System.currentTimeMillis())
    .amount(10000L) // ₹100.00 in paise
    .merchantUserId("USER_123")
    .callbackUrl("https://yourdomain.com/callback")
    .build();

PaymentResponse response = client.payment().create(paymentRequest);
String paymentUrl = response.getPaymentUrl();

// Check Payment Status using SDK
PaymentStatusResponse status = client.payment()
    .checkStatus(merchantTransactionId);

Available Backend SDKs:

Platform Package Manager Installation Command
Java Maven/Gradle implementation 'com.phonepe:phonepe-pg-sdk:2.1.0'
Python pip pip install phonepe-payment-gateway
Node.js npm npm install phonepe-payment-gateway
PHP Composer composer require phonepe/payment-gateway
.NET NuGet dotnet add package PhonePe.PaymentGateway

Backend SDK Features:

  • Automatic OAuth token refresh
  • Built-in retry mechanisms
  • Request/response logging
  • Environment configuration
  • Type definitions/interfaces
  • Unit test helpers

2B. Mobile SDK Integration

Best for: Native and hybrid mobile applications

Key Features:

  • Native app integration
  • PhonePe app detection and launch
  • Seamless in-app payment flow
  • Platform-specific optimizations
  • Automatic app switching
  • Deep linking support

Example (Flutter SDK):

// Flutter Mobile SDK Integration
import 'package:phonepe_payment_sdk/phonepe_payment_sdk.dart';

// Initialize SDK
await PhonePePaymentSdk.init(
  environment: "PRODUCTION", // or "UAT"
  merchantId: "YOUR_MERCHANT_ID",
  appId: "YOUR_APP_ID",
  enableLogging: true,
);

// Create Payment
String body = // Your payment request body
String checksum = // Calculate checksum
String apiEndPoint = "/pg/v1/pay";

try {
  var response = await PhonePePaymentSdk.startTransaction(
    body: body,
    checksum: checksum,
    apiEndPoint: apiEndPoint,
    packageName: "com.phonepe.app", // PhonePe app package
  );
  
  if (response != null) {
    String status = response['status'];
    // Handle payment response
  }
} catch (error) {
  // Handle error
}

Example (Android SDK):

// Android Native SDK Integration
import com.phonepe.intent.sdk.api.PhonePe;
import com.phonepe.intent.sdk.api.models.PhonePeEnvironment;

// Initialize SDK
PhonePe.init(
    this, 
    PhonePeEnvironment.PRODUCTION, 
    "YOUR_MERCHANT_ID", 
    "YOUR_APP_ID"
);

// Start Payment
B2BPGRequest b2BPGRequest = new B2BPGRequestBuilder()
    .setData(base64Body)
    .setChecksum(checksum)
    .setUrl(apiEndPoint)
    .build();

PhonePe.getImplicitIntent(
    this,
    b2BPGRequest,
    "com.phonepe.app"
).startImplicitIntent(this, REQUEST_CODE);

Available Mobile SDKs:

Platform Package Manager Installation
Android Gradle implementation 'phonepe.intentsdk.android:IntentSDK:2.4.1'
iOS CocoaPods pod 'PhonePePaymentSDK', '~> 2.0.0'
Flutter pub.dev phonepe_payment_sdk: ^2.0.1
React Native npm npm install react-native-phonepe-pg
Ionic npm npm install @awesome-cordova-plugins/phonepe-pg

Mobile SDK Features:

  • Automatic PhonePe app detection
  • Fallback to web flow if app not installed
  • Transaction status callbacks
  • Deep linking for seamless UX
  • Platform-specific UI components
  • Biometric authentication support

📊 API vs SDK Comparison

Feature REST API Integration Backend SDK Mobile SDK
Implementation Speed Medium Fast Fast
Control Level Full control High Medium
Learning Curve Steep Easy Easy
Language Support Any Limited Platform-specific
Token Management Manual Automatic Automatic
Error Handling Manual Built-in Built-in
Updates Manual Automatic Automatic
Best For Custom needs Server apps Mobile apps
Documentation API docs SDK docs SDK docs
Type Safety No Yes Yes

Choose REST API if:

  • ✅ You need full control over requests
  • ✅ Your language doesn't have an SDK
  • ✅ You want custom implementations
  • ✅ You're building microservices

Choose Backend SDK if:

  • ✅ You want faster implementation
  • ✅ Your language has SDK support
  • ✅ You prefer managed updates
  • ✅ You want built-in best practices

Choose Mobile SDK if:

  • ✅ Building native/hybrid mobile apps
  • ✅ Want PhonePe app integration
  • ✅ Need platform-specific features
  • ✅ Want seamless UX

🔄 3. AutoPay Integration (Recurring Payments)

Best for: Subscription-based businesses and recurring billing

Available via: Both REST API and Backend SDKs

When to use:

  • ✅ Monthly/weekly subscription billing
  • ✅ EMI payments
  • ✅ Utility bill auto-payments
  • ✅ SaaS subscription management

Key Features:

  • Subscription setup and management
  • Automated recurring payments
  • Flexible billing frequencies (daily, weekly, monthly)
  • Subscription cancellation and modification
  • Customer mandate management
  • Payment retry logic

Integration Flow:

1. Customer Consent → Get mandate approval
2. Create Subscription → Setup recurring payment
3. Auto Execution → PhonePe auto-debits on schedule
4. Manage Subscription → Pause/cancel/modify as needed

Example (REST API):

// AutoPay via REST API
const autopayPayload = {
    merchantId: 'YOUR_MERCHANT_ID',
    merchantSubscriptionId: 'SUB_' + Date.now(),
    authRequestType: 'INITIAL',
    amount: 99900, // ₹999.00 in paise
    frequency: 'MONTHLY',
    recurringCount: 12,
    merchantUserId: 'USER_123',
    mobileNumber: '9876543210'
};

const subscriptionResponse = await axios.post(
    'https://api.phonepe.com/apis/pg/autopay/v1/subscription/create',
    autopayPayload,
    { headers: { 'Authorization': `Bearer ${accessToken}` } }
);

Example (Python SDK):

# AutoPay via Python SDK
from phonepe_sdk import PhonePeClient, SubscriptionRequest

client = PhonePeClient(
    merchant_id='YOUR_MERCHANT_ID',
    client_id='YOUR_CLIENT_ID',
    client_secret='YOUR_CLIENT_SECRET'
)

subscription = SubscriptionRequest(
    merchant_subscription_id='SUB_' + str(time.time()),
    amount=99900,  # ₹999.00
    frequency='MONTHLY',
    recurring_count=12,
    merchant_user_id='USER_123',
    mobile_number='9876543210'
)

response = client.autopay.create_subscription(subscription)

AutoPay Endpoints:

  • Create Subscription: /apis/pg/autopay/v1/subscription/create
  • Execute Payment: /apis/pg/autopay/v1/subscription/debit
  • Check Status: /apis/pg/autopay/v1/subscription/status
  • Cancel Subscription: /apis/pg/autopay/v1/subscription/cancel

Billing Frequencies:

  • DAILY - Daily auto-debit
  • WEEKLY - Weekly auto-debit
  • MONTHLY - Monthly auto-debit
  • QUARTERLY - Quarterly auto-debit
  • YEARLY - Yearly auto-debit

🎯 Slash Commands by Integration Type

Use the appropriate slash command based on your integration needs:

For REST API Integration:

@phonepe /generate nodejs production    # Node.js REST API
@phonepe /generate python prod          # Python REST API
@phonepe /generate java production      # Java REST API
@phonepe /docs api-reference            # API documentation

For Backend SDK Integration:

@phonepe /install java                  # Install Java SDK
@phonepe /install nodejs                # Install Node.js SDK
@phonepe /generate java production      # Generate SDK code
@phonepe /docs backend-sdk              # SDK documentation

For Mobile SDK Integration:

@phonepe /install android               # Install Android SDK
@phonepe /install flutter               # Install Flutter SDK
@phonepe /generate flutter production   # Generate mobile code
@phonepe /docs mobile-sdk               # Mobile SDK docs

For AutoPay/Recurring:

@phonepe /generate autopay java         # AutoPay integration
@phonepe /docs autopay                  # AutoPay documentation
@phonepe /troubleshoot subscription     # Debug AutoPay issues

Best for: Subscription-based businesses and recurring billing

Features:

  • Subscription setup and management
  • Automated recurring payments
  • Flexible billing frequencies (daily, weekly, monthly)
  • Subscription cancellation and modification

Example:

# Python AutoPay Integration
autopay = PhonePeAutoPay()
subscription = autopay.setup_subscription({
    'amount': 99900,  # ₹999.00 monthly
    'frequency': 'MONTHLY',
    'recurring_count': 12
})

Usage with Slash Commands

The extension provides structured slash commands for all integration types:

Generate Integration Code

# REST API Integration
@phonepe /generate nodejs production    # Node.js API
@phonepe /generate python uat           # Python API
@phonepe /generate php production       # PHP API

# Backend SDK Integration
@phonepe /generate java production      # Java SDK
@phonepe /generate dotnet uat          # .NET SDK

# Mobile SDK Integration
@phonepe /generate android production   # Android SDK
@phonepe /generate flutter uat         # Flutter SDK
@phonepe /generate ios production      # iOS SDK

# AutoPay Integration
@phonepe /generate autopay java        # Java AutoPay
@phonepe /generate autopay nodejs      # Node.js AutoPay

Install SDK & Dependencies

@phonepe /install nodejs    # Install Node.js SDK
@phonepe /install java      # Install Java SDK
@phonepe /install python    # Install Python SDK
@phonepe /install android   # Install Android SDK
@phonepe /install flutter   # Install Flutter SDK

Access Documentation

@phonepe /docs              # Show all documentation
@phonepe /docs api          # REST API docs
@phonepe /docs backend-sdk  # Backend SDK docs
@phonepe /docs mobile-sdk   # Mobile SDK docs
@phonepe /docs autopay      # AutoPay docs

Troubleshoot Issues

@phonepe /troubleshoot token-expired      # Token issues
@phonepe /troubleshoot cors               # CORS errors
@phonepe /troubleshoot authentication     # Auth failures
@phonepe /troubleshoot payment-failed     # Payment errors

Show Interactive Menu

@phonepe                    # Display all commands
@phonepe help              # Show help menu
@phonepe menu              # Show command menu

Command Palette

Access PhonePe features through VS Code Command Palette (Ctrl+Shift+P):

  • PhonePe: Generate SDK Integration Code - Generate SDK integration code
  • PhonePe: Generate API Integration Code - Generate REST API integration code
  • PhonePe: Open SDK Documentation - Open PhonePe SDK documentation
  • PhonePe: Open Postman Collection - Open PhonePe Postman collection

Environment Configuration

UAT/Sandbox Environment

{
  auth: "https://api-preprod.phonepe.com/apis/pg-sandbox/v1/oauth/token",
  payment: "https://api-preprod.phonepe.com/apis/pg-sandbox/checkout/v2/pay",
  subscription: "https://api-preprod.phonepe.com/apis/pg-sandbox/autopay/v1/subscription"
}

Production Environment

{
  auth: "https://api.phonepe.com/apis/identity-manager/v1/oauth/token",
  payment: "https://api.phonepe.com/apis/pg/checkout/v2/pay",
  subscription: "https://api.phonepe.com/apis/pg/autopay/v1/subscription"
}

Code Generation Features

🔒 Security Best Practices

  • OAuth 2.0 token management with automatic refresh
  • Request signing and validation
  • Comprehensive error handling and logging
  • Environment-based configuration

💳 Payment Operations

  • Payment Creation: Initiate secure payments
  • Status Checking: Real-time order status tracking
  • Refund Processing: Handle payment refunds
  • Webhook Integration: Process payment callbacks

🔄 AutoPay Features

  • Subscription Setup: Customer consent and mandate creation
  • Recurring Execution: Automated recurring payments
  • Subscription Management: Pause, cancel, modify subscriptions
  • Billing Frequencies: Daily, weekly, monthly options

SDK Versions

Platform Version Installation
Java v2.1.0 Maven/Gradle dependency
Python v1.0.0 pip install phonepe-payment-gateway
Node.js v1.0.0 npm install phonepe-payment-gateway
PHP v1.0.0 composer require phonepe/payment-gateway
.NET v1.0.0 dotnet add package PhonePe.PaymentGateway
Android v2.4.1 implementation 'phonepe.intentsdk.android:IntentSDK:2.4.1'
iOS v2.0.0 pod 'PhonePePaymentSDK'
Flutter v2.0.1 phonepe_payment_sdk: ^2.0.1

Requirements

  • VS Code version 1.90.0 or higher
  • Node.js (for development)

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT License - see LICENSE file for details

Support

For PPE documentation and support:

  • PPE Developer Documentation
  • PPE SDK Documentation
  • PPE Postman Collection

Integration Type Detection

The extension intelligently routes requests based on slash commands and parameters:

Slash Command Parameters Generated Integration
/generate nodejs production Language: nodejs REST API - Node.js with axios
/generate java production Language: java Backend SDK - Java with Maven
/generate python uat Language: python REST API or SDK - Python (both options)
/generate android production Platform: android Mobile SDK - Android with Intent SDK
/generate flutter uat Platform: flutter Mobile SDK - Flutter with pub.dev
/generate autopay java Type: autopay AutoPay - Recurring payments
/install nodejs Platform: nodejs Installs Node.js SDK + dependencies
/install android Platform: android Installs Android SDK + Gradle config

Integration Selection Guide

Use /generate [language] [environment] for:

  • REST API integration (any language)
  • Backend SDK integration (Java, Python, Node.js, PHP, .NET)
  • Quick code generation

Use /install [platform] for:

  • Installing SDK packages
  • Setting up dependencies
  • Configuring build files (pom.xml, package.json, etc.)

Use /docs [section] for:

  • API reference documentation
  • SDK documentation
  • Integration guides
  • Best practices

Examples:

# REST API for custom backend
@phonepe /generate nodejs production

# Java SDK with Maven
@phonepe /install java
@phonepe /generate java production

# Flutter mobile app
@phonepe /install flutter
@phonepe /generate flutter production

# AutoPay subscription billing
@phonepe /generate autopay java
@phonepe /docs autopay

Happy Coding with PhonePe! 🚀

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft