PHPackages                             bennetgallein/pay.g2a.com-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. bennetgallein/pay.g2a.com-php-sdk

ActiveLibrary

bennetgallein/pay.g2a.com-php-sdk
=================================

A PHP SDK for the G2A.com payment gateway

v0.1.1(6y ago)271[2 PRs](https://github.com/bennetgallein/pay.g2a.com-PHP-SDK/pulls)PHP

Since Apr 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/bennetgallein/pay.g2a.com-PHP-SDK)[ Packagist](https://packagist.org/packages/bennetgallein/pay.g2a.com-php-sdk)[ RSS](/packages/bennetgallein-payg2acom-php-sdk/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Welcome to G2A Payment Gateway SDK for PHP 👋
============================================

[](#welcome-to-g2a-payment-gateway-sdk-for-php-)

 [ ![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667) ](#) [ ![Twitter: bennetgallein](https://camo.githubusercontent.com/e89cc37cca024e4545c3a52e81355a23715dfeee2f9c7483e44f803250529906/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f62656e6e657467616c6c65696e2e7376673f7374796c653d736f6369616c) ](https://twitter.com/bennetgallein)

> This is a SDK to simplify working with the G2A payment gateway

### 🏠 [Homepage](https://bennetgallein.de)

[](#-homepage)

Install
-------

[](#install)

```
composer require bennetgallein/pay.g2a.com-php-sdk
```

Usage
-----

[](#usage)

This will give a quick example how to use this SDK to generate a payment and redirect the user.

```
use G2APay\G2APay;
use G2APay\Types\Enums\Environment;
use G2APay\Types\Item;
use Tracy\Debugger;

$g2a = new G2APay(
    "test@example.com", // your merchants email address
    '12345678-1234-12345-12345-123456789012', // your API hash
    'GDG#*)G*Wd#80Ggd*)G#80db380bnf3ijf3iW()#hb[pwai4u3f4b4UU3#$(%ubUb#', // your API secret
    Environment::SANBDOX // which env to use. Can be Environment::SANDBOX or Environment::PRODUCTION. Default is production
);

$payment = $g2a->createPayment() // initiates a new payment class
    ->addItem((new Item()) // add an item to it
        ->setSku("sku") // set the sku for the item
        ->setName("Test Product") // set the name for the item
        ->setAmount(20.00) // the the total price (quantity * price)
        ->setQuantity(2) // quantity of the item
        ->setId(1) // item id, this is internal to your system
        ->setPrice(10.00) // price per one item
        ->setUrl('https://test.com/product') // url to the product
    )
    ->setOrderId(1) // order id, this is internal to you system
    ->setAmount(20.00) // total amount of the transaction
    ->setCurrency('EUR') // ISO 4217 conform currency code
    ->setEmail('me@bennetgallein.de') // customers email
    ->setFailureUrl('https://test.com/failed') // callback url on failed payment (user abort for example)
    ->setOkUrl('https://test.com/success') // return url if the user approves. get-Parameter "transactionId" contains the transactionId
    ->setCustomerIPAddress('123.123.123.123') // customers ipv4 address
    ->create(); // create the payment

$checkoutUrl = $g2a->getCheckoutUrl($payment->token); // get the checkout url from token
header("Location: ${checkoutUrl}"); // redirect the user
```

get information about a transaction

```
$payment = $g2a->createPayment()->getPayment("paymentId");
```

Author
------

[](#author)

👤 **Bennet Gallein**

- Website:
- Twitter: [@bennetgallein](https://twitter.com/bennetgallein)
- Github: [@bennetgallein](https://github.com/bennetgallein)

Show your support
-----------------

[](#show-your-support)

Give a ⭐️ if this project helped you!

---

*This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)*

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2209d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d1fe6824fa3ef29f0284a7dddd5233ee261e0e1e41a575e6d867e34428b70386?d=identicon)[BennetPHP](/maintainers/BennetPHP)

---

Top Contributors

[![bennetgallein](https://avatars.githubusercontent.com/u/15325891?v=4)](https://github.com/bennetgallein "bennetgallein (4 commits)")

### Embed Badge

![Health badge](/badges/bennetgallein-payg2acom-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/bennetgallein-payg2acom-php-sdk/health.svg)](https://phpackages.com/packages/bennetgallein-payg2acom-php-sdk)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
