PHPackages                             sauladam/omnipay-paysafecard-rest - 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. [Payment Processing](/categories/payments)
4. /
5. sauladam/omnipay-paysafecard-rest

ActiveLibrary[Payment Processing](/categories/payments)

sauladam/omnipay-paysafecard-rest
=================================

Paysafecard (with REST API) gateway for Omnipay payment processing library

0.2.0(9y ago)3200MITPHP

Since May 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sauladam/omnipay-paysafecard-rest)[ Packagist](https://packagist.org/packages/sauladam/omnipay-paysafecard-rest)[ Docs](https://github.com/sauladam/omnipay-paysafecard-rest)[ RSS](/packages/sauladam-omnipay-paysafecard-rest/feed)WikiDiscussions master Synced today

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

Omnipay: Paysafecard (REST API)
===============================

[](#omnipay-paysafecard-rest-api)

**Paysafecard driver for the Omnipay PHP payment processing library**

[![Build Status](https://camo.githubusercontent.com/fc8e948d46563576f06dcdb94fc3a3aec888fe68fea528afe4dc132780728e0b/68747470733a2f2f7472617669732d63692e6f72672f7361756c6164616d2f6f6d6e697061792d70617973616665636172642d726573742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sauladam/omnipay-paysafecard-rest)[![Total Downloads](https://camo.githubusercontent.com/5df22efd6483411f02805c16a524918b050b44d401fea8f14dde3b073b445a8e/68747470733a2f2f706f7365722e707567782e6f72672f7361756c6164616d2f6f6d6e697061792d70617973616665636172642d726573742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/sauladam/omnipay-paysafecard-rest)

This is non-official Omnipay-driver for the payment gateway provider [Paysafecard](https://www.paysafecard.com). In order to use it the Omnipay-Framework is required.

[Omnipay](https://github.com/omnipay/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Paysafecard REST API support for Omnipay.

Installation
------------

[](#installation)

This package is installed via [Composer](http://getcomposer.org/). To install, simply add it to your `composer.json` file:

```
$ composer require sauladam/omnipay-paysafecard-rest
```

And run composer to update your dependencies:

```
$ composer update
```

Basic Usage
-----------

[](#basic-usage)

The following gateway is provided by this package:

- Paysafecard\_Rest

For general usage instructions, please see the main [Omnipay](https://github.com/omnipay/omnipay)repository.

### Setting up the gateway

[](#setting-up-the-gateway)

This is quite simple because the API only needs an API key.

```
require 'vendor/autoload.php';

use Omnipay\Omnipay;

$gateway = Omnipay::create('Paysafecard_Rest');

$gateway->setApiKey('yourApiKey');

// Testmode is on by default, so you want to switch it off for production.
$gateway->setTestMode(false); // default: true
```

### Initializing / authorizing a payment

[](#initializing--authorizing-a-payment)

```
$response = $gateway->authorize([
    'amount' => 0.01,
    'currency' => 'EUR',
    'success_url' => 'http://success.com/{payment_id}',
    'failure_url' => 'http://fail.com/{payment_id}',
    'notification_url' => 'http://notify.com/{payment_id}',
    'customer_id' => 1234,
])->send();

if ($response->isSuccessful()) {
    $paymentId = $response->getPaymentId();

    // this is the url you should redirect the customer
    // to or display within an iframe
    $authUrl = $response->authUrl();
} else {
    echo 'Something went wrong: ' . $response->getMessage();
}
```

The auth URL points to a (secure) page where the customer can enter their Paysafecard PIN number. You can redirect the customer to that URL or embed it as an iframe and display it to them - either is fine.

After the customer has filled out and submitted the form, Paysafecard will redirect them to what you've specified as your *success\_url* in the authorize request. Ideally that URL should contain some kind of payment identifier or some reference to your previously stored `$paymentId` (Paysafecard will replace the placeholder *{payment\_id}* in the URL with the actual payment id), because you now need it to check the status of this transaction:

### Check the status

[](#check-the-status)

```
$response = $gateway->details([
    'payment_id' => $paymentId,
])->send();
```

The status now should be *AUTHORIZED*, so check for that:

```
if($response->getStatus() == 'AUTHORIZED')
{
    // The customer has authorized the payment, we're now ready to capture it.
}
```

### Capture the transaction

[](#capture-the-transaction)

```
$response = $gateway->capture([
    'payment_id' => $paymentId,
])->send();

if($response->getStatus() == 'SUCCESS') {
    // You have successfully captured the payment, the order is ready to ship.
}
```

### Refunds

[](#refunds)

In order to use the Refund API, you have to ask paysafecard explicitly to enable this endpoint for your merchant account, otherwise you will get a "401 Unauthorized" response.

If you want to execute the refund immediately, just use the `refund()`-funtion directly with all the required data:

```
$response = $gateway->refund([
    'payment_id' => $paymentId,
    'amount' => 12.34,
    'currency' => 'EUR',
    'customer_email' => 'customer@email.com',
    'customer_id' => 1234,
])->send();

if($response->getStatus() == 'SUCCESS') {
    // The amount was successfully refunded.
}
```

However, **it is recommended to validate the refund first** in order to *"precheck the likeliness of the upcoming refund to be successful"* because *"there are certain conditions why a refund might be refused"*.

So instead of `refund()` you should rather use `validateRefund()` first with the same data and only request the refund if the validation passed:

```
$validationResponse = $gateway->validateRefund([
    // same data as above
])->send();

if(! $validationResponse->isSuccessful() || $validationResponse->getStatus() != 'VALIDATION_SUCCESSFUL') {
    // something went wrong...
}

$refundResponse = $gateway->refund([
  'payment_id' => $paymentId,
  'refund_id' => $response->getRefundId(),
])->send();

if($refundResponse->isSuccessful()) {
    echo "The refund was successful and the refund id is " . $refundResponse->getRefundId();
}
```

Support
-------

[](#support)

For more usage examples please have a look at the tests of this package. Also have a look at the [Paysafecard API Documentation](https://www.paysafecard.com/fileadmin/api/) for further details.

If you are having general issues with Omnipay, we suggest posting on [Stack Overflow](http://stackoverflow.com/). Be sure to add the [omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a [mailing list](https://groups.google.com/forum/#!forum/omnipay) which you can subscribe to.

If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/sauladam/omnipay-paysafecard-rest/issues), or better yet, fork the library and submit a pull request.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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 ~4 days

Total

2

Last Release

3325d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5918276?v=4)[sauladam](/maintainers/sauladam)[@sauladam](https://github.com/sauladam)

---

Top Contributors

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

---

Tags

paymentgatewaypaysafecardpaymerchantomnipaypurchasepaysafe

### Embed Badge

![Health badge](/badges/sauladam-omnipay-paysafecard-rest/health.svg)

```
[![Health](https://phpackages.com/badges/sauladam-omnipay-paysafecard-rest/health.svg)](https://phpackages.com/packages/sauladam-omnipay-paysafecard-rest)
```

###  Alternatives

[lokielse/omnipay-alipay

Alipay gateway for Omnipay payment processing library

586422.8k10](/packages/lokielse-omnipay-alipay)

PHPackages © 2026

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