KBank Open API SDK for PHP
  • Overview
  • ตั้งค่า
    • เปลี่ยนวิธีการเก็บ Access Token
  • QR Payment
  • Changelog
  • LICENSE
  • API Reference
    • Request
    • Response
Powered by GitBook
On this page
  • เตรียม Consumer Key ของท่าน
  • การตั้งค่าอื่นๆ

ตั้งค่า

PreviousOverviewNextเปลี่ยนวิธีการเก็บ Access Token

Last updated 1 year ago

เตรียม Consumer Key ของท่าน

  1. ไปที่ และเข้าสู่ระบบด้วยบัญชีผู้ใช้งานของท่าน

  2. สร้าง จาก Product ที่ท่านต้องการใช้งาน

  3. หลังจากที่สร้าง application, ท่านจะได้ consumer id และ consumer secret, 2 ค่านี้จะใช้ในการตั้งค่าต่อไป

  4. นำทั้งสองค่านี้มาตั้งค่าใน client ของท่านดังนี้

use Farzai\KApi\ClientBuilder;

$client = ClientBuilder::make()
    ->setConsumer("<YOUR_CONSUMER_ID>", "<YOUR_CONSUMER_SECRET>")
    ->asSandbox()
    ->build();

การตั้งค่าอื่นๆ

use Farzai\KApi\ClientBuilder;

$builder = ClientBuilder::make();

// ตั้งค่า consumer id และ consumer secret
$builder->setConsumer("<YOUR_CONSUMER_ID>", "<YOUR_CONSUMER_SECRET>");

// ตั้งค่าเป็น sandbox
$builder->asSandbox();

// ตั้งค่าให้เป็น production
$builder->asProduction();

// ใช้งาน http client ที่ต้องการ
$builder->setClient(Psr\Http\Client\ClientInterface);

// เปลี่ยนวิธีการเก็บ token ด้วยตนเอง
$builder->setTokenRespository(Farzai\KApi\Contracts\AccessTokenRepositoryInterface);

// ตั้งค่า logger
$builder->setLogger(Psr\Log\LoggerInterface);

// สร้าง Client
$client = $builder->build();
https://apiportal.kasikornbank.com/product
Application