Files
bilety.brzezovka.pl/templates/tickets/przelewy24.php
Jacek Pyziak 9de042946a feat(01-purchase-data-layer): add post-payment purchase data layer
Phase 1 complete:

- move purchase event to order confirmation after successful payment

- add backend purchase payload builder for transaction and ticket lines

- remove premature purchase push from przelewy24 redirect view
2026-04-19 20:32:38 +02:00

50 lines
2.3 KiB
PHP

<?php
$clientData = $this->order;
$merchant_id = $this->settings['p24']['merchant_id'];
$pos_id = $this->settings['p24']['pos_id'];
$crc_key = '';
if($this->settings['p24']['sandbox']) {
$crc_key = $this->settings['p24']['sandbox_crc_key'];
} else {
$crc_key = $this->settings['p24']['crc_key'];
}
?>
<div class="spinner_container">
<?= \Tpl::view( 'components/spinner'); ?>
</div>
<form
action="<?= $this -> settings['p24']['sandbox'] ? 'https://sandbox.przelewy24.pl/trnDirect' : 'https://secure.przelewy24.pl/trnDirect';?>"
method="post" class="form" id="form_data" accept-charset="ISO-8859-2">
<input type="hidden" name="p24_session_id" value="<?= $this -> przelewy24_hash; ?>" />
<input type="hidden" name="p24_merchant_id" value="<?= $merchant_id; ?>" />
<input type="hidden" name="p24_pos_id" value="<?= $pos_id; ?>" />
<input type="hidden" name="p24_amount" value="<?= $clientData['order_price'] * 100;?>" />
<input type="hidden" name="p24_currency" value="PLN" />
<input type="hidden" name="p24_description" value="Zamówienie nr <?= $clientData['id']; ?>" />
<input type="hidden" name="p24_client" value="<?= $clientData['name'] . ' ' . $clientData['surname'];?>" />
<input type="hidden" name="p24_zip" value="<?= $clientData['zip_code']; ?>" />
<input type="hidden" name="p24_city" value="<?= $clientData['city']; ?>" />
<input type="hidden" name="p24_country" value="PL" />
<input type="hidden" name="p24_email" value="<?= $clientData['email']; ?>" />
<input type="hidden" name="p24_language" value="pl" />
<input type="hidden" name="p24_url_status"
value="https://<?= $_SERVER['SERVER_NAME'];?>/tickets/przelewy24_response/" />
<input type="hidden" name="p24_url_return"
value="https://<?= $_SERVER['SERVER_NAME'];?>/tickets/order_confirm/order=<?= $this -> order['hash'];?>" />
<input type="hidden" name="p24_api_version" value="3.2" />
<input type="hidden" name="p24_wait_for_result" value="1">
<input type="hidden" name="p24_method" value="227">
<input type="hidden" name="p24_sign"
value="<?= md5( $this -> przelewy24_hash . '|' . $merchant_id . '|' . ( $clientData['order_price'] * 100 ) . '|PLN|' . $crc_key );?>" />
</form>
<script type="text/javascript">
$( document ).ready( function() {
$( "#form_data" ).submit();
});
</script>