Skip to content

Authenticated payments

Authenticated payments

You may want to perform an authenticated payment, also known as 3-D Secure, Verified by Visa or Mastercard Identity Check. An anthenticated payment will send a request to the cardholder's bank to authenticate him or her.

To start an authenticated payment, you must provide an auth and a device objects in your payment data.

If you use our payment page, you just need to pass the request status to auth object and no device object, we will handle everything for you.

Auth

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
package Stancer::Auth;

use Moo;
use Stancer::Core::Types qw(:all);
use Stancer::Auth::Status;

has redirect_url => (is => 'ro', isa => HttpsUrl);

has return_url => (is => 'rw', isa => HttpsUrl);

has status => (is => 'ro', isa => Str, default => Stancer::Auth::Status::REQUEST);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<?php
namespace Stancer;

use DateTime;

class Auth
{
  protected ?string $redirectUrl;
  protected ?string $returnUrl;
  protected ?string $status;

  public function __construct() {}
}

The auth object is defined as follows:

Parameter Description Type
redirect_url An HTTPS URL where you will redirect your customer to his bank for authentication String, max = 2048
Given by the API
return_url An HTTPS URL to redirect back your customer after the bank authentication String, max = 2048
status The status of the payment authentication See authenticated payment status codes

Device

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package Stancer::Device;

use Moo;
use Stancer::Core::Types qw(:all);

has city => (is => 'rw', isa => Str);

has country => (is => 'rw', isa => Str);

has http_accept => (is => 'rw', isa => Varchar[2048], default => $ENV{HTTP_ACCEPT});

has ip => (is => 'rw', isa => IpAddress, default => $ENV{SERVER_ADDR});

has languages => (is => 'rw', isa => Varchar[32], default => $ENV{HTTP_ACCEPT_LANGUAGE});

has port => (is => 'rw', isa => Int, default => $ENV{SERVER_PORT});

has user_agent => (is => 'rw', isa => Varchar[256], default => $ENV{HTTP_USER_AGENT});

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php
namespace Stancer;

use DateTime;

class Device
{
  protected ?string $city;
  protected ?string $country;
  protected ?string $httpAccept = $_SERVER['HTTP_ACCEPT'];
  protected ?string $ip = $_SERVER['SERVER_ADDR'];
  protected ?string $languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
  protected ?string $port = $_SERVER['SERVER_PORT'];
  protected ?string $userAgent = $_SERVER['HTTP_USER_AGENT'];

  public function __construct() {}
}

The device object is defined as follows:

Parameter Field Description Type
ip Required IP address of the payer IPv4 or IPv6
port Required TCP port number of the payer Int, max = 65535
user_agent Optional HTTP User Agent header String, max = 256
http_accept Optional HTTP Accept header String, max = 2048
languages Optional HTTP Accept-Language header String, max = 32
city Conditional If ip provided, return the city of the payer String
country Conditional If ip provided, return the country of the payer String