Menu

## Promptpay
in package

Promptpay.php : 19

Promptpay QR Code Payment Payload Generator based on EMV® QR Code Specification

##### Tags

see
  https://www.kotchasan.com/

### Table of Contents

$applicationID : string
  Merchant identifier
$countryCode : string
  Country Code TH = Thailand
$currencyCode : int
  Transaction Currency Code 764 = Thai Baht
$phoneCountryCode : int
  Phone country code 66 = Thailand
$amount : int
  Transaction Amount
$merchant_id : string
  Recipient ID (Phone number, National ID, Tax ID, E-Wallet ID)
create() : static
  Create Promptpay object
payload() : string
  Generate payload for Prompt Pay QR code payment based on EMV® QR Code Specification
__construct() : mixed
  Class constructor
format() : string
  Format the data field with an ID, length, and optional padding.
hashBytes() : int
  Calculate the hash (CRC-16) for an array of bytes.
hashString() : string
  Generate the checksum (CRC) using the CRC-16 algorithm.

### Properties

#### $applicationID

Promptpay.php : 42

Merchant identifier

`public string $applicationID = 'A000000677010111'`

#### $countryCode

Promptpay.php : 27

Country Code TH = Thailand

`public string $countryCode = 'TH'`

#### $currencyCode

Promptpay.php : 35

Transaction Currency Code 764 = Thai Baht

`public int $currencyCode = 764`

#### $phoneCountryCode

Promptpay.php : 64

Phone country code 66 = Thailand

`public int $phoneCountryCode = 66`

#### $amount

Promptpay.php : 49

Transaction Amount

`private int $amount`

#### $merchant_id

Promptpay.php : 56

Recipient ID (Phone number, National ID, Tax ID, E-Wallet ID)

`private string $merchant_id`

### Methods

#### create()

Promptpay.php : 92

Create Promptpay object

`public static create(string $merchant_id[, int|null $amount = null ]) : static`

##### Parameters

$merchant_id : string

  Recipient ID (Phone number, Prompt Pay, or E-Wallet ID)

$amount : int|null = null

  Transaction amount

##### Tags

assert

  ('0123456789')->payload() [==] '00020101021129370016A000000677010111011300661234567895802TH530376463047CC1'

assert

  ('660123456789')->payload() [==] '00020101021129370016A000000677010111011300661234567895802TH530376463047CC1'

assert

  ('660123456789', 99)->payload() [==] '00020101021229370016A000000677010111011300661234567895802TH5303764540599.00630472B'

assert

  ('66123456789')->payload() [==] '00020101021129370016A000000677010111011300661234567895802TH530376463047CC1'

assert

  ('123456789012')->payload() [==] '00020101021129370016A000000677010111011301234567890125802TH530376463048AF8'

##### Return values

static —

#### payload()

Promptpay.php : 106

Generate payload for Prompt Pay QR code payment based on EMV® QR Code Specification

`public payload() : string`

##### Return values

string —

Generated payload string

#### __construct()

Promptpay.php : 72

Class constructor

`protected __construct(string $merchant_id, int $amount) : mixed`

##### Parameters

$merchant_id : string

  Recipient ID (Phone number, Prompt Pay, or E-Wallet ID)

$amount : int

  Transaction amount

##### Return values

mixed —

#### format()

Promptpay.php : 171

Format the data field with an ID, length, and optional padding.

`private format(string $id, mixed $data, int $length) : string`

##### Parameters

$id : string

  The ID field.

$data : mixed

  The data field.

$length : int

  The length of the data field.

##### Return values

string —

The formatted field.

#### hashBytes()

Promptpay.php : 199

Calculate the hash (CRC-16) for an array of bytes.

`private hashBytes(array<string|int, mixed> $data) : int`

##### Parameters

$data : array<string|int, mixed>

  The input data.

##### Return values

int —

The calculated hash value.

#### hashString()

Promptpay.php : 187

Generate the checksum (CRC) using the CRC-16 algorithm.

`private hashString(string $data) : string`

##### Parameters

$data : string

  The input data.

##### Return values

string —

The generated checksum.

## Search results