Authorization

Environments

About API Authorization- Bearer Auth

In Protectmaxx API Bearer Auth is used for authentication.

Bearer authentication (also called token authentication) is an HTTP authentication scheme that involves security tokens called bearer tokens. The name “Bearer authentication” can be understood as “give access to the bearer of this token.” The bearer token is a cryptic string, usually generated by the server in response to a login request. The client must send this token in the Authorization header when making requests to protected resources:

Authorization: Bearer {token}

Example

For Example request we will use TEST environment. First we are creating POST Request to https://acc.paymaxx2.com/api/v1/merchant/login With this JSON in body
{
    "client_id": "a1f3ee53-669d-44e6-aa96-9017f178e81e",
    "client_secret": "b65c2b5b-2657-4a9c-aa7c-dcb12f6d23df"
}

Both client_id and client_secret you will receive upon registration to Protectmaxx.

Response to this request should be this

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiNWNhNzkwMDM2YmU1OWNlY2JhZTZmYmQ1NjIxNjI5MmFhNWE4Y2I0MjZlZDEyYzRkNDlkYzQzMjdhODg1NmZkNzQwZGVlNmFiZTRiODRiN2EiLCJpYXQiOjE2Njg2ODA2ODUuNzgyODkyLCJuYmYiOjE2Njg2ODA2ODUuNzgyODk2LCJleHAiOjE2Njg2ODQyODUuMzY5OTMxLCJzdWIiOiI1Iiwic2NvcGVzIjpbIm1lcmNoYW50Il19.M-P9_G5zsLhLpB6ZcWFrCjfJ2z-_eloajgVwbCmFH93aMXt1hCqNqDPmzwUNlvN9j14kJsB_5AU0qpL9ERUNI9Vy9VBT7wW3TnDjmVub1w0EyBMl9pDpd4yxfzgUKZFHHFLp01RVoai3qKxvWy6DntkydkOEwDL7_2jbGAX_NQbz7Cu7YWJb_B2TD4IL4c7bxbh6B8JFKnzYetrPwqYpyes2kTM4DlxLodCDF0Ede94TWX_0LoDVGbjyLBpC-6nLf8f2sciY4YHmY5hqWdISGSayVRP_GbV6K7s--5T_JR5nPURqDz6Y_FmGVF630bzHdu5iP6DldA21O0uTR2lzU-Qv5NyYUDqIzgnKps4AY8IJoUv_uNFlX7V0hz7X4RdT2cjPrp8BPKqq-5rLrdJJZI3ePEG3HPik2eZrLijKuJqvCozALFQrb7qhZFHSJhmelJuyiKy_na02z5loVP-f2x1jGACs7lj25kxH7OY51s26WVY3KrgZTGaDxrP91XyKTgHsSYNrcyC1nu8N8eRB5b5PrInDOgenu4EIFXUArBiOKiZJgEaxK1ABeAtqzLeut_hZPA5NqfnQLmA-a7qAVuI3Ek3r6lJ-LollxLcxoh9cOOkTkRwinMAVj0qOCCccvSyPhjWophKW3AYXORZrCdj8-BvFWfvs0c-0rvOh6QE"
    "expires_in": 3600,
    "token_type": "bearer"
}

You successfully authorized with Protectmaxx

Next example is how authorization is used in creation of Payment request. We will use creditcard Payment method for this example.

URL used for creating this request https://acc.paymaxx2.com/api/v1/payments

In HEADER of request we need to set Authorization token that we got so Header should look like this

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIxIiwianRpIjoiNWNhNzkwMDM2YmU1OWNlY2JhZTZmYmQ1NjIxNjI5MmFhNWE4Y2I0MjZlZDEyYzRkNDlkYzQzMjdhODg1NmZkNzQwZGVlNmFiZTRiODRiN2EiLCJpYXQiOjE2Njg2ODA2ODUuNzgyODkyLCJuYmYiOjE2Njg2ODA2ODUuNzgyODk2LCJleHAiOjE2Njg2ODQyODUuMzY5OTMxLCJzdWIiOiI1Iiwic2NvcGVzIjpbIm1lcmNoYW50Il19.M-P9_G5zsLhLpB6ZcWFrCjfJ2z-_eloajgVwbCmFH93aMXt1hCqNqDPmzwUNlvN9j14kJsB_5AU0qpL9ERUNI9Vy9VBT7wW3TnDjmVub1w0EyBMl9pDpd4yxfzgUKZFHHFLp01RVoai3qKxvWy6DntkydkOEwDL7_2jbGAX_NQbz7Cu7YWJb_B2TD4IL4c7bxbh6B8JFKnzYetrPwqYpyes2kTM4DlxLodCDF0Ede94TWX_0LoDVGbjyLBpC-6nLf8f2sciY4YHmY5hqWdISGSayVRP_GbV6K7s--5T_JR5nPURqDz6Y_FmGVF630bzHdu5iP6DldA21O0uTR2lzU-Qv5NyYUDqIzgnKps4AY8IJoUv_uNFlX7V0hz7X4RdT2cjPrp8BPKqq-5rLrdJJZI3ePEG3HPik2eZrLijKuJqvCozALFQrb7qhZFHSJhmelJuyiKy_na02z5loVP-f2x1jGACs7lj25kxH7OY51s26WVY3KrgZTGaDxrP91XyKTgHsSYNrcyC1nu8N8eRB5b5PrInDOgenu4EIFXUArBiOKiZJgEaxK1ABeAtqzLeut_hZPA5NqfnQLmA-a7qAVuI3Ek3r6lJ-LollxLcxoh9cOOkTkRwinMAVj0qOCCccvSyPhjWophKW3AYXORZrCdj8-BvFWfvs0c-0rvOh6QE

Body of request should look like this

{
    "id": "5e820b58-40e5-48a9-a0be-6a48a94d70be", // Create new UUID for each new payment request
    "paymentMethod": "creditcard",
    "returnUrl": "https://www.example.com/order/return",
    "webhookUrl": "https://www.example.com/order/return",
    "transaction": {
        "reference": "1111111",
        "description": "Creditcard order for something",
        "currency": "EUR",
        "amount": 2000, // Amount is in cents 2000 = 20e
        "lines": [
            {
                "name": "Product 1",
                "category": "category 1",
                "brand": "brand 1",
                "quantity": 1,
                "amount": 2000
            }
        ]
    }
}
}

As response to this request we will get Payment URL.

You can use our Open API to test this. For more information about payment method please refer to Payment Methods page