Embedded checkout (raw) - achertovsky/yii2-bluesnap GitHub Wiki
Manual is not full, but at least something.
In case of demand i can create server handler for embedded checkout and complete this manual.
DOCS: https://developers.bluesnap.com/v8976-Tools/docs/embedded-checkout
First of all, define page where embedded checkout gonna occur.
public function actionExample()
{
$token = achertovsky\bluesnap\helpers\EmbeddedCheckout::getToken();
return $this->render('index', [
'token' => $token,`
]);
}
On the frontend page apply asset and do config in js
<?php
achertovsky\bluesnap\EmbeddedAsset::register($this);
?>
<script>
var openCheckout = true; // in case of false you will have to display popup manually
var json = {
language: 'EN',
token: '<?=$token?>',
shopperData: {
firstname: '<?=$currentUser->getProfileObject()->firstname?>',
lastname: '<?=$currentUser->getProfileObject()->lastname?>'
}
};
// in here create handler that will let server know about success/refuse/etc
function callbackFunction(eCheckoutResult) {
if (eCheckoutResult.code == 1) {
console.log('success payment');
}
}
</script>
In the end you'll see popup with credit card request.