2. Configuration

You are need create configuration for gateway. Library supporting single or multiple gateways, because for every currency you are need one.

Attributes

The privateKey attribute

Absolute path to your private certificate pem file.

Type:string

The privateKeyPassphrase attribute

Passphrase of your private certificate

Type:string

The publicKey attribute

Absolute path to GPWebPay service public certificate pem file.

Type:string

The url attribute

Absolute URL to gateway

Type:string

Note

You are get from GPWebPay service

The depositFlag attribute

Specifies if the order has to be paid for automatically.
0 = instant payment not required
1 = payment required
Type:int

The merchantNumber attribute

Your Merchant Number

Type:string

Note

You are get from GPWebPay service.

The responseUrl attribute

Absolute URL to your site where GPWebPay sends a response

Type:string

It is optional in config. You can set up url for each request in Operation object.

Warning

GPWebPay is recommendation does not use url which has parameters (after ‘?’) because they may drop it for “security reason”.

Examples

Single gateway

use Pixidos\GPWebPay\Config\Factory\ConfigFactory;
use Pixidos\GPWebPay\Config\Factory\PaymentConfigFactory;

$configFactory = new ConfigFactory(new PaymentConfigFactory());

$config = $configFactory->create(
        [
                ConfigFactory::PRIVATE_KEY => __DIR__ . '/_certs/test.pem',
                ConfigFactory::PRIVATE_KEY_PASSPHRASE => '1234567',
                ConfigFactory::PUBLIC_KEY => __DIR__ . '/_certs/test-pub.pem',
                ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do',
                ConfigFactory::MERCHANT_NUMBER => '123456789',
                ConfigFactory::DEPOSIT_FLAG => 1,
                ConfigFactory::RESPONSE_URL => 'http://example.com/proccess-gpw-response'
        ]
);

Multiple gateways

use Pixidos\GPWebPay\Config\Factory\ConfigFactory;
use Pixidos\GPWebPay\Config\Factory\PaymentConfigFactory;

$configFactory = new ConfigFactory(new PaymentConfigFactory());

$config = $configFactory->create(
        [
                'czk' => [
                        ConfigFactory::PRIVATE_KEY => __DIR__ . '/_certs/test.pem',
                        ConfigFactory::PRIVATE_KEY_PASSPHRASE => '1234567',
                        ConfigFactory::PUBLIC_KEY => __DIR__ . '/_certs/test-pub.pem',
                        ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do',
                        ConfigFactory::MERCHANT_NUMBER => '123456789',
                        ConfigFactory::DEPOSIT_FLAG => 1,
                ],
                'eur' => [
                        ConfigFactory::PRIVATE_KEY => __DIR__ . '/_certs/test2.pem',
                        ConfigFactory::PRIVATE_KEY_PASSPHRASE => '12345678',
                        ConfigFactory::PUBLIC_KEY => __DIR__ . '/_certs/test-pub2.pem',
                        ConfigFactory::URL => 'https://test.3dsecure.gpwebpay.com/unicredit/order.do',
                        ConfigFactory::MERCHANT_NUMBER => '123456780',
                        ConfigFactory::DEPOSIT_FLAG => 1,
                ],
        ],
        'czk' // what gateway is default
);