Log in a subscription customer

**POST** https://api.okepay.info/v1.0/AuthToken/

// $instanceName is a part of the url where you access your okepay installation.
// https://{$instanceName}.okepay.info
$instanceName = 'INSTANCE_NAME';

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

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

// info for auth token (user id)

// fire request with created and filled authToken request-object.
try {
    $response = $okepay->create($authToken);
    // response data can get accessed like this
    $authToken = $response->getAuthToken();
    $authTokenExpirationDate = $response->getAuthTokenExpirationDate();
    $link = $response->getLink();
} catch (\Okepay\OkepayException $e) {
    print $e->getMessage();


apiSignature=`echo -n "userId=1" | openssl dgst -sha256 -hmac "INSTANCE_API_SECRET" -binary | openssl enc -base64`
curl --request POST "https://api.okepay.info/v1.0/AuthToken/?instance=INSTANCE_NAME" --data-urlencode "ApiSignature=$apiSignature" --data-urlencode "userId=1"


Your OkePay instance name
The contact id you received through webhook data

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


Often they don't know where to cancel the subscription. You can provide a link which will directly log them in to your OkePay 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 OkePay 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.