Skip to content

parsilver/truemoney-webhook-php

 
 

Repository files navigation

Truemoney webhook gateway - PHP

Latest Version on Packagist Tests codecov Total Downloads

ขอบคุณ K'DearTanakorn

เราได้ทำการ Fork มาจาก Repo: DearTanakorn/truemoney-webhook-gateway

และให้ใช้งานร่วมกับ PHP Server ได้


System Requirements

  • PHP 8.0 or higher

Setup

$ composer require farzai/truemoney-webhook

Get started

use Farzai\TruemoneyWebhook\Postman;

// New instance
$postman = new Postman([
   'secret' => 'your-secret-key',
]);

// Capture all data from incoming request
$data = $postman->capture();

// You can use $data to do anything you want.
// For example, you can get the data as Array
// @returned
// [
//    'event_type' => 'P2P',
//    'received_time' => '2022-01-31T13:02:23+0700',
//    'amount' => 100,
//    'sender_mobile' => '0988882222',
//    'message' => 'ค่าไอเทม',
//    'lat' => 1653538793,
// ]
$data->asArray();

Sometime, you may want to get some fields from incoming request. You can use $data->field_name to get the value of the field.

For example:

$data->event_type; // string
$data->amount; // int
$data->sender_mobile; // string
$data->message; // string
$data->lat; // int