You are here

public function Mollie_API_Client::setApiKey in Commerce Mollie 7

Parameters

string $api_key The Mollie API key, starting with "test_" or "live_":

Throws

Mollie_API_Exception

File

Mollie/API/Client.php, line 130

Class

Mollie_API_Client
Copyright (c) 2013, Mollie B.V. All rights reserved.

Code

public function setApiKey($api_key) {
  if (!preg_match("!^(?:live|test)_\\w+\$!", $api_key)) {
    throw new Mollie_API_Exception("Invalid api key: \"{$api_key}\". An API key must start with \"test_\" or \"live_\".");
  }
  $this->api_key = $api_key;
}