Create a transaction

<?php

$request_body = array(
    'transaction' => array(
        'amount' => $context->transaction->amount,
        'currency' => $context->transaction->currency,
        'reference' => $context->transaction->reference
    ),
    'customer' => array(
        'email' => $context->customer->email,
        'ip' => $context->customer->ip,
        'country' => $context->customer->country,
        'locale' => $context->customer->locale
    )
);

$transaction = $MK->createTransaction($request_body);

?>
Request
Content type
Headers
Body
Response
Content type
Headers
Body
We use js callback function to receive the data back from the credit card dialog
We have placed this js script to the page:

<script src="/checkout/dist/checkout.min.js"></script>

<script>
    window.cc_callback = function(data)
    {
        alert( 'The CC dialog returned: \r\n \r\n'+ JSON.stringify(data) );
    }

    window.Maksekeskus.Checkout.initialize({
        'key' : '',
        'transaction' : '',
        'email' : 'john@diehard.ly',
        'clientName' : 'John McLane',
        'locale' : 'en',
        'completed' : 'cc_callback',
        'cancelled' : 'cc_callback'
    });
</script>

<button type="button" class="btn btn-primary" aria-label="Open CC Payment dialog" onclick="window.Maksekeskus.Checkout.open();">Open payment dialog</button>