Barion Shop Authentication: Difference between revisions

From Barion Documentation
Jump to navigation Jump to search
m (added header parameter section)
m (removed mention of POST API endpoints)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
= What is shop authentication? =
= What is shop authentication? =


The API endpoints related to handling the payment flow of a shop are accessible using the shop's own unique API key, a so called <i>POS key</i>. For a full list of such endpoints see [[List_of_API_endpoints|List of Barion API endpoints]].
The API endpoints related to handling a shop's payment flow are accessible using the shop's own unique API key, known as <i>POS key</i>.
 
For a full list of such endpoints see [[List_of_API_endpoints|List of Barion API endpoints]].


= Using POS keys =
= Using POS keys =


To use an endpoint which requires shop-level authentication, put your API key in the request's body in a property named <code>PosKey</code>:
To use an endpoint which requires shop-level authentication, pass your Barion shop's POS key as the '''x-pos-key''' header parameter.
 
    {
      ...,
      "PosKey": "00000000-0000-0000-0000-000000000000",
      ...
    }
 
or in the case of a <tt>GET</tt> request, in the url query string with the same key.


{{NotificationBox|title=NOTE|text=<tt>GET</tt> API endpoints below v4 also accept the <code>PosKey</code> property as a query parameter.|color=#038Ed3}}
== Errors ==
== Errors ==


If the key is invalid you will receive an <code>AuthenticationFailed</code> error.
An invalid key generates an <code>AuthenticationFailed</code> error.


= Managing POS keys =
= Managing POS keys =
Line 23: Line 18:
A POS key is automatically generated for your shop when you create it, and cannot be changed later. To obtain it, either
A POS key is automatically generated for your shop when you create it, and cannot be changed later. To obtain it, either
* get the key from the confirmation e-mail that was sent to you when you opened the shop, or
* get the key from the confirmation e-mail that was sent to you when you opened the shop, or
* go to the shop's detail page on the [https://secure.barion.com Barion secure site] and use the <i>Secret key</i> value (secure.barion.com -> Manage my shops -> Details)
* go to the shop's detail page on the [https://secure.barion.com Barion secure site] and use the <i>Secret key</i> value (Shops -> Actions -> Details)
 
Be aware that the test and live environment are completely separate environments, you need to create different shops. Make sure that you use the POSkey and not the public key:
 
[[File:Poskey.jpg]]


= Header-based Barion shop authentication =
{{NotificationBox|title=NOTE|text=The test and live environment are completely separate environments, you need to create different shops. Make sure that you use the POSkey and not the public key:


The latest generation of Barion API endpoints require header-based authentication, that is, you'll need to pass your Barion shop's POS key as the <code>x-pos-key<code> header parameter instead of as a query parameter.
[[File:Poskey.jpg]] |color=#038Ed3}}

Latest revision as of 09:49, 24 April 2024

What is shop authentication?

The API endpoints related to handling a shop's payment flow are accessible using the shop's own unique API key, known as POS key.

For a full list of such endpoints see List of Barion API endpoints.

Using POS keys

To use an endpoint which requires shop-level authentication, pass your Barion shop's POS key as the x-pos-key header parameter.

NOTE
GET API endpoints below v4 also accept the PosKey property as a query parameter.

Errors

An invalid key generates an AuthenticationFailed error.

Managing POS keys

A POS key is automatically generated for your shop when you create it, and cannot be changed later. To obtain it, either

  • get the key from the confirmation e-mail that was sent to you when you opened the shop, or
  • go to the shop's detail page on the Barion secure site and use the Secret key value (Shops -> Actions -> Details)
NOTE
The test and live environment are completely separate environments, you need to create different shops. Make sure that you use the POSkey and not the public key: