Opayo Form Payment (originally Sage Pay)
Posted: Sun Mar 16, 2025 1:13 pm
Hi there - it's been a long time since I've been on here so New year greatings every one
Now my problem... I'm using Sage Pay Form (API version = 3.0) - and it works everywhere except for America where the state must be included and the state is not being sent or collected for some reason.
Code as follows:
Yes I'm aware that tep_get needs updating
Any help would be welcome
Now my problem... I'm using Sage Pay Form (API version = 3.0) - and it works everywhere except for America where the state must be included and the state is not being sent or collected for some reason.
Code as follows:
Code: Select all
$crypt = [
'ReferrerID' => 'C74D7B82-E9EB-4FBD-93DB-76F0F551C802',
'VendorTxCode' => substr(date('YmdHis') . '-' . $_SESSION['customer_id'] . '-' . $_SESSION['cartID'], 0, 40),
'Amount' => $this->format_raw($order->info['total']),
'Currency' => $_SESSION['currency'],
'Description' => substr(STORE_NAME, 0, 100),
'SuccessURL' => tep_href_link('checkout_process.php', '', 'SSL'),
'FailureURL' => tep_href_link('checkout_payment.php', 'payment_error=' . $this->code, 'SSL'),
'CustomerName' => substr($order->billing['name'], 0, 100),
'CustomerEMail' => substr($order->customer['email_address'], 0, 255),
'BillingSurname' => substr($order->billing['lastname'], 0, 20),
'BillingFirstnames' => substr($order->billing['firstname'], 0, 20),
'BillingAddress1' => substr($order->billing['street_address'], 0, 100),
'BillingCity' => substr($order->billing['city'], 0, 40),
'BillingPostCode' => substr($order->billing['postcode'], 0, 10),
'BillingCountry' => $order->billing['country']['iso_code_2'],
];
if ($crypt['BillingCountry'] == 'US') {
$crypt['BillingState'] = tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], '');
}
$crypt['BillingPhone'] = substr($order->customer['telephone'], 0, 20);
$crypt['DeliverySurname'] = substr($order->delivery['lastname'], 0, 20);
$crypt['DeliveryFirstnames'] = substr($order->delivery['firstname'], 0, 20);
$crypt['DeliveryAddress1'] = substr($order->delivery['street_address'], 0, 100);
$crypt['DeliveryCity'] = substr($order->delivery['city'], 0, 40);
$crypt['DeliveryPostCode'] = substr($order->delivery['postcode'], 0, 10);
$crypt['DeliveryCountry'] = $order->delivery['country']['iso_code_2'];
if ($crypt['DeliveryCountry'] == 'US') {
$crypt['DeliveryState'] = tep_get_zone_code($order->delivery['country']['id'], $order->delivery['zone_id'], '');
}
Any help would be welcome