How to setup OMISE PHP SDK to Laravel framework

196 Views Asked by At

I'm starting to learn Omise Payment Getway. On Omise documentation have information about PHP SDK. I'm using Laravel Framework on it. However, i'm struggling to implement the Omise PHP SDK into my Laravel site..

I have 2 question when setup the Omise PHP SDK :

  1. The integration - after i install Omise by composer. i don't know how to use it. first, i want to display my Omise balance. here is my code on controller
use Omise\OmiseBalance;


class OmiseController extends Controller
{
    public function index()
    {
        $balance = OmiseBalance::retrieve();
        dd($balance);
    }
}

but display error

Class "Omise\OmiseBalance" not found

i tried other way, but still not work..

  1. Place the Secret and Public Key - where should i put the Secret key and Public Key on my Laravel. and how to fetch the keys? Currently i just put this keys into my file .env
OMISE_PUBLIC_KEY=pkey_test_xxx
OMISE_SECRET_KEY=skey_test_xxx
OMISE_API_VERSION=2019-05-29

What is the correct way for me to integrate Omise PHP SDK into my Laravel Site. please help.

0

There are 0 best solutions below