<?php
// Need to enter your payment access key value here
$payment_access_key = '###YOUR_PAYMENT_ACCESS_KEY###';
// Now, have to encode the $payment_access_key value with the base64 encode
$encoded_data = base64_encode($payment_access_key);
// Action Endpoint
$endpoint = 'https://payport.novalnet.de/v2/payment';
// Build the Headers array
$headers = [
// The Content-Type should be "application/json"
'Content-Type:application/json',
// The charset should be "utf-8"
'Charset:utf-8',
// Optional
'Accept:application/json',
// The formed authenticate value (case-sensitive)
'X-NN-Access-Key:' . $encoded_data
];
$data = [];
// Build Merchant Data
$data['merchant'] = [
// Your API signature value
'signature' => '###YOUR_API_SIGNATURE###',
// Your corresponding tariff ID
'tariff' => '###YOUR_TARIFF_ID###'
];
// Build Customer Data
$data['customer'] = [
// Shopper's first name - It is mandatory for Przelewy24 & Banconatct while using the "no_nc" parameter
//'first_name' => 'Max',
// Shopper's last name - It is mandatory for Przelewy24 & Banconatct while using the "no_nc" parameter
//'last_name' => 'Mustermann',
// Shopper's email and when using "no_nc", either the mobile or email is necessary
'email' => 'test@novalnet.de',
// Shopper's Ip address
'customer_ip' => '127.0.0.1',
// Shopper's customer number from the shop
'customer_no' => '12345',
// Shopper's Telephone number
'tel' => '+49 089 123456',
// Shopper's Mobile number and when using "no_nc", either the mobile or email is necessary
'mobile' => '+491747781423',
// Use of minimal cutsomer data
'no_nc' => '1',
// Shopper's birthdate value YYYY-MM-DD - Decomment it based on your usage
// 'birth_date' => '1992-06-10',
// Shopper's gender - Decomment it based on your usage
// 'gender' => 'u',
// Shopper's company vat ID value - Decomment it based on your usage
// 'vat_id' => 'DE123456',
// Shopper's company regestration number - Decomment it based on your usage
// 'reg_no' => 'HRB1234',
// Shopper's company tax ID value - Decomment it based on your usage
// 'tax_id' => '123/123/123',
// Shopper's session value - Decomment it based on your usage
// 'session' => 'fedgrgst5653653hdgfsvgdsf622627e',
// Shopper's fax number - Decomment it based on your usage
// 'fax' => '+49 89 654321',
];
// Build Transaction Data
$data['transaction'] = [
// The Payment type of the transaction
'payment_type' => 'CREDITCARD',
// The transaction Amount in smaller currency unit
'amount' => 100,
// The transaction currency's ISO code
'currency' => 'EUR',
// The mode of the transaction
'test_mode' => 1,
// The mode of the transaction
'order_no' => 6789,
// The Hook URL value for this particular transaction
'hook_url' => '###YOUR_HOOK_URL###',
// The flag to create the token for the payment data - Decomment it based on your usage
'create_token' => 1,
// Build Payment Data
'payment_data' => [
'pan_hash' => '###PAN_HASH###',
'unique_id' => '###UNIQUE_ID###'
]
];
/*
// Subscription Data, used for processing Novalnet`s subscription - Optional object - Decomment it based on your usage
$data['subscription'] = [
// The interval between each cycle
'interval' => '1m',
// Subscription trial interval if applicable
'trial_interval' => '3m',
// Subscription trial interval amount if applicable
'trial_amount' => '150'
];
*/
/*
// Marketplace data, used for the affiliate`s marketplace model - Optional object - Decomment it based on your usage
$data['marketplace'] = [
// To submit amount for several affiliates to be booked
'tx_split' => [
'2261' => '20',
'2271' => '30'
]
];
*/
/*
// Affiliate Data, used for the affiliate`s revenue split model - Optional object - Decomment it based on your usage
$data['affiliate'] = [
// To submit shares for several affiliates for the same transaction
'subvendors'=> [
'2261' => '20',
'2271' => '30'
]
];
*/
// Custom Data - Optional object
$data['custom'] = [
// Shopper's selected language in shop
'lang' => 'EN',
// Custom parameter's key - Optional object - Decomment it based on your usage
// 'input1' => 'your internal reference parameter name',
// Custom parameter's value - Optional object - Decomment it based on your usage
// 'inputval1' => 'your internal reference parameter value'
];
// Convert the array to JSON string
$json_data = json_encode($data);
// Handle Response
$response = send_request($json_data, $endpoint, $headers);
function send_request($data, $url, $headers) {
// Initiate cURL
$curl = curl_init();
// Set the url
curl_setopt($curl, CURLOPT_URL, $url);
// Set the result output to be a string
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// Set the POST value to true (mandatory)
curl_setopt($curl, CURLOPT_POST, true);
// Set the post fields
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
// Set the headers
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
// Execute cURL
$result = curl_exec($curl);
// Handle cURL error
if (curl_errno($curl)) {
echo 'Request Error:' . curl_error($curl);
return $result;
}
// Close cURL
curl_close($curl);
// Decode the JSON string
$result = json_decode($result);
return $result;
}
?>