Skip to content

FZFR/Midtrans-FOSSBilling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Midtrans Integration for FOSSBilling

GitHub

Overview

This adapter integrates Midtrans payment gateway into your FOSSBilling installation. It allows your customers to pay using a wide variety of payment methods supported by Midtrans, including credit/debit cards, bank transfers, e-wallets, and more, while seamlessly integrating with FOSSBilling.

Note This extension is currently in beta. While it has been tested extensively, use in production environments should be done with caution and thorough testing.

Table of Contents

Features

  • Multiple Payment Methods: Supports various Midtrans payment options including credit/debit cards, bank transfers, e-wallets, and more.

  • Flexible Integration Options:

    • Snap Popup: Displays Midtrans payment interface in a popup window.
    • Embedded Snap: Integrates Midtrans payment interface directly into FOSSBilling checkout page.
  • Automatic Invoice Management:

    • Updates invoice status to 'paid' automatically upon successful payment.
    • Handles various payment statuses (capture, settlement, pending, deny, cancel, expire).
  • Detailed Transaction Logging: Comprehensive logging for easy tracking and debugging.

  • Secure Payment Processing:

    • Supports 3D Secure transactions for card payments.
    • Implements signature key verification for Midtrans notifications.
  • Sandbox Mode: Allows testing in a sandbox environment before going live.

  • Configurable Snap Token Storage:

    • Ability to set custom expiration time for stored Snap tokens.
    • Automatic cleanup of expired tokens to maintain system efficiency.

Installation

1). Extension directory

Not yet implemented

2). Manual installation

  1. Download the latest release from the GitHub repository.
  2. Create a new folder named Midtrans in the /library/Payment/Adapter directory of your FOSSBilling installation.
  3. Extract the downloaded files into this new directory.
  4. In your FOSSBilling admin panel, navigate to "Payment gateways" under the "System" menu.
  5. Find Midtrans in the "New payment gateway" tab and click the cog icon to install and configure.

Configuration

  1. In your FOSSBilling admin panel, locate "Midtrans" under "Payment gateways".
  2. Enter the following Midtrans credentials:
    • Merchant ID
    • Client Key
    • Server Key
  3. Configure additional settings:
    • Sandbox mode (for testing)
    • Payment mode (popup or embedded)
    • Default country code
  4. Set the Snap Token Expiration time (in seconds) to control how long Snap tokens are stored.
  5. Save your configuration.

Webhook Configuration

To set up webhooks for real-time payment notifications:

  1. Log in to your Midtrans dashboard.
  2. Navigate to Settings > Configuration.
  3. Set the Payment Notification URL to: https://your-fossbilling-domain.com/ipn.php?gateway_id=payment_gateway_id (Replace your-fossbilling-domain.com with your actual domain and payment_gateway_id with the ID assigned by FOSSBilling)

Snap Token Storage Configuration

The Snap Token Storage feature allows you to control how long Snap tokens are stored in the system:

  • Navigate to the Midtrans configuration in your FOSSBilling admin panel.
  • Find the "Snap Token Expiration" field.
  • Enter the desired expiration time in seconds. For example:
    • 3600 for 1 hour
    • 86400 for 24 hours (default)
    • 604800 for 1 week
  • The system will automatically delete expired tokens based on this setting.

This feature helps in optimizing system resources while maintaining flexibility for different use cases.

Usage

Once installed and configured:

  1. Midtrans will appear as a payment option during the checkout process.
  2. Customers can select Midtrans and choose their preferred payment method.
  3. Depending on your configuration, they will either be redirected to a Midtrans popup or see an embedded payment form.
  4. After payment, customers are redirected back to your site, and the invoice status is updated automatically.

Troubleshooting

  • Check Logs: Review logs at library/Payment/Adapter/Midtrans/logs/midtrans.log for transaction details and errors.
  • API Credentials: Ensure your Midtrans API keys are correctly entered in the FOSSBilling configuration.
  • TLS Support: Verify that your server supports TLS v1.2 for Midtrans notifications.
  • Webhook Issues: If payment status updates are not working, check your webhook configuration in both Midtrans and FOSSBilling.
  • Payment Method Availability: Some payment methods may not be available in certain regions or for certain transaction amounts. Refer to Midtrans documentation for details.
  • Token Expiration Issues: If you're experiencing issues related to Snap tokens, check the "Snap Token Expiration" setting in your Midtrans configuration. Adjust as needed based on your usage patterns.

Contributing

We welcome contributions to improve this integration. To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix: git checkout -b feature-name.
  3. Make your changes and commit them with a clear message.
  4. Push your branch and create a pull request.

Please ensure your code adheres to the existing style and include appropriate tests if applicable.

License

This FOSSBilling Midtrans Payment Gateway Integration is open-source software licensed under the Apache License 2.0.

Support

  • For issues related to this adapter, please open an issue in the GitHub repository.
  • For Midtrans-specific issues, please contact Midtrans support.
  • For FOSSBilling related questions, refer to the FOSSBilling documentation.

Note: This module is not officially affiliated with FOSSBilling or Midtrans. Please refer to their respective documentation for detailed information on their services and APIs.

Releases

No releases published

Packages

No packages published

Languages