เริ่มต้นใช้งานของ omise
ตัวอย่างโค้ด
Laravel | Version |
---|---|
7 | 2.0.0 |
โหลดผ่าน composer
composer require ox01code/omise
นำไฟล์ config มาไว้ที่โปรเจค
php artisan vendor:publish --tag=config
กำหนดค่าที่ไฟล์ .env
OMISE_PUBLIC_KEY=
OMISE_SECRET_KEY=
สร้าง Source อ่านเพิ่มเติม
$response = OmiseSource::create([
'amount' => 12345,
'currency' => 'THB',
'type' => 'truemoney',
'phone_number' => '0123456789',
]);
dd($response);
สร้าง Charge อ่านเพิ่มเติม
$response = OmiseCharge::create([
'amount' => 12345,
'currency' => 'THB',
'return_uri' => 'http://example.com/orders/345678/complete',
'source' => 'src_*****',
]);
dd($response);