Skip to content

gpoon21/GPoon21.KAPI.SDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

98 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KAPI SKD (non official)

C# SDK for KBank KAPI QR Payment https://apiportal.kasikornbank.com/product/public/All/QR%20Payment/Documentation/Identity%20confirmation

By running the unit test with envirment variable customerId, customerSecret, and SSL_CERTIFICATE_PEM, you should be able to pass all 16 QRPayment excercises.

This code currently have not been tested againist a real API outside of the sandbox since I have no access to it.

Usage/Examples

Call actual API with KBankQR.Client

IRequestMode.Default requestMode = new() {
    BaseUrl = "{URL}",
};
KBankQR.Client client = await KBankQR.Client.CreateAsync(customerId, customerSecret, requestMode);
// Create a QR request with specified parameters
KBankQR.QRRequest qrRequest = new() {
    PartnerTransactionUid = "{parameter}",
    PartnerId = "{parameter}",
    PartnerSecret = "{parameter}",
    MerchantId = "{parameter}",
    QRType = QRType.ThaiQR,
    TransactionAmount = 100,
    TransactionCurrencyCode = "{parameter}",
    Reference1 = "{parameter}",
    Reference2 = "{parameter}",
    Reference3 = "{parameter}",
    Reference4 = "{parameter}",
};
// Request QR code
KBankQR.QRResponse result =  await client.RequestQR(qrRequest, requestMode);

Call direcly without KBankQR.Client

IRequestMode.Default requestMode = new() {
    BaseUrl = "{URL}",
};
KBankQR.CustomerInfo credentials = await KBankQR.GetClientCredentials(customerId, customerSecret, requestMode);
KBankQR.QRResponse result = await KBankQR.RequestQR(qrRequest, credentials.AccessToken, requestMode);

About

C# SDK for KBank KAPI QR Payment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages