Suggest Edits

Getting started

 

Software development kit (SDK)

At the moment there is only one SDK available:

The corresponding examples you can find in the Github Repository as well:
github.com/payrexx/payrexx-php/tree/master/examples

Troubles integrating our API in your programming language?

No problem. Please contact our support team at support.payrexx.com

Request

The payload data has to be RFC 3986 (http://www.ietf.org/rfc/rfc3986.txt) url encoded and spaces will be percent encoded "%20".

The basic URL to our API is: https://api.payrexx.com/v1.0/:object/:id?instance=:instance

Parameter
Value

object

AuthToken | Invoice | Page | Subscription

id

Only used for request types GET, PUT and DELETE where only one entity gets modified.

instance

The Payrexx instance name.
If you access your Payrexx payment page with example.payrexx.com, the name would be example

Authentication - API signature

Is this important for you?

This part of the documentation is only important if you are not using an SDK.

The API signature is a HMAC (RFC 2104).

For security reasons we want you to pass an API signature calculated with the API Secret of your instance.
The parameter name of this API signature should be ApiSignature. You can calculate the signature using all params except the param instance.

  • Build query string (e.g. model=Page&id=17)
  • Calculate binary hmac hash using your instance's API Secret as key
  • Encode it with base64
base64_encode(hash_hmac('sha256', http_build_query($params, null, '&'), $apiSecret, true));
echo -n "HTTP-QUERY-STRING" | openssl dgst -sha256 -hmac "API-SECRET" -binary | openssl enc -base64
import urllib.request
import hmac
import hashlib
import base64

post_data = {}

httpQueryString = urllib.parse.urlencode(post_data).encode('UTF-8')

apiSignature = hmac.new(b'API-SECRET', msg=httpQueryString, digestmod=hashlib.sha256).digest()
# head
using System.Text;
using System.Security.Cryptography;

# function
string key = "API-SECRET";
string message = "";

byte[] keyByte = new UTF8Encoding().GetBytes(key);
byte[] messageBytes = new UTF8Encoding().GetBytes(message);
byte[] hashmessage = new HMACSHA256(keyByte).ComputeHash(messageBytes);

var signature = Convert.ToBase64String(hashmessage);

Encoding of HTTP-Query String

The query string has to be RFC 1738 encoded, that means you have to replace spaces by "+".
You can probably use: http://linux.die.net/man/1/urlencode

Suggest Edits

Check your signature

 
gethttp://api.payrexx.com/v1.0/SignatureCheck/
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request GET "https://api.payrexx.com/v1.0/SignatureCheck/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature"
<?php
// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'INSTANCE_API_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$signatureCheck = new \Payrexx\Models\Request\SignatureCheck();
try {
    $response = $payrexx->getOne($signatureCheck);
    die('Signature correct');
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
  	die('Signature wrong');
}
import urllib.request
import hmac
import hashlib
import base64
import sys

post_data = {}

data = urllib.parse.urlencode(post_data).encode('UTF-8')

dig = hmac.new(b'INSTANCE_API_SECRET', msg=data, digestmod=hashlib.sha256).digest()
post_data['ApiSignature'] = base64.b64encode(dig).decode()
post_data['instance'] = 'INSTANCE_NAME'

data = urllib.parse.urlencode(post_data)

try:
    result = urllib.request.urlopen('https://api.payrexx.com/v1.0/SignatureCheck/?' + data)
    sys.exit("Signature correct")
except Exception as exc:
    print(exc, file=sys.stderr)
    sys.exit("Signature wrong")
// imports
import java.net.URLEncoder;
import java.util.Base64;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

// method content
String key = "INSTANCE_API_SECRET";
String data = "data1=value1&data2=value2";
data = URLEncoder.encode(data);
try {
  Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
  SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
  sha256_HMAC.init(secret_key);
  String hash = Base64.getEncoder().encodeToString(sha256_HMAC.doFinal(data.getBytes("UTF-8")));
  System.out.print(hash);
} catch (Exception e) {

}
# head
using System.Text;
using System.Security.Cryptography;

# function
string key = "API-SECRET";
string message = "data1=value1&data2=value2";

byte[] keyByte = new UTF8Encoding().GetBytes(key);
byte[] messageBytes = new UTF8Encoding().GetBytes(message);
byte[] hashmessage = new HMACSHA256(keyByte).ComputeHash(messageBytes);

var signature = Convert.ToBase64String(hashmessage);
A binary file was returned

You couldn't be authenticated

{"status":"success","data":[{"id":1}]}

Query Params

instance
string
required

Your Payrexx instance name

 

This endpoint can be used to verify the INSTANCE_API_SECRET to be correct. In case it is not correct, you get an error status.

200

OK

Everything worked successfully!

403

Forbidden

The API Signature is wrong

404

Not Found

The requested endpoint does not exist

All errors will return a JSON in the following format:

{
	status: "error",
  message: "An error occurred: Human readable message goes here"
}
Suggest Edits

Retrieve a payment link

 
gethttp://api.payrexx.com/v1.0/Invoice/id/
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request GET "https://api.payrexx.com/v1.0/Invoice/1/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature"
<?php
// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'INSTANCE_API_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$invoice = new \Payrexx\Models\Request\Invoice();
$invoice->setId(1);
try {
    $response = $payrexx->getOne($invoice);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
import urllib.request
import hmac
import hashlib
import base64
import json

post_data = {}

data = urllib.parse.urlencode(post_data).encode('UTF-8')

dig = hmac.new(b'INSTANCE_API_SECRET', msg=data, digestmod=hashlib.sha256).digest()
post_data['ApiSignature'] = base64.b64encode(dig).decode()
post_data['instance'] = 'INSTANCE_NAME'

data = urllib.parse.urlencode(post_data)

result = urllib.request.urlopen('https://api.payrexx.com/v1.0/Invoice/1/?' + data)
content = result.read().decode('UTF-8')
response = json.loads(content)
invoice = response['data'][0]
print(invoice)
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "status": "(waiting|confirmed|authorized|reserved)",
            "hash": "382c85eab7a86278e3c3b06a23af2358",
            "referenceId": "Order number of my online shop application",
            "link": "https://demo.payrexx.com/?payment=382c85eab7a86278e3c3b06a23af2358",
            "invoices": [],
            "preAuthorization": 0,
            "name": "Online-Shop payment #001",
            "api": true,
            "fields": {
                "title": {
                    "active": true,
                    "mandatory": true
                },
                "forename": {
                    "active": true,
                    "mandatory": true
                },
                "surname": {
                    "active": true,
                    "mandatory": true
                },
                "company": {
                    "active": true,
                    "mandatory": true
                },
                "street": {
                    "active": false,
                    "mandatory": false
                },
                "postcode": {
                    "active": false,
                    "mandatory": false
                },
                "place": {
                    "active": false,
                    "mandatory": false
                },
                "country": {
                    "active": true,
                    "mandatory": true
                },
                "phone": {
                    "active": false,
                    "mandatory": false
                },
                "email": {
                    "active": true,
                    "mandatory": true
                },
                "date_of_birth": {
                    "active": false,
                    "mandatory": false
                },
                "terms": {
                    "active": true,
                    "mandatory": true
                },
                "custom_field_1": {
                    "active": true,
                    "mandatory": true,
                    "names": {
                        "de": "This is a field",
                        "en": "This is a field",
                        "fr": "This is a field",
                        "it": "This is a field"
                    }
                },
                "custom_field_2": {
                    "active": false,
                    "mandatory": false,
                    "names": {
                        "de": "",
                        "en": "",
                        "fr": "",
                        "it": ""
                    }
                },
                "custom_field_3": {
                    "active": false,
                    "mandatory": false,
                    "names": {
                        "de": "",
                        "en": "",
                        "fr": "",
                        "it": ""
                    }
                }
            },
            "psp": 1,
            "purpose": "Shop Order #001",
            "amount": 590,
            "currency": "CHF",
            "subscriptionState": false,
            "subscriptionInterval": "",
            "subscriptionPeriod": "",
            "subscriptionPeriodMinAmount": 0,
            "subscriptionCancellationInterval": "",
            "createdAt": 1418392958
        }
    ]
}
Payrexx\Models\Response\Invoice::__set_state(array(
   'hash' => '382c85eab7a86278e3c3b06a23af2358',
   'link' => 'https://demo.payrexx.com/?payment=382c85eab7a86278e3c3b06a23af2358',
   'status' => '(waiting|confirmed|authorized|reserved)',
   'createdAt' => 1418392958,
   'referenceId' => 'Order number of my online shop application',
   'title' => '',
   'description' => '',
   'psp' => 1,
   'name' => 'Online-Shop payment #001',
   'purpose' => 'Shop Order #001',
   'amount' => 590,
   'currency' => 'CHF',
   'preAuthorization' => 0,
   'successRedirectUrl' => NULL,
   'failedRedirectUrl' => NULL,
   'subscriptionState' => false,
   'subscriptionInterval' => '',
   'subscriptionPeriod' => '',
   'subscriptionPeriodMinAmount' => '',
   'subscriptionCancellationInterval' => '',
   'fields' => 
  array (
    'title' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'forename' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'surname' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'company' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'street' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'postcode' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'place' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'country' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'phone' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'email' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'date_of_birth' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'terms' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'custom_field_1' => 
    array (
      'active' => true,
      'mandatory' => true,
      'names' => 
      array (
        'de' => 'This is a field',
        'en' => 'This is a field',
        'fr' => 'This is a field',
        'it' => 'This is a field',
      ),
    ),
    'custom_field_2' => 
    array (
      'active' => false,
      'mandatory' => false,
      'names' => 
      array (
        'de' => '',
        'en' => '',
        'fr' => '',
        'it' => '',
      ),
    ),
    'custom_field_3' => 
    array (
      'active' => false,
      'mandatory' => false,
      'names' => 
      array (
        'de' => '',
        'en' => '',
        'fr' => '',
        'it' => '',
      ),
    ),
    'custom_field_4' => 
    array (
      'active' => false,
      'mandatory' => false,
      'names' => 
      array (
        'de' => '',
        'en' => '',
        'fr' => '',
        'it' => '',
      ),
    ),
    'custom_field_5' => 
    array (
      'active' => false,
      'mandatory' => false,
      'names' => 
      array (
        'de' => '',
        'en' => '',
        'fr' => '',
        'it' => '',
      ),
    ),
  ),
   'id' => 1,
))
{  
   'referenceId':'test',
   'hash':'1fc5588c482e5e787eb271555b979f98',
   'subscriptionState':False,
   'status':'(waiting|confirmed|authorized|reserved)',
   'name':'',
   'amount':200,
   'link':'https://demo.payrexx.com/?payment=1fc5588c482e5e787eb271555b979f98',
   'preAuthorization':0,
   'subscriptionPeriodMinAmount':0,
   'id':38,
   'createdAt':1481923840,
   'currency':'CHF',
   'subscriptionInterval':'',
   'purpose':{  
      '7':'test',
      '2':'test',
      '1':'test',
      '3':'test',
      '4':'test'
   },
   'api':True,
   'subscriptionCancellationInterval':'',
   'fields':{  
      'header':{  
         'names':{  
            'nl':'',
            'de':'Kontaktdaten',
            'it':'Dati di contatto',
            'en':'Contact details',
            'fr':'Données de contact'
         },
         'active':True,
         'mandatory':False
      }
   },
   'title':'test',
   'psp':1,
   'description':'test',
   'subscriptionPeriod':'',
   'invoices':[  

   ]
}

Path Params

id
int32
required

The id of the Invoice to retrieve.

Query Params

instance
string
required

Your Payrexx instance name

 

Secure payment process using this endpoint

You could use this endpoint, for example, to verify a webhook you have received.
You get a webhook for a successful payment and you would like to check whether this Invoice has actually been paid.

Suggest Edits

Create a payment link

 
posthttp://api.payrexx.com/v1.0/Invoice/
apiSignature=`echo -n "title=Test&description=Testdescription&psp=1&referenceId=test&purpose=This+is+a+test&amount=200&currency=CHF&preAuthorization=0&reservation=0" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request POST "https://api.payrexx.com/v1.0/Invoice/?instance=INSTANCE_NAME" \
  --data-urlencode "title=Test" \
  --data-urlencode "description=Testdescription" \
  --data-urlencode "psp=1" \
  --data-urlencode "referenceId=test" \
  --data-urlencode "purpose=This is a test" \
  --data-urlencode "amount=200" \
  --data-urlencode "currency=CHF" \
  --data-urlencode "preAuthorization=0" \
  --data-urlencode "reservation=0" \
  --data-urlencode "ApiSignature=$apiSignature"
<?php
// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'INSTANCE_API_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

// init empty request object
$invoice = new \Payrexx\Models\Request\Invoice();

// info for payment link (reference id)
$invoice->setReferenceId('Order number of my online shop application');

// info for payment page (title, description)
$invoice->setTitle('Online shop payment');
$invoice->setDescription('Thanks for using Payrexx to pay your order');

// administrative information, which provider to use (psp)
// psp #1 = Payrexx' test mode, see http://developers.payrexx.com/en/REST-API/Miscellaneous
$invoice->setPsp(1);

// internal data only displayed to administrator
$invoice->setName('Online-Shop payment #001');

// payment information
$invoice->setPurpose('Shop Order #001');
$amount = 5.90;
// don't forget to multiply by 100
$invoice->setAmount($amount * 100);
// ISO code of currency, list of alternatives can be found here
// http://developers.payrexx.com/en/REST-API/Miscellaneous
$invoice->setCurrency('CHF');

// whether charge payment manually at a later date (type authorization)
$invoice->setPreAuthorization(false);

// whether charge payment manually at a later date (type reservation)
$invoice->setReservation(false);

// subscription information if you want the customer to authorize a recurring payment
// NOTE: This functionality is currently only available by using PAYMILL as a payment service provider. This also does not work in combination with pre-authorization payments.
//$invoice->setSubscriptionState(true);
//$invoice->setSubscriptionInterval('P1M');
//$invoice->setSubscriptionPeriod('P1Y');
//$invoice->setSubscriptionCancellationInterval('P3M');

// add contact information fields which should be filled by customer
// it would be great to provide at least an email address field
$invoice->addField($type = 'email', $mandatory = true, $defaultValue = 'my-customer@example.com');
$invoice->addField($type = 'company', $mandatory = true, $defaultValue = 'Ueli Kramer Firma');
$invoice->addField($type = 'forename', $mandatory = true, $defaultValue = 'Ueli');
$invoice->addField($type = 'surname', $mandatory = true, $defaultValue = 'Kramer');
$invoice->addField($type = 'country', $mandatory = true, $defaultValue = 'AT');
$invoice->addField($type = 'title', $mandatory = true, $defaultValue = 'miss');
$invoice->addField($type = 'terms', $mandatory = true);
$invoice->addField($type = 'custom_field_1', $mandatory = true, $defaultValue = 'Value 001', $name = 'Das ist ein Feld');

// fire request with created and filled link request-object.
try {
    $response = $payrexx->create($invoice);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
import urllib.request
import hmac
import hashlib
import base64
import json

post_data = {
    "title": "test",
    "description": "test",
    "psp": 1,
    "referenceId": "test",
    "purpose": "test",
    "amount": 200,
    "currency": "CHF",
    "preAuthorization": 0,
    "reservation": 0,
}

data = urllib.parse.urlencode(post_data).encode('UTF-8')

dig = hmac.new(b'INSTANCE_API_SECRET', msg=data, digestmod=hashlib.sha256).digest()
post_data['ApiSignature'] = base64.b64encode(dig).decode()

data = urllib.parse.urlencode(post_data).encode('UTF-8')

result = urllib.request.urlopen('https://api.payrexx.com/v1.0/Invoice/?instance=INSTANCE_NAME', data)
content = result.read().decode('UTF-8')
response = json.loads(content)
invoice = response['data'][0]
print(invoice)
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "hash": "382c85eab7a86278e3c3b06a23af2358",
            "referenceId": "Order number of my online shop application",
            "link": "https://demo.payrexx.com/?payment=382c85eab7a86278e3c3b06a23af2358",
            "invoices": [],
            "preAuthorization": 0,
            "reservation": 0,
            "name": "Online-Shop payment #001",
            "api": true,
            "fields": {
                "title": {
                    "active": true,
                    "mandatory": true
                },
                "forename": {
                    "active": true,
                    "mandatory": true
                },
                "surname": {
                    "active": true,
                    "mandatory": true
                },
                "company": {
                    "active": true,
                    "mandatory": true
                },
                "street": {
                    "active": false,
                    "mandatory": false
                },
                "postcode": {
                    "active": false,
                    "mandatory": false
                },
                "place": {
                    "active": false,
                    "mandatory": false
                },
                "country": {
                    "active": true,
                    "mandatory": true
                },
                "phone": {
                    "active": false,
                    "mandatory": false
                },
                "email": {
                    "active": true,
                    "mandatory": true
                },
                "date_of_birth": {
                    "active": false,
                    "mandatory": false
                },
                "terms": {
                    "active": true,
                    "mandatory": true
                },
                "custom_field_1": {
                    "active": true,
                    "mandatory": true,
                    "names": {
                        "de": "This is a field",
                        "en": "This is a field",
                        "fr": "This is a field",
                        "it": "This is a field"
                    }
                },
                "custom_field_2": {
                    "active": false,
                    "mandatory": false,
                    "names": {
                        "de": "",
                        "en": "",
                        "fr": "",
                        "it": ""
                    }
                },
                "custom_field_3": {
                    "active": false,
                    "mandatory": false,
                    "names": {
                        "de": "",
                        "en": "",
                        "fr": "",
                        "it": ""
                    }
                }
            },
            "psp": 1,
            "purpose": "Shop Order #001",
            "amount": 590,
            "currency": "CHF",
            "subscriptionState": false,
            "subscriptionInterval": "",
            "subscriptionPeriod": "",
            "subscriptionPeriodMinAmount": "",
            "subscriptionCancellationInterval": "",
            "createdAt": 1418392958
        }
    ]
}
Payrexx\Models\Response\Invoice::__set_state(array(
   'hash' => '382c85eab7a86278e3c3b06a23af2358',
   'link' => 'https://demo.payrexx.com/?payment=382c85eab7a86278e3c3b06a23af2358',
   'status' => 'waiting',
   'createdAt' => 1418392958,
   'referenceId' => 'Order number of my online shop application',
   'title' => '',
   'description' => '',
   'psp' => 1,
   'name' => 'Online-Shop payment #001',
   'purpose' => 'Shop Order #001',
   'amount' => 590,
   'currency' => 'CHF',
   'preAuthorization' => 0,
   'reservation' => 0,
   'successRedirectUrl' => NULL,
   'failedRedirectUrl' => NULL,
   'subscriptionState' => false,
   'subscriptionInterval' => '',
   'subscriptionPeriod' => '',
   'subscriptionPeriodMinAmount' => '',
   'subscriptionCancellationInterval' => '',
   'fields' => 
  array (
    'title' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'forename' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'surname' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'company' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'street' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'postcode' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'place' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'country' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'phone' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'email' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'date_of_birth' => 
    array (
      'active' => false,
      'mandatory' => false,
    ),
    'terms' => 
    array (
      'active' => true,
      'mandatory' => true,
    ),
    'custom_field_1' => 
    array (
      'active' => true,
      'mandatory' => true,
      'names' => 
      array (
        'de' => 'This is a field',
        'en' => 'This is a field',
        'fr' => 'This is a field',
        'it' => 'This is a field',
      ),
    ),
    'custom_field_2' => 
    array (
      'active' => false,
      'mandatory' => false,
      'names' => 
      array (
        'de' => '',
        'en' => '',
        'fr' => '',
        'it' => '',
      ),
    ),
    'custom_field_3' => 
    array (
      'active' => false,
      'mandatory' => false,
      'names' => 
      array (
        'de' => '',
        'en' => '',
        'fr' => '',
        'it' => '',
      ),
    ),
    'custom_field_4' => 
    array (
      'active' => false,
      'mandatory' => false,
      'names' => 
      array (
        'de' => '',
        'en' => '',
        'fr' => '',
        'it' => '',
      ),
    ),
    'custom_field_5' => 
    array (
      'active' => false,
      'mandatory' => false,
      'names' => 
      array (
        'de' => '',
        'en' => '',
        'fr' => '',
        'it' => '',
      ),
    ),
  ),
   'id' => 8,
))
{  
   'amount':200,
   'api':True,
   'createdAt':1481923840,
   'currency':'CHF',
   'description':'test',
   'fields':{  
      'header':{  
         'active':True,
         'mandatory':False,
         'names':{  
            'de':'Kontaktdaten',
            'en':'Contact details',
            'fr':'Données de contact',
            'it':'Dati di contatto',
            'nl':''
         }
      }
   },
   'hash':'382c85eab7a86278e3c3b06a23af2358',
   'id':8,
   'invoices':[  

   ],
   'preAuthorization':0,
   'reservation':0,
   'link':'https://demo.payrexx.com/?payment=382c85eab7a86278e3c3b06a23af2358',
   'name':'',
   'psp':1,
   'purpose':{  
      '1':'test',
      '2':'test',
      '3':'test',
      '4':'test',
      '7':'test'
   },
   'referenceId':'test',
   'status':'waiting',
   'subscriptionCancellationInterval':'',
   'subscriptionInterval':'',
   'subscriptionPeriod':'',
   'subscriptionPeriodMinAmount':'',
   'subscriptionState':False,
   'title':'test'
}

Query Params

instance
string
required

Your Payrexx instance name

Body Params

title
string
required

This is the page title which will be shown on the payment page.

description
string
required

This is a description which will be shown on the payment page.

psp
mixed type

The psp which should be used for the payment. (Can be an array of integers.)

referenceId
string
required

An internal reference id used by your system.

purpose
string
required

The purpose of the payment.

amount
int32
required

The amount of the payment in cents.

currency
string
required

The currency of the payment.

preAuthorization
boolean

Whether charge payment manually at a later date (type authorization).

reservation
boolean

Whether charge payment manually at a later date (type reservation).

name
string

This is an internal name of the payment page. This name will be displayed to the administrator only.

fields
array of strings

The contact data fields which should be displayed. See fields for more

hideFields
boolean

Hide the whole contact fields section on invoice page

concardisOrderId
string

Only available for Concardis PSP and if the custom ORDERID option is activated in PSP settings in Payrexx administration. This ORDERID will be transferred to the Payengine.

 

Use Invoice with Modal Box

To connect the created Invoice with the payment (Transaction), you must use the link provided in the response from POST as href of your modal box markup or build it yourself from the also provided hash.

Using the referenceId for that purpose will not work as expected, even when the demo results suggest that in some vague way.

Connecting your application with our Payrexx payment

If you have set up a webshop and would like to integrate Payrexx as your payment solution then it is necessary for you to create an invoice in the Payrexx system which you can then display as a payment form to the customer.

The response generates an Invoice ID which you can use to identify the successful payment. (see the chapter "Webhooks" for more information)

Suggest Edits

Remove a payment link

 
deletehttp://api.payrexx.com/v1.0/Invoice/id/
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request DELETE "https://api.payrexx.com/v1.0/Invoice/1/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature"
<?php
// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'INSTANCE_API_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

// init empty request object
$invoice = new \Payrexx\Models\Request\Invoice();
$invoice->setId(1);

// fire request with created and filled link request-object.
try {
    $response = $payrexx->delete($invoice);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "data": [
        {
            "id": 1
        }
    ]
}
Payrexx\Models\Response\Invoice::__set_state(array(
   'id' => 1,
))

Path Params

id
int32
required

The id of the invoice to delete

Query Params

instance
string
required

Your Payrexx instance name

 
Suggest Edits

Log in a subscription customer

 
posthttp://api.payrexx.com/v1.0/AuthToken/
apiSignature=`echo -n "userId=1" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request POST "https://api.payrexx.com/v1.0/AuthToken/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature" --data-urlencode "userId=1"
<?php
// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'INSTANCE_API_SECRET';
$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

// init empty request object
$authToken = new \Payrexx\Models\Request\AuthToken();

// info for auth token (user id)
$authToken->setUserId(1);

// fire request with created and filled authToken request-object.
try {
    $response = $payrexx->create($authToken);
    
    // response data can get accessed like this
    $authToken = $response->getAuthToken();
    $authTokenExpirationDate = $response->getAuthTokenExpirationDate();
    $link = $response->getLink();
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
A binary file was returned

You couldn't be authenticated

{
	status: "success",
  data: [
  	{
    	userId: 1,
      authToken: "b0b0d62f4872ce5c45377b3bedd8185f",
      authTokenExpirationDate: "2015-07-14 14:00:00",
      link: "https://demo.payrexx.com/?auth_token=b0b0d62f4872ce5c45377b3bedd8185f"
    }
  ]
}
Payrexx\Models\Response\AuthToken::__set_state(array(
   'authToken' => 'b0b0d62f4872ce5c45377b3bedd8185f',
   'authTokenExpirationDate' => '2015-07-14 14:00:00',
   'link' => 'https://demo.payrexx.com/?auth_token=b0b0d62f4872ce5c45377b3bedd8185f',
))

Query Params

instance
string

Your Payrexx instance name

Body Params

userId
int32
required

The contact id you received through webhook data.

 

If you configured recurring payments (subscriptions), Payrexx will automatically create user accounts for your customers. So your users can administrate the subscriptions and cancel them on Payrexx' site.

Often they don't know where to cancel the subscription. You can provide a link which will directly log them in to your Payrexx page where they can cancel subscriptions, change payment information and more.

The userId for this endpoint will be included in the subscription's webhook.

First your application requests a new authentication link. This means you get a link based on a contact id (param: userId) which you received through a Payrexx Webhook.

You can display the link to your user, or automatically redirect your user. After a click on the link the user will be automatically logged in. This means the customer can then see all fired payments and all subscriptions.

Suggest Edits

Create a new subscription

 
posthttp://api.payrexx.com/v1.0/Subscription/
<?php
// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'YOUR_INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'YOUR_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$subscription = new \Payrexx\Models\Request\Subscription();
$subscription->setUserId(1);
$subscription->setPsp(4);
$subscription->setPurpose('Test');
$subscription->setAmount(100);
$subscription->setCurrency('CHF');
$subscription->setPaymentInterval('P1M');
$subscription->setPeriod('P1Y');
$subscription->setCancellationInterval('P1M');
try {
    $response = $payrexx->create($subscription);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "status": "active",
            "start": "2014-12-18",
            "end": null,
            "valid_until": "2015-01-18",
            "invoice": {
                "number": "Test subscription",
                "amount": 1,
                "currency": "CHF",
                "referenceId": "",
                "paymentRequestId": null,
                "paymentLink": null
            },
            "contact": {
                "id": 1,
                "title": "",
                "firstname": "",
                "lastname": "",
                "company": "",
                "street": "",
                "zip": "",
                "place": "",
                "country": "",
                "countryISO": "",
                "phone": "",
                "email": "user@example.com",
                "date_of_birth": ""
            }
        }
    ]
}

Query Params

instance
string
required

Your Payrexx instance name

Body Params

userId
string
required

The contact id you got from webhook.

psp
string
required

The ID of the psp to use.

amount
string
required

The amount of the payment to fire in cents.

currency
string
required

The ISO code of the currency of the payment.

purpose
string
required

The payment purpose. What is the payer paying for?

paymentInterval
string
required

The payment interval as string. (see PHP documentation of date interval for format)

period
string
required

The subscription's period as string. (see PHP documentation of date interval for format)

cancellationInterval
string
required

The interval of cancellation as string. (see PHP documentation of date interval for format)

referenceId
string

The internal reference id. (Will be sent back with Webhook, can be used as identification)

 

Experimental documentation state

This functionality is already in productional use, but the documentation might contain some errors. Please contact us if you are interested in handling Subscriptions through your own application.

Suggest Edits

Update a subscription

 
puthttp://api.payrexx.com/v1.0/Subscription/id/
<?php
// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'YOUR_INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'YOUR_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$subscription = new \Payrexx\Models\Request\Subscription();
$subscription->setId(1);
$subscription->setAmount(500);
$subscription->setCurrency('CHF');
try {
    $response = $payrexx->update($subscription);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "data": [
        {
            "id": 1,
            "status": "active",
            "start": "2014-12-18",
            "end": null,
            "valid_until": "2015-01-18",
            "invoice": {
                "number": "Test subscription",
                "amount": 1,
                "currency": "CHF",
                "referenceId": "",
                "paymentRequestId": null,
                "paymentLink": null
            },
            "contact": {
                "id": 1,
                "title": "",
                "firstname": "",
                "lastname": "",
                "company": "",
                "street": "",
                "zip": "",
                "place": "",
                "country": "",
                "countryISO": "",
                "phone": "",
                "email": "user@example.com",
                "date_of_birth": ""
            }
        }
    ]
}

Path Params

id
int32
required

The id of the subscription to retrieve.

Query Params

instance
string
required

Your Payrexx instance name

Body Params

amount
string

The new amount in cents which will be payed on the next payment interval.

currency
string

The ISO code of the currency of the payment.

purpose
string

The purpose of the payment

 

Experimental documentation state

This functionality is already in productional use, but the documentation might contain some errors. Please contact us if you are interested in handling Subscriptions through your own application.

Suggest Edits

Remove a subscription

 
deletehttp://api.payrexx.com/v1.0/Subscription/id/
<?php
$instanceName = %instanceName%;
$secret = %secret%;

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$subscription = new \Payrexx\Models\Request\Subscription();
$subscription->setId(1);
try {
    $response = $payrexx->cancel($subscription);
} catch (\Payrexx\PayrexxException $e) {
    die($e->getMessage());
}
A binary file was returned

You couldn't be authenticated

{
  "status":"success",
  "data":[
    {
      "id":1,
      "status":"cancelled"
    }
  ]
}

Path Params

id
int32
required

The id of the subscription to delete.

Query Params

instance
string
required

Your Payrexx instance name

 

Experimental documentation state

This functionality is already in productional use, but the documentation might contain some errors. Please contact us if you are interested in handling Subscriptions through your own application.

Suggest Edits

Retrieve a Payrexx Gateway

 
gethttp://api.payrexx.com/v1.0/Gateway/id/
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request GET "https://api.payrexx.com/v1.0/Gateway/1/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature"
<?php

// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'YOUR_INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'YOUR_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$gateway = new \Payrexx\Models\Request\Gateway();
$gateway->setId(1);

try {
    $response = $payrexx->getOne($gateway);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
import urllib.request
import hmac
import hashlib
import base64
import json

post_data = {}

data = urllib.parse.urlencode(post_data).encode('UTF-8')

dig = hmac.new(b'INSTANCE_API_SECRET', msg=data, digestmod=hashlib.sha256).digest()
post_data['ApiSignature'] = base64.b64encode(dig).decode()
post_data['instance'] = 'INSTANCE_NAME'

data = urllib.parse.urlencode(post_data)

result = urllib.request.urlopen('https://api.payrexx.com/v1.0/Gateway/1/?' + data)
content = result.read().decode('UTF-8')
response = json.loads(content)
gateway = response['data'][0]
print(gateway)
A binary file was returned

You couldn't be authenticated

{  
    "status":"success",
    "data":[  
        {  
            "id":1,
            "status":"waiting",
            "hash":"db8c618c87dc91f100292f6ffd9c5044",
            "referenceId":"975382",
            "link":"https:\/\/demo.payrexx.com\/?payment=db8c618c87dc91f100292f6ffd9c5044",
            "invoices":[],
            "preAuthorization":0,
            "fields":{  
                "title":{  
                    "active":false,
                    "mandatory":true
                },
                "forename":{  
                    "active":false,
                    "mandatory":true
                },
                "surname":{  
                    "active":false,
                    "mandatory":true
                },
                "company":{  
                    "active":false,
                    "mandatory":true
                },
                "street":{  
                    "active":false,
                    "mandatory":true
                },
                "postcode":{  
                    "active":false,
                    "mandatory":true
                },
                "place":{  
                    "active":false,
                    "mandatory":true
                },
                "country":{  
                    "active":false,
                    "mandatory":true
                },
                "phone":{  
                    "active":false,
                    "mandatory":true
                },
                "email":{  
                    "active":false,
                    "mandatory":true
                },
                "date_of_birth":{  
                    "active":false,
                    "mandatory":true,
                    "names":{  
                        "de":"",
                        "en":"",
                        "fr":"",
                        "it":""
                    }
                },
                "text":{  
                    "active":false,
                    "mandatory":true,
                    "names":{  
                        "de":"Benutzerdefiniertes Feld (DE)",
                        "en":"Benutzerdefiniertes Feld (EN)",
                        "fr":"Benutzerdefiniertes Feld (FR)",
                        "it":"Benutzerdefiniertes Feld (IT)"
                    }
                }
            },
            "psp":[],
            "amount":8925,
            "currency":"CHF",
            "createdAt":1475578052
        }
    ]
}

Path Params

id
int32
required

ID of gateway payment to retrieve.

Query Params

instance
string
required

Your Payrexx instance name

 

Integration manual

For more information about the usage of Payrexx Gateway, please visit Payrexx Gateway section.

Secure payment process using this endpoint

You could use this endpoint, for example, to verify a webhook you have received.
You get a webhook for a successful payment and you would like to check whether this gateway payment has actually been paid.

Suggest Edits

Create a Payrexx Gateway

 
posthttp://api.payrexx.com/v1.0/Gateway/
apiSignature=`echo -n "amount=8925&currency=CHF&preAuthorization=0&reservation=0&referenceId=975382&fields%5Bforename%5D%5Bvalue%5D=Max&fields%5Bsurname%5D%5Bvalue%5D=Mustermann&fields%5Bemail%5D%5Bvalue%5D=max.mustermann%40mysite.com&successRedirectUrl=https%3A%2F%2Fwww.merchant-website.com%2Fsuccess&failedRedirectUrl=https%3A%2F%2Fwww.merchant-website.com%2Ffailed" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request POST "https://api.payrexx.com/v1.0/Gateway/?instance=INSTANCE_NAME" \
  --data-urlencode "amount=8925" \
  --data-urlencode "currency=CHF" \
  --data-urlencode "preAuthorization=0" \
  --data-urlencode "reservation=0" \
  --data-urlencode "referenceId=975382" \
  --data-urlencode "fields[forename][value]=Max" \
  --data-urlencode "fields[surname][value]=Mustermann" \
  --data-urlencode "fields[email][value]=max.mustermann@mysite.com" \
  --data-urlencode "successRedirectUrl=https://www.merchant-website.com/success" \
  --data-urlencode "failedRedirectUrl=https://www.merchant-website.com/failed" \
  --data-urlencode "ApiSignature=$apiSignature"
<?php

// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'YOUR_INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'YOUR_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$gateway = new \Payrexx\Models\Request\Gateway();

// amount multiplied by 100
$gateway->setAmount(89.25 * 100);

// currency ISO code
$gateway->setCurrency('CHF');

//success and failed url in case that merchant redirects to payment site instead of using the modal view
$gateway->setSuccessRedirectUrl('https://www.merchant-website.com/success');
$gateway->setFailedRedirectUrl('https://www.merchant-website.com/failed');

// optional: payment service provider(s) to use (see http://developers.payrexx.com/docs/miscellaneous)
// empty array = all available psps
$gateway->setPsp(array());
//$gateway->setPm(array('mastercard'));

// optional: whether charge payment manually at a later date (type authorization)
$gateway->setPreAuthorization(false);

// optional: whether charge payment manually at a later date (type reservation)
$gateway->setReservation(false);

// optional: reference id of merchant (e. g. order number)
$gateway->setReferenceId(975382);

// optional: add contact information which should be stored along with payment
$gateway->addField($type = 'title', $value = 'mister');
$gateway->addField($type = 'forename', $value = 'Maximilian');
$gateway->addField($type = 'surname', $value = 'Pichler');
$gateway->addField($type = 'company', $value = 'Pichler Solutions');
$gateway->addField($type = 'street', $value = 'Seeweg 123');
$gateway->addField($type = 'postcode', $value = '1234');
$gateway->addField($type = 'place', $value = 'Englach');
$gateway->addField($type = 'country', $value = 'AT');
$gateway->addField($type = 'phone', $value = '+43123456789');
$gateway->addField($type = 'email', $value = 'info@pichler-solutions.com');
$gateway->addField($type = 'date_of_birth', $value = '03.06.1985');
$gateway->addField($type = 'custom_field_1', $value = '123456789', $name = array(
    1 => 'Benutzerdefiniertes Feld (DE)',
    2 => 'Benutzerdefiniertes Feld (EN)',
    3 => 'Benutzerdefiniertes Feld (FR)',
    4 => 'Benutzerdefiniertes Feld (IT)',
));

try {
    $response = $payrexx->create($gateway);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
import urllib.request
import hmac
import hashlib
import base64
import json

post_data = {
    "amount": 8925,
    "currency": "CHF",
    "preAuthorization": 0,
    "reservation": 0,
    "successRedirectUrl": "https://www.merchant-website.com/success",
    "failedRedirectUrl": "https://www.merchant-website.com/failed"
}

data = urllib.parse.urlencode(post_data).encode('UTF-8')

dig = hmac.new(b'INSTANCE_API_SECRET', msg=data, digestmod=hashlib.sha256).digest()
post_data['ApiSignature'] = base64.b64encode(dig).decode()

data = urllib.parse.urlencode(post_data).encode('UTF-8')

result = urllib.request.urlopen('https://api.payrexx.com/v1.0/Gateway/?instance=INSTANCE_NAME', data)
content = result.read().decode('UTF-8')
response = json.loads(content)
gateway = response['data'][0]
print(gateway)
A binary file was returned

You couldn't be authenticated

{  
    "status":"success",
    "data":[  
        {  
            "id":1,
            "status":"waiting",
            "hash":"db8c618c87dc91f100292f6ffd9c5044",
            "referenceId":"975382",
            "link":"https:\/\/demo.payrexx.com\/?payment=db8c618c87dc91f100292f6ffd9c5044",
            "invoices":[],
            "preAuthorization":0,
            "reservation":0,
            "fields":{  
                "title":{  
                    "active":false,
                    "mandatory":true
                },
                "forename":{  
                    "active":false,
                    "mandatory":true
                },
                "surname":{  
                    "active":false,
                    "mandatory":true
                },
                "company":{  
                    "active":false,
                    "mandatory":true
                },
                "street":{  
                    "active":false,
                    "mandatory":true
                },
                "postcode":{  
                    "active":false,
                    "mandatory":true
                },
                "place":{  
                    "active":false,
                    "mandatory":true
                },
                "country":{  
                    "active":false,
                    "mandatory":true
                },
                "phone":{  
                    "active":false,
                    "mandatory":true
                },
                "email":{  
                    "active":false,
                    "mandatory":true
                },
                "date_of_birth":{  
                    "active":false,
                    "mandatory":true,
                    "names":{  
                        "de":"",
                        "en":"",
                        "fr":"",
                        "it":""
                    }
                },
                "text":{  
                    "active":false,
                    "mandatory":true,
                    "names":{  
                        "de":"Benutzerdefiniertes Feld (DE)",
                        "en":"Benutzerdefiniertes Feld (EN)",
                        "fr":"Benutzerdefiniertes Feld (FR)",
                        "it":"Benutzerdefiniertes Feld (IT)"
                    }
                }
            },
            "psp":[],
            "amount":8925,
            "currency":"CHF",
            "createdAt":1475578052
        }
    ]
}
{  
   'createdAt':1481924665,
   'amount':8925,
   'hash':'2665a4aa5508f2451df403ba04314477',
   'psp':0,
   'link':'https://demo.payrexx.com/?payment=2665a4aa5508f2451df403ba04314477',
   'currency':'CHF',
   'referenceId':'',
   'status':'waiting',
   'id':1,
   'invoices':[  

   ],
   'preAuthorization':0,
   'reservation':0,
   'fields':[  

   ]
}

Query Params

instance
string
required

Your Payrexx instance name

Body Params

amount
int32
required

Amount of payment in cents.

currency
string
required

Currency of payment (ISO code).

purpose
string

The purpose of the payment.

successRedirectUrl
string

URL to redirect to after successful payment.

failedRedirectUrl
string

URL to redirect to after failed payment.

psp
array of integers

List of PSPs to provide for payment. If empty all available PSPs are provied.

pm
array of strings

List of payment mean names to display

preAuthorization
boolean

Whether charge payment manually at a later date (type authorization)

reservation
boolean

Whether charge payment manually at a later date (type reservation)

referenceId
string

An internal reference id used by your system.

fields
mixed type

The contact data fields which should be stored along with payment

concardisOrderId
string

Only available for Concardis PSP and if the custom ORDERID option is activated in PSP settings in Payrexx administration. This ORDERID will be transferred to the Payengine.

 

Using the PHP client library

If you are using our PHP client library, there are setter and getter methods to access the PHP object properties.

Integration manual

For more information about the usage of Payrexx Gateway, please visit Payrexx Gateway section.

Suggest Edits

Delete a Payrexx Gateway

 
deletehttp://api.payrexx.com/v1.0/Gateway/id/
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request DELETE "https://api.payrexx.com/v1.0/Gateway/1/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature"
<?php

// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'YOUR_INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'YOUR_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$gateway = new \Payrexx\Models\Request\Gateway();
$gateway->setId(1);

try {
    $response = $payrexx->delete($gateway);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
A binary file was returned

You couldn't be authenticated

{
    "status": "success",
    "data": [
        {
            "id": 1
        }
    ]
}

Path Params

id
int32
required

ID of gateway payment to delete.

Query Params

instance
string
required

Your Payrexx instance name

 

Integration manual

For more information about the usage of Payrexx Gateway, please visit Payrexx Gateway section.

Suggest Edits

Retrieve a Transaction

 
gethttp://api.payrexx.com/v1.0/Transaction/id/
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request GET "https://api.payrexx.com/v1.0/Transaction/1/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature"
<?php

// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'YOUR_INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'YOUR_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$transaction = new \Payrexx\Models\Request\Transaction();
$transaction->setId(1);

try {
    $response = $payrexx->getOne($transaction);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
import urllib.request
import hmac
import hashlib
import base64
import json

post_data = {}

data = urllib.parse.urlencode(post_data).encode('UTF-8')

dig = hmac.new(b'INSTANCE_API_SECRET', msg=data, digestmod=hashlib.sha256).digest()
post_data['ApiSignature'] = base64.b64encode(dig).decode()
post_data['instance'] = 'INSTANCE_NAME'

data = urllib.parse.urlencode(post_data)

result = urllib.request.urlopen('https://api.payrexx.com/v1.0/Transaction/1/?' + data)
content = result.read().decode('UTF-8')
response = json.loads(content)
transaction = response['data'][0]
print(transaction)
A binary file was returned

You couldn't be authenticated

{  
    "status":"success",
    "data":[  
        {  
            "id":1,
            "uuid":"7528a35b",
            "time":"2017-10-16 11:29:12",
            "status":"pre-authorized",
            "lang":"de",
            "psp":"Payrexx_Payments"
        }
    ]
}

Path Params

id
int32
required

ID of transaction to retrieve.

Query Params

instance
string
required

Your Payrexx instance name.

 
Suggest Edits

Charge a Pre-Authorized/Reserved Transaction

 
posthttp://api.payrexx.com/v1.0/Transaction/
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request POST "https://api.payrexx.com/v1.0/Transaction/2/?instance=INSTANCE_NAME" \
  --data-urlencode "amount=8925" \
  --data-urlencode "ApiSignature=$apiSignature"
<?php

// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'YOUR_INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'YOUR_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$transaction = new \Payrexx\Models\Request\Transaction();
$transaction->setId(2);

// amount multiplied by 100
$transaction->setAmount(89.25 * 100);

try {
    $response = $payrexx->charge($transaction);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
A binary file was returned

You couldn't be authenticated

{  
    "status":"success",
    "data":[  
        {  
            "id":2,
            "uuid":"81d545ca",
            "time":"2017-10-16 12:29:12",
            "status":"confirmed",
            "lang":"de",
            "psp":"Payrexx_Payments"
        }
    ]
}

Query Params

instance
string
required

Your Payrexx instance name

Body Params

amount
int32

Amount for charge in cents.

 
Suggest Edits

Retrieve all Payment Providers

 
gethttp://api.payrexx.com/v1.0/PaymentProvider/:id/
apiSignature=`echo -n "" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request GET "https://api.payrexx.com/v1.0/PaymentProvider/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature"
<?php
// $instanceName is a part of the url where you access your payrexx installation.
// https://{$instanceName}.payrexx.com
$instanceName = 'YOUR_INSTANCE_NAME';

// $secret is the payrexx secret for the communication between the applications
// if you think someone got your secret, just regenerate it in the payrexx administration
$secret = 'YOUR_SECRET';

$payrexx = new \Payrexx\Payrexx($instanceName, $secret);

$paymentProvider = new \Payrexx\Models\Request\PaymentProvider();

try {
    $response = $payrexx->getAll($paymentProvider);
    var_dump($response);
} catch (\Payrexx\PayrexxException $e) {
    print $e->getMessage();
}
import urllib.request
import hmac
import hashlib
import base64
import json

post_data = {}

data = urllib.parse.urlencode(post_data).encode('UTF-8')

dig = hmac.new(b'INSTANCE_API_SECRET', msg=data, digestmod=hashlib.sha256).digest()
post_data['ApiSignature'] = base64.b64encode(dig).decode()
post_data['instance'] = 'INSTANCE_NAME'

data = urllib.parse.urlencode(post_data)

result = urllib.request.urlopen('https://api.payrexx.com/v1.0/PaymentProvider/?' + data)
content = result.read().decode('UTF-8')
response = json.loads(content)
transaction = response['data'][0]
print(transaction)
A binary file was returned

You couldn't be authenticated

{
  "status": "success",
  "data": [
    {
      "id": 12,
      "name": "PostFinance Alias Gateway",
      "paymentMethods": [
        "masterpass",
        "mastercard",
        "visa",
        "american_express",
        "diners_club",
        "jcb",
        "discover",
        "postfinance_card",
        "postfinance_efinance"
      ],
      "activePaymentMethods": [
        "postfinance_card",
        "postfinance_efinance"
      ]
    },
    {
      "id": 15,
      "name": "Rechnung",
      "paymentMethods": [
        "invoice"
      ],
      "activePaymentMethods": [
        "invoice"
      ]
    },
    {
      "id": 26,
      "name": "Payrexx Payments",
      "paymentMethods": {
        "0": "mastercard",
        "1": "visa",
        "2": "american_express",
        "3": "apple_pay",
        "4": "diners_club",
        "5": "jcb",
        "6": "discover",
        "11": "sepa",
        "12": "bancontact",
        "13": "giropay",
        "14": "ideal",
        "15": "sofortueberweisung_de",
        "16": "alipay"
      },
      "activePaymentMethods": [
        "mastercard",
        "visa"
      ]
    }
  ]
}

Query Params

instance
string
required

Your Payrexx instance name.