• 1. Overview


    In seamless integration, a member's balance is stored on the merchant side. Merchant will be required to expose a certain API for the KPLAY system to call during the launching and in-play of the games provided.


  • 1.1 Live Casino Product List

    Product ID

    Provider

    Type ID

    Description

    1

    Evolution


    Note:

    For Evolution integration

    please set iframe

    allowfullscreen =true

    0

    Default lobby

    1

    RNG Black Jack

    2

    RNG Money Wheel

    3

    RNG Roulette Lightning

    4

    RNG Roulette European

    5

    RNG Megaball

    6

    RNG Dragon Tiger

    7

    RNG Baccarat

    8

    RNG Topcard

    2

    Big Gaming

    0

    Default lobby

    3

    MG Titanium

    0

    Default lobby

    1

    Grand lobby

    5

    Asia Gaming

    0

    Default lobby

    6

    Dream Gaming

    0

    Default lobby

    9

    Sexy Gaming

    0

    Default lobby

    10

    Pragmatic Play

    0

    Default lobby

    12

    Playtech Casino

    0

    Default lobby

    16

    Royal Casino Gaming

    0

    Default lobby

    17

    Ezugi

    0

    Default lobby

    18

    Bota


    Note:

    For Bota integration

    iframe is not supported

    0

    Default lobby

    19

    Skywind Live Casino

    0

    Default lobby

    21

    Motivation

    0

    Default lobby

    22

    Dowin


    Note:

    For Dowin integration

    iframe is not supported

    0

    Default lobby

    24

    Oriental Gaming

    0

    Default lobby

    26

    Taishan

    0

    Default lobby

    30

    ICONIC21

    0

    Default lobby

    34

    GPI

    0

    Default lobby

    35

    XPG

    0

    Default lobby

    38

    DB

    0

    Default lobby

    39

    Hilton


    Note:

    For Hilton integration

    iframe is not supported

    0

    Default lobby


  • 1.2 Slot Product List

    Product ID

    Provider

    Type ID

    Description

    0

    Slot Lobby

    0

    Default slot lobby for all slot games.

    200

    PP Slot

    Generate with lobby

    PP slot games

    201

    Habanero

    Generate with lobby

    Habanero slot games

    202

    Elysium

    Generate with lobby

    Elysium slot games

    205

    Spade Gaming

    Generate with lobby

    Spade Gaming slot games

    207

    Play and Go

    Generate with lobby

    Play and Go slot games

    208

    World Match

    Generate with lobby

    World Match slot games

    209

    MG Slot

    Generate with lobby

    MG slot games

    212

    YL Gaming

    Generate with lobby

    YL Gaming slot games

    213

    EVO Red Tiger

    Generate with lobby

    EVO Red Tiger slot games

    214

    Netent

    Generate with lobby

    Netent slot games

    215

    Dragoon Soft

    Generate with lobby

    Dragoon Soft slot games

    216

    YGG Drasil

    Generate with lobby

    YGG Drasil slot games

    217

    Booongo

    Generate with lobby

    Booongo slot games

    218

    Playson

    Generate with lobby

    Playson slot games

    219

    Playtech Slot

    Generate with lobby

    Playtech slot games

    220

    CQ9 Slot

    Generate with lobby

    CQ9 slot games.

    221

    Skywind

    Generate with lobby

    Skywind slot games.

    222

    Wazdan

    Generate with lobby

    Wazdan slot games.

    223

    Pgsoft

    Generate with lobby

    Pgsoft slot games.

    224

    Royal Slot Gaming

    Generate with lobby

    Royal Slot Gaming slot games.

    225

    EVO Big Time Gaming

    Generate with lobby

    EVO Big Time Gaming slot games.

    227

    EVO No Limit City

    Generate with lobby

    EVO No Limit City slot games.

    228

    CC88

    Generate with lobby

    CC88 slot games.

    230

    FastSpin

    Generate with lobby

    FastSpin slot games.

    231

    NextSpin

    Generate with lobby

    NextSpin slot games.

    235

    Playstar

    Generate with lobby

    Playstar slot games.

    249

    Naga Games

    Generate with lobby

    Naga Games slot games.

    250

    Hidden Button

    Generate with lobby

    Hidden Button slot games.

    253

    Slotmill

    Generate with lobby

    Slotmill slot games.

    254

    Peter&Sons

    Generate with lobby

    Peter&Sons slot games.

    255

    Hacksaw Gaming

    Generate with lobby

    Hacksaw Gaming slot games.

    256

    AvatarUX

    Generate with lobby

    AvatarUX slot games.

    257

    568Win

    Generate with lobby

    568Win slot games.

    258

    Blueprint

    Generate with lobby

    Blueprint slot games.

    263

    JiLi

    Generate with lobby

    JiLi slot games.

    265

    JDB

    Generate with lobby

    JDB slot games.

    267

    GPI Slot

    Generate with lobby

    GPI slot games.

    268

    King Midas

    Generate with lobby

    King Midas slot games.

    279

    Endorphina

    Generate with lobby

    Endorphina slot games.


  • 1.3 Sports Product List

    Product ID

    Provider

    Type ID

    Description

    101

    Inplay Matrix

    0

    Default lobby

    108

    Live Sports

    0

    Default lobby

    109

    Beter Esports

    0

    Default lobby


  • 1.4 P2P Product List

    Product ID

    Provider

    Type ID

    Description

    10002

    Hidden Poker

    0

    Default lobby

    10003

    Badugi

    0

    Default lobby


  • 1.5 Mini Game Product List

    Product ID

    Provider

    Type ID

    Description

    300

    Spribe

    1 - Aviator

    2 - Dice

    3 - Plinko

    4 - Goal

    5 - Hi Lo

    6 - Mines

    7 - Keno

    8 - Mini Roulette

    9 - Hotline

    The games can only be accessed using Type ID.

    301

    Evolution Powerball

    1 - Evolution powerball 1T

    2 - Evolution powerladder 1T

    3 - Evolution powerladder 2T

    4 - Evolution powerladder 3T

    5 - Evolution powerball 2T

    6 - Evolution powerball 3T

    7 - Evolution powerball 4T

    8 - Evolution powerball 5T

    9 - Evolution powerladder 4T

    10 - Evolution powerladder 5T

    The games can only be accessed using Type ID.


  • 1.6 Items to be supplied by KPLAY

    • KPLAY endpoint

    • KPLAY merchant code

    • KPLAY merchant token

    • KPLAY secret key


  • 1.7 Items to be Supplied by Merchant

    • Merchant endpoint


    Example :

    Merchant endpoint provided : http://www.merchant.com

    Fully qualified URL for debit : http://www.merchant.com/debit


  • 1.8 API to be Prepared by Merchant

    In order for the seamless integration to work, merchants will be required to have an endpoint with the APIs listed below.


    • Debit – API to deduct player’s money

    • Credit – API to add back player’s money

    • Balance – API to get latest player’s money

    • Bonus – API to get player’s bonus (Applicable for slot only)

    • Buyin – API to deduct player’s money for fishing game (Applicable for fishing only)


  • 1.9 Data Flow and Cronjob

    In KPLAY, every debit will be paired with a credit. The linkage is done through a matching txn_id. All debit without a credit should be considered as pending. Merchant have to prepare cronjob which monitor pending debits and use results API to settle it within 10 minutes of debit call time.




  • 2. AUTH (Mandatory)


    Merchant will call this API to launch the game. API will automatically create or update member's info.


    HTTP methods : POST

    Live Casino URL : <KPLAY endpoint>/auth


  • 2.1 Request Format

    Header

    Field

    Type

    Description

    Mandatory

    ag-code

    string

    KPLAY merchant code

    y

    ag-token

    string

    KPLAY merchant code

    y


    Body

    Field

    Type

    Description

    Mandatory

    user

    object


    y

    user.id

    integer

    Unique identifier for user


    Length 9

    y

    user.name

    string

    Unique name for the user. Name can't be changed once it is created.


    Length 3 – 20

    y

    user.balance

    decimal(15,2)

    User's balance

    y

    user.language

    char(3)

    User's language

    Refer to product game list API

    13.1 Language

    y

    user.domain_url

    string

    (FOR SLOT AND FISH LOBBY ONLY)


    This field is required for us to call back to your domain and redirect to the game.

    y

    prd

    object


    y

    prd.id

    integer

    Product ID

    Refer to 1.1 Product List

    y

    prd.type

    integer

    Type of product

    Refer 1.1 Product List

    n

    prd.skin

    integer

    (FOR SLOT LOBBY ONLY)


    The theme options. Default is a dark theme.


    Product skins available:-

    1 - Dark

    2 - Light


    Refer to 13.2 Slot Lobby Skins for the themes’ view.

    n

    prd.filter

    integer

    (FOR SLOT LOBBY ONLY)


    Use for filtering with specific products’ ID when entering the lobby.

    The IDs can refer to 1.2 Slot Product List.

    n

    prd.lobby

    integer

    (FOR KIRON VIRTUAL GAME ONLY)


    Use for direct access to the lobby or access to specific games with type ID.

    The type IDs can refer to 1.3 Sports Product List.


    The lobby field could be:-

    0 = Direct to game with specific type ID.

    1 = Direct to lobby.

    n

    prd.open_type

    string

    (FOR SLOT AND FISH LOBBY ONLY)


    n – new tab, r – redirect

    Default: n

    n

    prd.is_mobile

    boolean

    If true, url will be for mobile site


    Default: false

    y

    prd.table_id

    string

    Evolution Live Casino Table ID

    Refer to 17. Get Game Table ID

    n



    ****NOTE****

    For slots, the format for the call back URL will be http://{domain_url}/slots/{product_id}/{type}?isMobile=false. You are required to map this call back URL back to this auth method (section 2. User authentication), passing in the {product_id} and {type} variable to launch the slot game.


    ****Mobile URL****

    http://{domain_url}/slots/{product_id}/{type}?isMobile=true


  • 2.2 Request Example


    {

    "user":

    {

    "id":1,

    "name":"johndoe",

    "balance":123.05,

    "language":"en"

    },

    "prd":

    {

    "id":1,

    "type":0,

    "is_mobile":0,

    "lobby":0, // For Kiron only (Product ID 102)

    "open_type":"n",

    "filter":200 // Depends on product ID

    }

    }



  • 2.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 = error

    1 = success

    user_id

    integer

    KPLAY user ID

    username

    string

    KPLAY username

    launch_url

    string

    Launch URL

    error

    string

    Error message when status = 0


  • 2.4 Response Example

    When success


    {

    "status":1,

    "user_id":1000011,

    "username":"ABCjohndoe",

    "launch_url": "http://casino.com"

    }



    When error


    {

    "status":0,

    "error":"ACCESS_DENIED"

    }



    Error

    Description

    ACCESS_DENIED

    When merchant credentials is invalid

    INVALID_PRODUCT

    When product is invalid

    INVALID_PARAMETER

    When domain_url parameter is missing or wrong

    INVALID_USER

    When user is invalid

    INTERNAL ERROR

    KPLAY internal error


  • 2.5 Sample Code

    Refer to sample code in 17.1 Authentication




  • 3. DEBIT (Mandatory)


    KPLAY will call this API in the merchant system to notify merchants that a debit occurs.


    HTTP methods : POST

    URL : <Merchant endpoint>/debit


  • 3.1 Request Format

    Header

    Field

    Type

    Description

    secret-key

    string

    KPLAY merchant secret key. For merchants to verify the request comes from KPLAY.


    Body

    Field

    Type

    Description

    user_id

    integer

    KPLAY user ID

    amount

    decimal(15, 2)

    Debit amount

    prd_id

    integer

    Product ID

    txn_id

    string

    Unique transaction ID, also used to be paired with credit call.

    game_id

    integer

    Game ID available to call using product game list API. Refer to 10. Product Game List


    *Note:

    Game ID of DG and IM will be always zero in debit requests. If you need the Game ID, please call the “Results” API to update the game ID.


    Product(s) affected:-

    ➢ DG

    ➢ IM

    table_id

    string

    Table ID

    * Only applicable for Evo Live Casino

    round_id

    string

    Round ID

    * Only applicable after 24/07/2024 (KRW)


    Product(s) which not include the round id:-

    ➢ Dream Gaming

    ➢ Beter Esports

    ➢ Spade Gaming

    ➢ FastSpin

    credit_amount

    decimal(15, 2)

    If credit_amount exists, then AG needs to generate credit settlement for it.

    txn_details

    Array

    List of transaction details

    txn_details.event_id

    string

    Event’s id

    * Only applicable for Live Betting

    txn_details.league_id

    string

    League’s id

    * Only applicable for Live Betting

    txn_details.league_name

    string

    League’s name

    * Only applicable for Live Betting

    txn_details.league_kr_name

    string

    League’s name in korean

    * Only applicable for Live Betting

    txn_details.sport_id

    integer

    Sport’s id

    * Only applicable for Live Betting

    txn_details.sport_name

    string

    Sport’s name

    * Only applicable for Live Betting

    txn_details.country_code

    string

    Country’s code

    * Only applicable for Live Betting

    txn_details.type

    string

    Betting type

    * Only applicable for Live Betting

    txn_details.type_desc

    string

    Betting Type Description

    * Only applicable for Live Betting

    txn_details.event_part_id

    integer

    Event Part’s Id

    * Only applicable for Live Betting

    txn_details.event_part_name

    string

    Event Part’s Name

    * Only applicable for Live Betting

    txn_details.selection

    string

    Betting Selection

    * Only applicable for Live Betting

    txn_details.selection_desc

    string

    Betting Selection Description

    * Only applicable for Live Betting

    txn_details.home_team

    string

    Home Team Name

    * Only applicable for Live Betting

    txn_details.away_team

    string

    Away Team Name

    * Only applicable for Live Betting

    txn_details.home_team_kr

    string

    Home Team Name In Korean

    * Only applicable for Live Betting

    txn_details.away_team_kr

    string

    Away Team Name In Korean

    * Only applicable for Live Betting

    txn_details.start_time

    string

    Event’s start time

    * Only applicable for Live Betting

    txn_details.odds

    decimal(3,2)

    Betting Odds

    * Only applicable for Live Betting

    txn_details.hdp

    string

    Handicap value

    * Only applicable for Live Betting


  • 3.2 Request Example


    {

    "user_id":1000011,

    "amount":100.00,

    "prd_id":1,

    "txn_id":"A00000005",

    "game_id":1005

    "table_id":"jimihendrix00000",

    "round_id":"17df2d6fc0f95beb63861983-r3ildu3tr7naae3z"

    }



    With credit_amount


    {

    "user_id":1000011,

    "amount":100.00,

    "prd_id":1,

    "txn_id":"A00000005",

    "game_id":1005,

    "table_id":"jimihendrix00000",

    "round_id":"17df2d6fc0f95beb63861983-r3ildu3tr7naae3z",

    "credit_amount":100

    }



    Only Apply for Live Betting


    {

    "user_id":1000011,

    "amount":100.00,

    "prd_id":506,

    "txn_id":"A00000005",

    "game_id":1005,

    "txn_details":[

    {

    "event_id":237241598721036288,

    "league_id":227988609297436672,

    "league_name":"KBO",

    "league_kr_name":"KBO",

    "sport_id":9,

    "sport_name":"Baseball",

    "country_code":"KR",

    "type":"T",

    "type_desc":"Over/Under",

    "event_part_id":70,

    "event_part_name":"Whole Match",

    "selection":"Lotte Giants - 7.5",

    "selection_desc":"Under",

    "home_team":"KT Wiz",

    "away_team":"Lotte Giants",

    "home_team_kr":"KT 위즈",

    "away_team_kr":"롯데 자이언츠",

    "start_time":"2024-05-16 09:30:00",

    "odds":"1.49",

    "hdp":"7.5",

    }

    ]

    }



  • 3.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 = error

    1 = success

    balance

    decimal(15, 2)

    Latest member balance

    error

    string

    Error message when status = 0



  • 3.4 Response Example

    When success


    {

    "status":1,

    "balance":505.50

    }



    When error


    {

    "status":0,

    "error":"ACCESS_DENIED"

    }



    Error Message

    Description

    ACCESS_DENIED

    Invalid secret key.

    INVALID_USER

    Check if a user exists in the merchant system.

    DUPLICATE_DEBIT

    Check if a debit with the same “txn_id” exists in the merchant system.

    INSUFFICIENT_FUNDS

    Check if the member has enough balance for the debit.

    UNKNOWN_ERROR

    Internal error in the merchant system.


    *Note: Game ID of DG and E-sport will be always zero in debit requests. If you need the Game ID, please call the “Results” API to update the game ID.


    *Note: When debit = 0, AG must return response with status = 1.




  • 4. CREDIT (Mandatory)


    KPLAY will call this API in the merchant system to notify merchants that a credit occurs. (TIP: please beware and handle concurrent requests send by KPLAY).


    HTTP methods : POST

    URL : <Merchant endpoint>/credit


  • 4.1 Request Format

    Header

    Field

    Type

    Description

    secret-key

    string

    KPLAY merchant secret key. For merchants to verify the request comes from KPLAY.


    Body

    Field

    Type

    Description

    user_id

    integer

    KPLAY user ID

    amount

    decimal(15,2)

    Credit amount

    prd_id

    integer

    Product ID

    txn_id

    string

    Unique transaction ID, also used to pair with debit call.

    is_cancel

    integer

    Normal credit = 0

    Credit due to cancel or refund = 1

    game_id

    integer

    Game ID

    * Only applicable for Evo Live Casino

    table_id

    string

    Table ID

    * Only applicable for Evo Live Casino

    round_id

    string

    Round ID

    * Only applicable after 24/07/2024 (KRW)


    Product(s) which not include the round id:-

    ➢ Dream Gaming

    ➢ Beter Esports

    ➢ Spade Gaming

    ➢ FastSpin

    total_bet

    decimal(15,2)

    Total bet amount

    * Only applicable for Hidden Poker

    rake

    decimal(15,2)

    Total rake amount

    * Only applicable for Hidden Poker


  • 4.2 Request Example


    {

    "user_id":1000011,

    "amount":195.00,

    "prd_id":1,

    "txn_id":"A00000005",

    "is_cancel":0,

    "round_id":"343093"

    }



  • 4.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 = error

    1 = success

    balance

    decimal(15,2)

    Latest member balance

    error

    string

    Error message when status = 0


  • 4.4 Response Example

    When success


    {

    "status":1,

    "balance":505.50

    }



    When error


    {

    "status":0,

    "error":"ACCESS_DENIED"

    }



    Error message

    Description

    ACCESS_DENIED

    Invalid secret key.

    INVALID_USER

    Check if a user exists in the merchant system.

    INVALID_DEBIT

    Check if a debit exists with the key “txn_id” in the merchant system.

    DUPLICATE_CREDIT

    Check if a credit with the same “txn_id” exists in the merchant system.

    UNKNOWN_ERROR

    Internal error in the merchant system




  • 5. Resettlement (Mandatory for sportbook only)


    KPLAY will call this API in the merchant system to adjust user balance for sportsbook resettlement.


    Note: Only available for Sportbook only.


    HTTP methods: POST

    URL: <Merchant endpoint>/resettle


  • 5.1 Request Format

    Header

    Field

    Type

    Description

    secret-key

    string

    KPLAY merchant secret key. For merchants to verify the request comes from KPLAY.


    Body

    Field

    Type

    Description

    user_id

    integer

    KPLAY user ID

    amount

    integer

    Credit Amount

    txn_id

    string

    Unique transaction ID

    prd_id

    integer

    Product ID

    is_cancel

    integer

    Normal credit = 0

    Credit due to cancel or refund = 1

    resettlement_time

    datetime

    Resettlement date/time

    Under timezone UTC+0

    In ISO format


  • 5.2 Request Example


    {

    "user_id":12345,

    "amount":1000,

    "txn_id":ABC12345,

    "prd_id": 103,

    "is_cancel":0,

    "resettlement_time":2022-09-12 10:00:00

    }



  • 5.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 = error

    1 = success

    balance

    decimal(15, 2)

    User balance

    error

    string

    Error message when status = 0


  • 5.4 Response Example

    When success


    {

    "status":1

    "balance":2000.00

    }



    When error


    {

    "status":0

    "error":"INVALID_USER"

    }



    Error message

    Description

    INVALID_USER

    Check if user exists in merchant system.


    *Note: The request will be sent to the merchant until the merchant responds to the request




  • 6. BALANCE (Mandatory)


    KPLAY will call this API in the merchant system to get the latest member's balance.


    HTTP methods: POST

    URL: <Merchant endpoint>/balance


  • 6.1 Request Format

    Header

    Field

    Type

    Description

    secret-key

    string

    KPLAY merchant secret key. For merchants to verify the request comes from KPLAY.


    Body

    Field

    Type

    Description

    user_id

    integer

    KPLAY user ID

    prd_id

    integer

    Product ID


  • 6.2 Request Example


    {

    "user_id":1000011

    "prd_id": 1

    }



  • 6.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 = error

    1 = success

    balance

    decimal(15, 2)

    Latest member balance

    error

    string

    Error message when status = 0


  • 6.4 Response Example

    When success


    {

    "status":1

    "balance":9999.99

    }



    When error


    {

    "status":0

    "error":"ACCESS_DENIED"

    }



    Error message

    Description

    ACCESS_DENIED

    Invalid secret key.

    INVALID_USER

    Check if user exists in merchant system.

    UNKNOWN_ERROR

    Internal error in merchant system.




  • 7. RESULTS (Mandatory)


    Merchants can call this API to get the results from KPLAY.

    *Note: If credit is not received after 10 minutes of debit’s time, merchants have to use the result API to settle.


    HTTP methods : GET

    URL: <KPLAY endpoint>/results/{prd_id}/{txn_id}


  • 7.1 Request Format

    Header

    Field

    Type

    Description

    Mandatory

    ag-code

    string

    KPLAY merchant code

    y

    ag-token

    string

    KPLAY merchant token

    y


    Body

    Field

    Type

    Description

    Mandatory

    prd_id

    integer

    Product ID

    y

    txn_id

    string

    Unique transaction ID, also used to pair with debit call. ID

    y


  • 7.2 Request Example


  • 7.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 if error

    1 if success

    type

    integer

    0 if transaction is still processing

    1 if transaction resolved

    game_id

    integer

    Game ID

    Refer to 10. Product Game List

    stake

    integer

    Debit amount

    payout

    integer

    Credit amount

    Only when type = 1

    is_cancel

    integer

    Only when type = 1

    0 if it is a normal credit

    1 if it is a credit due to cancel or refund

    is_resettle

    integer

    0 if the transaction has been resettled before

    1 if it is resettled

    error

    string

    Error message when status = 0


  • 7.4 Response Example

    When success


    {

    "status": 1,

    "type": 1,

    "game_id": 1,

    "stake":100.00,

    "payout":195.00,

    "is_cancel":0

    "is_resettlement":1

    }



    When error


    {

    "status":0,

    "error":"ACCESS_DENIED"

    }



    Error message

    Description

    ACCESS_DENIED

    When merchant credentials is invalid

    INVALID_TXN

    Invalid transaction

    INTERNAL_ERROR

    KPLAY internal error




  • 8. Bonus (Mandatory)


    KPLAY will call this API in the merchant system to notify merchants that a Bonus occurs.


    HTTP methods : POST

    URL : <Merchant endpoint>/bonus


  • 8.1 Request Format

    Header

    Field

    Type

    Description

    secret-key

    string

    KPLAY merchant secret key


    Body

    Field

    Type

    Description

    user_id

    integer

    KPLAY user ID

    type

    integer

    Type 0: In game bonus

    Type 1: Promotion

    Type 2: Jackpot

    amount

    decimal(15,2)

    Amount

    prd_id

    integer

    Product ID. Refer to 1.2 Slot Product List

    game_id

    integer

    ID of the game. Refer to 10. Product Game List.

    txn_id

    string

    Unique transaction ID, it is not paired with debit call



  • 8.2 Request Example


    {

    "user_id":1000011,

    "type":0,

    "amount":200.00,

    "prd_id":200,

    "game_id":438,

    "txn_id":"A00000005"

    }



  • 8.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 if error

    1 if success

    balance

    decimal(15,2)

    Latest member balance

    error

    string

    Error message when status = 0


  • 8.4 Response Example

    When success


    {

    "status":1,

    "balance":1500.00

    }



    When error


    {

    "status":0,

    "error":"ACCESS_DENIED"

    }



    Error Message

    Description

    ACCESS_DENIED

    Invalid secret key

    INVALID_USER

    Check if user exists in merchant system

    UNKNOWN_ERROR

    Internal error in merchant system



    FAQ

    Q: What is the difference between type 0 and type 1 in the bonus endpoint?

    A: Type 0 is free spin in game while type 1 bonus/promo is a promotion given by Agent or provider.


    Q: Is type 0 In Game Bonus send to CREDIT endpoint?

    A: Type 0 is send to BONUS endpoint and not send to CREDIT endpoint, it would not have a debit request send to merchant upon spin.




  • 9. Product List (Optional)


    Merchants can call this API to get current available products from KPLAY.


    HTTP methods : POST

    URL : <KPLAY endpoint>/productlist


  • 9.1 Request Format

    Header

    Field

    Type

    Description

    ag-code

    string

    KPLAY merchant code

    ag-token

    string

    KPLAY merchant token


    Body

    Field

    Type

    Description

    language

    string

    Language option for product name

    Korean : ko/kr,

    English : en

    Default is in English

    wallet

    integer

    0 - All wallets

    1 - Seamless Wallet

    2 - Transfer Wallet

    Default is in All wallets



  • 9.2 Request Example


    {

    "language":"kr",

    "wallet":1

    }



  • 9.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 - error

    1 - success

    prd_id

    string

    ID of the products

    prd_name

    integer

    Name of the products

    error

    string

    Error message when status = 0


  • 9.4 Response Example


    {

    "status":1,

    "data":[

    {

    "prd_id":1,

    "prd_name":"에볼루션",

    },

    {

    "prd_id":2,

    "prd_name":"빅게이밍",

    },

    {

    "prd_id":5,

    "prd_name":"아시아 게이밍",

    }

    ]

    }



    Error Message

    Description

    INVALID_PARAMETER

    The AG token or AG code is missing

    ACCESS_DENIED

    The AG is disabled.

    USER_NOT_EXIST

    The AG is not found in KPLAY or incorrect AG token.

    INTERNAL_ERROR

    KPLAY internal error




  • 10. Product Game List (Mandatory)


    Merchants can call this API to get product game lists from KPLAY.


    HTTP methods : POST

    URL : <KPLAY endpoint>/gamelist


  • 10.1 Request Format

    Header

    Field

    Type

    Description

    ag-code

    string

    KPLAY merchant code

    ag-token

    string

    KPLAY merchant token


    Body

    Field

    Type

    Description

    language

    string

    Language option for game name.

    Default English

    Korean : ko, English : en

    Note: 1 call request per minute for game list API


  • 10.2 Request Example


    {

    "language":"en"

    }



  • 10.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 if error

    1 if success

    game_name

    string

    Product game name

    game_id

    integer

    Product game ID

    game_icon

    string

    Product game icon (For slot game only)

    rtp

    string

    Slot RTP

    is_enabled

    integer

    0 - Disabled

    1 - Enabled

    error

    string

    Error message when status = 0


  • 10.4 Response Example

    When success


    {

    "game_list":{

    "1":[

    {

    "game_id": 15,

    "game_name":"baccarat",

    "rtp":"0",

    "is_enabled": 1

    }

    ],

    "200":[

    {

    "game_id": 1,

    "game_name":"Aztec Bonanza",

    "game_icon":"https://slots.kplaycasino.com/pragmatic/slots/id/1.png",

    "game_icon_large":"https://slots.kplaycasino.com/500*500/pragmatic/slots/id/1.png",

    "rtp":"97.06%",

    "is_enabled": 1

    }

    ]

    },

    "status":1

    }



    When error


    {

    "status":0,

    "error":"INVALID_PARAMETER"

    }



    Error Message

    Description

    INVALID_PARAMETER

    Invalid secret key

    INVALID_PRODUCT

    Check if product id exists in merchant system

    INTERNAL_ERROR

    KPLAY internal error




  • 11. Get Game Info (Optional)


    Merchants can call this API to get game info from KPLAY.


    HTTP methods : POST

    URL : <KPLAY endpoint>/gameinfo


  • 11.1 Request Format

    Header

    Field

    Type

    Description

    ag-code

    string

    KPLAY merchant code

    ag-token

    string

    KPLAY merchant token


    Body

    Field

    Type

    Description

    language

    string

    Language option for game name.

    Default English

    Korean : ko, English : en

    Note: 1 call request per minute for game info API


  • 11.2 Request Example


    {

    "language":"en"

    }



  • 11.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 if error

    1 if success

    recommended

    string

    Recommended games

    popular

    string

    Popular games

    new_game

    string

    New games

    game_id

    integer

    Product game ID

    game_name

    string

    Product game name

    error

    string

    Error message when status = 0


  • 11.4 Response Example

    When success


    {

    "status":1,

    "recommended":{

    "200":[

    {

    "game_id": 14,

    "game_name":"Wild West Gold"

    },

    "209":[

    {

    "game_id": 62,

    "game_name":"Basketball Star"

    }

    ]

    },

    "popular":{

    "202":[

    {

    "game_id": 466,

    "game_name":"Supa Crew"

    },

    "205":[

    {

    "game_id": 153,

    "game_name":"Christmas Miracles"

    }

    ]

    },

    "new_game":{

    "200":[

    {

    "game_id": 512,

    "game_name":"Kingdom of The Dead"

    },

    "220":[

    {

    "game_id": 277,

    "game_name":"Treasure Pirate"

    }

    ]

    }

    }



    When Error


    {

    "status":0,

    "error":"INVALID_PARAMETER"

    }



    Error Message

    Description

    INVALID_PARAMETER

    Invalid secret key

    INVALID_PRODUCT

    Check if product id exists in merchant system

    INTERNAL_ERROR

    KPLAY internal error




  • 12. Get Push Bets (Optional)


    Merchant will call this API from KPLAY to get pushed bet history.


    ● If the result of the game is a tie, transactions that bet on the player and banker will become "pushed" transactions.

    E.g. A player places a bet on either player or banker but the result is tie, then the refunded amount = pushed_amount.

    ● If the pushed amount = 0, it means there is no push in the transaction.

    ● If the transaction is not in the list it means the data is not available yet.

    ● If the txn_id parameter exists, start_date and end_date fields will be ignored and become NOT

    mandatory. It is just specify and grab ONE ONLY.


    Note:

    ● This is used for merchants to get pushed bet history details from Evolution ONLY.

    ● Merchants are required to request date time in UTC+0.

    Only applies to Baccarat and BlackJack games.


    HTTP methods : POST

    URL : <KPLAY endpoint>/getpushbets



  • 12.1 Request Format

    Header

    Field

    Type

    Description

    Mandatory

    ag-code

    string

    KPLAY merchant code

    y

    ag-token

    string

    KPLAY merchant token

    y


    Body

    Field

    Type

    Description

    Mandatory

    start_date

    datetime

    Game start date/time

    y

    (Refer to 12.2 request sample)

    end_date

    datetime

    Game end date/time

    y

    (Refer to 12.2 request sample)

    prd_id

    integer

    Refer to 1.1 Live Casino Product List

    y

    txn_id

    varchar

    Specific transaction ID

    y

    (Refer to 12.2 request sample)


  • 12.2 Request Example

    Using start_date and end_date


    {

    "start_date": "2021-06-01T03:00:00Z",

    "end_date": "2021-06-01T04:50:00Z",

    "prd_id": 1

    }



    **Note: start/end date is only limited to 2 hours.


    Using transaction ID ONLY


    {

    "prd_id" :1,

    "txn_id" :"624610570377457431"

    }



  • 12.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 - error

    1 - success

    data

    object

    Contains transaction ID, pushed amount and pushed amount1 and side_amount.


    pushed_amount (Applicable to baccarat and blackjack)


    Baccarat

    - When the outcome is Tie, the bet amount on player or banker is then pushed


    Blackjack

    - The push will be triggered whenever the dealer and player has the same hand value

    - The rule of push 22 will only occur in Free Bet Blackjack (game id 26)


    pushed_amount1 (Applicable on baccarat only)

    - Push amount added on top of pushed_amount.

    - It will include the bet amount on tie.

    - For example: pushed_amount is 100 and the amount bet on tie amount is 50, pushed_amount1 will be 150


    side_amount (Applicable on baccarat only)

    - Regardless of the result, the total amount of all side bets, except for Banker, Player, and Tie.

    error

    string

    Error message if entered wrong request format.


  • 12.4 Response Example

    When success (using start and end date)


    {

    "status": 1,

    "data": [

    {

    "txn_id": "624610570377450431",

    "pushed_amount": 100,

    "pushed_amount1": 100

    "side_amount": 100

    },

    {

    "txn_id": "624610570377451432",

    "pushed_amount": 0,

    "pushed_amount1": 0

    "side_amount": 0

    }

    ]

    }



    When success (using transaction ID only)


    {

    "status": 1,

    "data": [

    {

    "txn_id": "624610570377457431",

    "pushed_amount": 0,

    "pushed_amount1": 0

    "side_amount": 0

    }

    ]

    }



    When error


    {

    "status": 0,

    "error": "ACCESS_DENIED"

    }



    Error Messages

    Description

    ACCESS_DENIED

    When merchant credentials is invalid.

    INVALID_PRODUCT

    When product is invalid

    INVALID_DATE

    When an entered date is invalid

    INTERNAL ERROR

    KPLAY internal error

    REQUEST_TOO_FREQUENT

    The same product ID is called twice within a minute.




  • 13. BUY-IN (Mandatory)


    KPLAY will call this API in the merchant system to notify merchants that a buyin occurs. (Only for P2P Product)


    HTTP methods : POST

    URL : <Merchant endpoint>/buyin


  • 13.1 Request Format

    Header

    Field

    Type

    Description

    secret-key

    string

    KPLAY merchant secret key. For merchants to verify the request comes from KPLAY.


    Body

    Field

    Type

    Description

    user_id

    integer

    KPLAY user ID

    amount

    decimal(15, 2)

    Buy-in amount

    prd_id

    integer

    Product ID

    txn_id

    string

    Unique transaction ID, also used to be paired with credit call.

    game_id

    integer

    Game ID available to call using product game list API. Refer to 10. Product Game List

    credit_amount

    decimal(15, 2)

    If credit_amount exists, then AG needs to generate credit settlement for it.


  • 13.2 Request Example


    {

    "user_id":1000011,

    "amount":100.00,

    "prd_id":506,

    "txn_id":"A00000005",

    "game_id":1005

    }



    With credit_amount


    {

    "user_id":1000011,

    "amount":100.00,

    "prd_id":506,

    "txn_id":"A00000005",

    "game_id":1005,

    "credit_amount":100

    }



  • 13.3 Response Format

    Field

    Type

    Description

    status

    integer

    0 = error

    1 = success

    balance

    decimal(15, 2)

    Latest member balance

    error

    string

    Error message when status = 0


  • 13.4 Response Example

    When success


    {

    "status":1,

    "balance":505.50

    }



    When error


    {

    "status":0,

    "error":"ACCESS_DENIED"

    }



    Error Message

    Description

    ACCESS_DENIED

    Invalid Secret Key

    INVALID_USER

    Check if user exists in merchant system

    DUPLICATE_DEBIT

    Check if a debit with the same “txn_id” exists in the merchant system.

    INSUFFICIENT_FUNDS

    Check if the member has enough balance for the debit.

    UNKNOWN_ERROR

    Internal error in merchant system




  • 14. BET DETAIL


    Merchant can call this API to get the detail of the bet


    HTTP methods : POST

    URL : <KPLAY endpoint>/betresults


  • 14.1 Request Format

    Header

    Name

    Type

    Mandatory

    Remark

    ag-code

    String

    Y

    ag-token

    String

    Y


    Body

    Name

    Type

    Mandatory

    Remark

    lang

    String

    Y

    Korean: ko,

    English: en

    prd_id

    Number

    Y

    txn_id

    string

    Y


  • 14.2 Request Example


    {

    "lang":"en",

    "prd_id":5001,

    "txn_id":"8888888888"

    }



  • 14.3 Response Format

    If the txn id is valid and successfully retrieves bet detail, we will return a URL that will open the bet detail page. If txn id is not valid or fails to retrieve bet detail, we will respond with the error code.


    Body

    Name

    Type

    Mandatory

    Remark

    status

    Number

    Y

    0 = failed

    1 = success

    error

    String

    N


  • 14.4 Response Example


    When success


    When error


    {

    "status":0,

    "error":"GAME_INFO_NOT_FOUND"

    }





  • 15. Member Bet Details


    *Only applicable to hidden poker

    Merchant can call this API to get the member bet details.


    HTTP methods : POST

    URL : <KPLAY endpoint>/betresults/member


  • 15.1 Request Format

    Header

    Name

    Type

    Mandatory

    Remark

    ag-code

    String

    Y

    ag-token

    String

    Y


    Body

    Name

    Type

    Mandatory

    Remark

    user_id

    integer

    Y

    KPLAY user ID


  • 15.2 Request Example


    {

    "user_id":192985

    }



  • 15.3 Response Example


    When success


    When error


    {

    "status":0,

    "error":"INVALID_MEMBER"

    }




  • 16. Remaining Deposit


    Merchant can call this API to get AG available deposit and given deposit.

    *Note: For get remaining deposit api, no request body is needed. And merchant is restricted to 1 minute per request to get remaining deposit.


    HTTP methods : GET

    URL : <KPLAY endpoint>/remainingdeposit


  • 16.1 Request Format

    Header

    Name

    Type

    Mandatory

    Remark

    ag-code

    String

    Y

    ag-token

    String

    Y



  • 16.2 Response Example

    Name

    Type

    Mandatory

    Remark

    given_deposit

    Number

    Y

    available_deposit

    Number

    Y

    status

    Number

    Y

    0 = failed

    1 = success


  • 16.3 Response Example


    When success


    {

    "given_deposit":10000000,

    "available_deposit":1000000,

    "status":1

    }



    When error


    {

    "status":0,

    "error":"INTERNAL_ERROR

    }






  • 17. Get Game Table ID


    Merchants can call this API to get table ID(s) of Evolution based on their current skin setting from KPLAY. For direct launch to specific table purposes.


    HTTP methods : GET

    URL : <KPLAY endpoint>/getgametable


  • 17.1 Request Format

    Header

    Field

    Type

    Description

    ag-code

    String

    KPLAY merchant code

    ag-token

    String

    KPLAY merchant token


    Body

    Field

    Type

    Description

    language

    string

    Language option for game name.

    Default English

    Korean : ko, English : en


  • 17.2 Request Example


    {

    "language":"en"

    }



  • 17.3 Response Format

    Field

    Type

    Desciptipn

    status

    Int

    0 - error
    1 - success

    skin_id

    Int

    The current skin ID of the AG.

    game_name

    String

    The name of the game, from Evolution.

    table_id

    String

    The table ID for direct launch to a specific game table.

    game_id

    Int

    The game ID.

    game_type

    String

    Game Type

    error

    String

    Error message when status = 0


  • 17.4 Response Example


    When success


    {

    "status":1,

    "tables":[

    {

    "skin_id": 9,

    "game_name":"Golden Wealth Baccarat",

    "game_id": 1,

    "table_id":[

    "gwbaccarat000001",

    "n7ltqx5j25sr7xbe"

    ],

    "game_type":"Baccarat"

    },

    {

    "skin_id": 9,

    "game_name":"Baccarat Control Squeeze",

    "game_id": 92,

    "table_id":[

    "k2oswnib7jjaaznw"

    ],

    "game_type":"Baccarat"

    }

    ]

    }








  • 18. Get Rake API (P2P Product)


    Merchants can call this API to get new rakes daily.

    Note: Strictly for seamless wallet ONLY. Note: To get accurate data, please always call this API with the date of yesterday, example for accurate data on May 4th you should call this API on May 5th


    HTTP methods : POST

    URL : <KPLAY endpoint>/getrake


  • 18.1 Request Format

    Header

    Field

    Type

    Description

    ag-code

    String

    KPLAY merchant code

    ag-token

    String

    KPLAY merchant token


    Body

    Name

    Type

    Description

    prd_id

    Int

    P2P Product ID

    start_date

    Date

    Begin date of rake.

    end_date

    Date

    End date of rake



  • 18.2 Request Example



    {

    "prd_id":10002,

    "start_date": "2023-04-17",

    "end_date": "2023-04-18"

    }




  • 18.3 Response Format

    Field

    Type

    Desciptipn

    status

    Int

    0 - error
    1 - success

    data

    Object

    username

    String

    The username of the user

    member_id

    Int

    The user ID of KPLAY

    date

    Date

    The date (UTC+9)

    rake

    Decimal

    The daily rake


  • 18.4 Response Example


    When success


    {

    "status":1,

    "data":[

    {

    "username": "babara",

    "member_id":192928,

    "date": 2023-04-17,

    "rake":"123.00",

    },

    {

    "username": zuhui,

    "member_id":192930,

    "date": 2023-04-18,

    "rake":"123.00",

    }

    ]

    }




    When error


    {

    "status":0,

    "error":"ACCESS_DENIED"

    }



    Error Message

    Description

    INVALID_DATE

    start_date or end_date from the request body is not empty/not found.

    INVALID_PARAMETER

    ag_code or ag_token from header is not found/mismatch.

    ACCESS_DENIED

    Merchant is disabled.

    USER_NOT_EXIST

    The Merchant does not exist.

    UNKNOWN_ERROR

    Invalid wallet. The request was not from seamless wallet Merchant.

    INTERNAL_ERROR

    KPLAY internal error.




  • 19. Get Results Cronjob Setup Tutorial


    In Kplay, a credit call request is initiated only once. This credit call must be received and processed through each agent's credit callback. In the event that a credit call fails to be received, possibly due to network issues or other unforeseen circumstances, please note that Kplay will not issue a resend. Instead, agents are responsible for resolving any pending transactions with the Results API.

    Note: The sample codes shown in this tutorial only applicable in PHP



  • 19.1 Steps to call Results API from KPLAY

    Create a new php file and follow the sample code shows at bottom to retrieve data from KPLAY API.



  • 19.2 About Results API

    Please refer to 7. Results first to get the information about this API.



  • 19.3 Endpoint URL

    The format of the Endpoint URL to call this API is the combination of KPLAY endpoint, a string with words 'results', product Id and transaction Id. The sample code is shown below:



    $endpoint = 'https://KPLAYendpoint.com/';

    $prdId = 1;

    $txnId = '123456789';


    $url = $endpoint.'results/'.$prdId.'/'.$txnId;



  • 19.4 Header

    The format of the Header to call this API is an array which contains 'Content-Type', 'Ag-Code', 'Ag-Token' keys.



    $agent = 'ABC1234';

    $token = 'agentsampletoken';


    $header = array('Content-Type: application/json',

    'Ag-Code: '.$agent,

    'Ag-Token:'.$token,);



    Note:

    The Ag-Code is the merchant's code while the Ag-Token can be get from the API Credential module in KPLAY Backoffice.


  • 19.5 Send GET Request with PHP

    Now, we have the $url from 19.3 Endpoint URL and $header from 19.4 Header. We can send the Get Request with PHP to get the results response from KPLAY. The sample code below is the example to use the $url and $header to call the results API.



    $ch = curl_init();

    curl_setopt($ch, CURLOPT_URL, $url);


    if($header == '')

    {

    $header = array('Content-Type: application/json');

    }


    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);


    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);


    $response = curl_exec($ch);

    curl_close($ch);


    return $response;



    Note:

    The Ag-Code is the merchant's code while the Ag-Token can be get from the API Credential module in KPLAY Backoffice.


  • 19.6 Steps to install Crontab to server

    Enter to the server and cd into the project that we want to install the crontab. Type the command below to enter to the crontab view.



    crontab -e



    Follow the format below to add the php file created in Step 1 to the crontab. The * * * * * at front is cron schedule expressions which help to schedule the time to execute the file. Then, type php and follow by the path of the php file we want to add to the crontab.



    #* * * * * php ~/testFolder/testCron/cron1.php // Will be ignored

    * * * * * php ~/testFolder/testCron/cron2.php // Will be executed



    In the sample code above, the crontab will run the cron2.php file every minutes because we set the cron schedule expressions to * * * * *. The cron1.php will not be executed by crontab because we put a # at the front of the line.


    Note: The # is the comment syntax in crontab. The crontab will ignore the line starts with this syntax.

    Please refer to this website: crontab.guru to have a better pictures of the cron schedule expressions



    To decide if you want to retry each transaction in which its credit is not processed (we recommend the logic to increase the time interval each time you retry)


    After you decide if you want to retry, the results are re-received through the results API. If there are results for the transactions, it will reflect in the response.



  • 19.7 Basic Logic Description

    19.7.1 Attention

    In the case of e-sports or live sports, the time between placing a bet and the processing of results can be several hours or even days. Continuously checking the results every minute can lead to excessive traffic, so it is recommended to increase the interval.


    19.7.2 Simplify Retry Logic

    Using the square root, you can create intervals that increase exponentially.



    last_execute_interval : Difference from last run time


    // Do not process for the first 5 minutes

    last_execute_interval = last_execute_interval -5;


    // After that, the interval increases with square root

    //1min 2min 4min 8min 16min 32min 64min


    if (round(sqrt(last_execute_interval)) == sqrt(last_execute_interval))

    {

    // Please try again here

    }



  • 19.8 Sample Code


    function __construct()

    {

    try

    {

    // db connection

    $servername = DB_SERVER_NAME;

    $username = DB_USERNAME;

    $password = DB_PASSWORD;

    $dbname = DB_NAME;


    $hostName = KPLAY_HOSTNAME; //KPLAY Hostname

    $token = KPLAY_TOKEN; //KPLAY Token

    $agent = KPLAY_CODE; //KPLAY Code


    $conn = new \mysqli($servername, $username, $password, $dbname);

    //if connect to DB failed

    if ($conn->connect_error)

    {

    return $response = [

    'status' => 0

    ,'error' => 'UNKNOWN_ERROR'

    ];

    }


    $selectSQL = "SELECT a.txn_id, a.prd_id, a.user_id

    FROM debit a

    LEFT JOIN credit b

    ON a.txn_id = b.txn_id

    WHERE b.txn_id IS NULL";


    $db = $conn->query($selectSQL);


    // Extracts items that exist in the debit list but do not exist in the credit list.


    if ($db->num_rows > 0)

    {

    while($row = $db->fetch_assoc())

    {

    $txnId = $row['txn_id'];

    $prdId = $row['prd_id'];

    $userId = $row['user_id'];


    // Please add the logic related to interval determination here.


    $method = 'results'; //auth game method


    $url = $hostName.$method.'/'.$prdId.'/'.$txnId; //auth game endpoint


    //prepare header

    $header = [

    'Content-Type: application/json',

    'Ag-Code: '.$agent,

    'Ag-Token:'.$token,

    ];


    $data = [];


    $helper = new Helper;

    $response = $helper->getData($url,$header);


    $data = json_decode($response);


    // For each item, the results are received via result call.


    $status = $data->status;

    $type = $data->type;


    if ($status == 1 && $type == 1)

    {

    // Once the results are received, add the information into the credit list.


    $gameId = $data->game_id;

    $stake = $data->stake;

    $payout = $data->payout;

    $isCancel = $data->is_cancel;


    if ($isCancel == 1)

    {

    $betType = 'x';

    $credit = $stake;

    }

    else

    {

    $betType = 'c';

    $credit = $payout;

    }


    //Insert credit record to DB

    $insertSQL = "INSERT INTO credit

    (txn_id,type,amount)

    VALUES

    ('".$txnId."','".$betType."',".$credit.")";


    $insertDB = $conn->query($insertSQL);


    // Update user balance

    $updateSQL = "UPDATE users_balance

    SET balance = balance + ".$credit."

    WHERE user_id = ".$userId;


    $updateDB = $conn->query($updateSQL);

    }

    else

    {

    $error = $data->error;

    var_dump($error);


    exit;

    }

    }

    }

    else

    {

    exit;

    }

    }

    catch(\Exception $e)

    {

    return '';

    }

    }




  • 20. Appendix


  • 20.1 Language

    Follow ISO 639-1 Code


    Language

    Code

    English

    en

    Korea

    ko

    Indonesian

    id

    Hindi

    hi

    Thai

    th

    Chinese

    zh

    Bahasa Malaysia

    bm

    Japanese

    jp

    Vietnamese

    vn


  • 20.2 Slot Lobby Skins

    1 - Dark Theme



    2 - Light Theme



  • 21. Sample Code


  • 21.1 Authentication


    $hostName = 'http://www.KPLAY.com/';

    $method = 'auth';

    $token = 'xxxxxxxxx';

    $agent = 'xxxxxxxxx';


    $url = $hostName.$method;


    $header = array('Content-Type: application/json',

    'Ag-Code: '.$agent,

    'Ag-Token: '.$token,);


    $data = [

    'user' => [

    'id' => '12'

    ,'name' => 'superjohn'

    ,'balance' => '88899.00'

    ,'language' => 'ko'

    ]

    ,'prd' => [

    'id' => 1

    ,'type' => 0

    ,'is_mobile' => 0

    ]

    ];


    $response = self::postData($url,$data,$header);


    $response = json_decode($response);


    $iframe = $response->{'response'};


    public static function postData($url,$data,$header = '')

    {

    try

    {

    $ch = curl_init();


    curl_setopt($ch, CURLOPT_URL, $url);

    curl_setopt($ch, CURLOPT_POST, 1);


    if($header == '')

    {

    $header = array('Content-Type: application/json');

    }


    curl_setopt($ch, CURLOPT_HTTPHEADER, $header);


    if (is_array($data))

    {

    $data = json_encode($data);

    }

    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);


    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);


    $response = curl_exec($ch);

    curl_close($ch);


    return $response;

    }

    catch(\Exception $e)

    {

    return '';

    }

    }