Download the PHP package born-mt/mita-gpg-sdk without Composer

On this page you can find all versions of the php package born-mt/mita-gpg-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mita-gpg-sdk

Malta GPG SDK

CircleCI PHP Version

A comprehensive PHP SDK for integrating with Malta's Government Payment Gateway (GPG) API. This package provides a clean, type-safe interface for processing payments through Malta's official payment infrastructure.

Features

Official Documentation

Installation

Install via Composer:

Requirements

Quick Start

Initialize the Client

Create a Simple Payment

Pre-Authorize and Capture

Handle Webhooks

Refund a Payment

Get Transaction Details

Get Transaction History

API Reference

GpgClient

The main client class for interacting with Malta GPG API.

Constructor

Methods

createPayment(PaymentRequest $request): PaymentResponse

Create a new Hosted Payment Page transaction.

capturePayment(string $transactionId, ?float $amount = null): PaymentResponse

Capture a pre-authorized payment (full or partial).

refundPayment(string $transactionId, ?float $amount = null): PaymentResponse

Refund a processed payment (full or partial).

voidPayment(string $transactionId): PaymentResponse

Cancel/void a pending or authorized transaction.

getTransaction(string $transactionId): array

Get details of a specific transaction.

getTransactions(array $filters = []): array

Get list of transactions with optional filters.

buildPaymentPageUrl(string $transactionId): string

Build the Hosted Payment Page URL for a transaction.

verifyWebhookSignature(string $payload, string $signature, string $secret): bool

Verify webhook signature using HMAC SHA256.

parseWebhook(string $payload, ?string $signature, ?string $secret): WebhookPayload

Parse and optionally verify webhook payload.

DTOs

PaymentRequest

Fluent Methods:

PaymentResponse

WebhookPayload

Enums

TransactionType

TransactionStatus

Exceptions

All exceptions extend GpgException:

Advanced Usage

Custom UDF Fields

Custom Metadata

Error Handling

Testing

Run the test suite:

Run with coverage:

Getting API Credentials

For Testing/Development

Contact GPG Support to request test API keys:

For Production

  1. Open merchant accounts with BOV and/or HSBC Malta
  2. Ensure accounts are 3D Secure enabled
  3. Raise an eRFS (electronic Request for Service) to MITA
  4. Provide your bank account details and business information
  5. Wait for approval (processing time varies)
  6. Receive production API credentials

Security Best Practices

  1. Never commit API keys - Use environment variables
  2. Always verify webhook signatures - Prevent spoofing
  3. Use HTTPS - Required for production
  4. Validate amounts - Check amounts match your records
  5. Log everything - Keep audit trail of transactions
  6. Handle errors gracefully - Don't expose internal details to users
  7. Test thoroughly - Use test mode before production
  8. Monitor webhooks - Alert on missed/failed webhooks

Payment Flow

  1. Customer initiates payment on your website
  2. Create payment via API (POST /api/HostedPaymentPage)
  3. Redirect customer to GPG Hosted Payment Page
  4. Customer enters card details on secure GPG page
  5. 3D Secure authentication by customer's bank
  6. Payment processed by acquiring bank
  7. Customer redirected back to your site
  8. Webhook sent with final transaction status
  9. Update your database based on webhook

Support

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

The MIT License (MIT). Please see License File for more information.

Credits

Changelog

1.0.0 (2025-01-05)


Made with ❤️ in Malta


All versions of mita-gpg-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
guzzlehttp/guzzle Version ^7.5
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package born-mt/mita-gpg-sdk contains the following files

Loading the files please wait ...