piprapay library

A professional Flutter package for integrating Piprapay payment gateway.

This package provides a complete solution for accepting payments via Piprapay, including payment creation, verification, webhook handling, and refunds.

Getting Started

import 'package:piprapay/piprapay.dart';

// Initialize the service
final piprapay = PiprapayService(
  apiKey: 'your_api_key',
);

// Create a payment
final charge = await piprapay.createCharge(
  fullName: 'John Doe',
  emailOrMobile: 'john@example.com',
  amount: '100',
  metadata: {'order_id': '12345'},
  redirectUrl: 'https://yourapp.com/success',
  cancelUrl: 'https://yourapp.com/cancel',
  webhookUrl: 'https://yourapp.com/webhook',
);

// Redirect user to payment gateway
// Navigate to charge.paymentUrl

// Verify payment after user returns
final verification = await piprapay.verifyPayment(
  transactionId: ppId,
);

Features

  • Create payment charges
  • Verify payment status
  • Process refunds
  • Handle webhooks
  • Complete error handling
  • Sandbox and production environments
  • Full input validation

Classes

CreateChargeRequest
Request model for creating a charge/payment
CreateChargeRequestV2
Old V2 models (kept for backwards compatibility)
CreateChargeRequestV3
Piprapay V3+ Models
CreateChargeResponse
Response model for charge creation
CreateChargeResponseV2
CreateChargeResponseV3
Create Charge Response for V3+ API
PaymentResult
Result of payment execution through WebView checkout
PiprapayHttpClient
HTTP client for Piprapay API requests
PiprapayService
Main service class for Piprapay API integration Supports both V2 and V3+ API versions
PiprapayUtils
Utility class for webhook validation and security operations
PiprapayWebView
WebView-based payment execution handler (built into Piprapay package)
RefundPaymentRequest
Request model for refund
RefundPaymentResponse
Response model for refund
RefundPaymentResponseV3
Refund Payment Response for V3+ API
VerifyPaymentRequest
Request model for verifying payment
VerifyPaymentResponse
Response model for payment verification
VerifyPaymentResponseV2
V2 Verify Payment Response
VerifyPaymentResponseV3
Verify Payment Response for V3+ API Uses pp_id instead of transaction_id
WebhookPayload
Webhook payload model
WebhookPayloadV3
Webhook Payload for V3+ API Enhanced with detailed payment information

Enums

PanelVersion
Panel version enum for Piprapay API
PaymentStatus
Payment status enum
PiprapayeCurrency
Currency types supported by Piprapay
ReturnType
Return type for payment notifications

Exceptions / Errors

PiprapayAuthException
Exception thrown when API authentication fails
PiprapayConfigException
Exception thrown when configuration is invalid
PiprapayException
Base exception for Piprapay SDK
PiprapayFailure
Simplified exception for payment operations - used by high-level payment execution
PiprapayNetworkException
Exception thrown when network request fails
PiprapayPaymentException
Exception thrown when payment verification fails
PiprapayRequestException
Exception thrown when API request is invalid
PiprapayWebhookException
Exception thrown when webhook validation fails