Skip to content

Examples

Benjamin Altpeter edited this page Mar 27, 2017 · 7 revisions

All these examples assume that you have an instance of \baltpeter\Internetmarke\Service called $service which can be created like this:

// The `PartnerInformation` object is used to authenticate you as a partner with DPAG.
$partner_info = new \baltpeter\Internetmarke\PartnerInformation('ABCDEF', 1, 'secretkey');
// The `Service` object provides an interface for all actions in the web service
$service = new \baltpeter\Internetmarke\Service($partner_info);

Authenticating a user

To authenticate a user, you need their username (which is their email address) and (plaintext) password for the Portokasse:

$user = $service->authenticateUser('portokasse@yourserver.tld', 'yourpassword');

This will return a user object like this:

object(baltpeter\Internetmarke\User)#9 (4) {
  ["userToken":protected]=>
  string(44) "secretkey"
  ["walletBalance":protected]=>
  int(236725)
  ["showTermsAndConditions":protected]=>
  bool(false)
  ["info_message":protected]=>
  NULL
}
Clone this wiki locally