return_url
of the shop. Thus the return_url of your shop must be always ready to process also the token_return
message.
transaction
in APIreturn_url
by making POST request with (token_return
message) <?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
|
|
So we have now a Transaction, ID:
3D Secure test cards
To simulate decline you should use same test cards with amount 99.99 EUR. All card payments with such amount will fail.
<script src="<?php echo $context->creditcard->url; ?>/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' : '<?php echo $context->shop->publishableKey; ?>', 'transaction' : '<?php echo $transaction->id; ?>', '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 CC Payment dialog</button>
HTML property name | JS option name | Required | Description |
---|---|---|---|
data-key |
key |
Yes | Shop's Public API Key (available in your Merchant Portal) |
data-transaction |
transaction |
Yes | Transaction ID (created via Billing API) |
data-email |
email |
Pre-filled customer email. | |
data-client-name |
clientName |
Pre-filled customer name. | |
data-locale |
locale |
Customer's language (ISO 639-1). Defaults to en. Languages available:
|
|
data-recurring-title |
recurringTitle |
Title of the subscription/recurring payment the customer is subscribing for. The definition of this option triggers the Checkout form to display recurring payment details. | |
data-recurring-description |
recurringDescription |
Description of the subscription/recurring payment the customer is subscribing for. Include here information about recurring payment amount, interval, etc. | |
data-recurring-confirmation |
recurringConfirmation |
Confirmation text shown next to the approval checkbox for the customer to accept recurring billing. | |
data-recurring-checked |
recurringChecked |
Whether or not the approval checkbox to accept recurring billing is checked by default. Defaults to false. NB! It probably legally more correct that the user does the agreement check by himself. |
|
data-recurring-required |
recurringRequired |
Signals that the dialog will not allow make the payent unless user has marked in the 'recurring-confirmation' checkbox. | |
data-selector |
selector |
Hooks quick implementation to the given selector. Note: it is document.querySelector not jQuery so no fancy selectors. | |
data-completed |
completed |
Name of the JavaScript function to be invoked on success. Will be called with the data argument. | |
data-cancelled |
cancelled |
Name of the JavaScript function to be invoked on user cancel action (modal close). No arguments passed. | |
noConflict |
Tells Checkout to run in noConflic mode. This will return a new instance of Checkout, allowing you to run multiple instances on the same page. Defaults to true in quick mode, false in custom mode. | ||
persistentModal |
Boolean. When set to true, iframe will not be destroyed on close. | ||
openOnLoad |
Open modal right away (on script load). | ||
data-backdrop-close |
backdropClose |
add data-backdrop-close="false" if you want the CC dialog be truly modal. Defaults to true. | |
data-ocp-checked |
ocpChecked |
Whether OCP checkbox is marked by default. Defaults to true. |
return_url