-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmotoPaymentRequest.php
39 lines (27 loc) · 1.26 KB
/
motoPaymentRequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/*This file generates the payment request and sends it to the Sips server
For more information on this use case, please refer to the following documentation:
https://documentation.sips.worldline.com/en/WLSIPS.004-GD-Functionality-set-up-guide.html#MOTO */
session_start();
include('Common/sealCalculationPaypagePost.php');
include('Common/flatten.php');
//PAYMENT REQUEST
//You can change the values in session according to your needs and architecture
$_SESSION['secretKey'] = "002001000000002_KEY1";
$_SESSION['sealAlgorithm'] = "HMAC-SHA-256";
$_SESSION['normalReturnUrl'] = "http://localhost/sips-paypage-post-php/Common/paymentResponse.php";
$requestData = array(
"normalReturnUrl" => $_SESSION['normalReturnUrl'],
"merchantId" => "002001000000002",
"amount" => "2000", //Note that the amount entered in the "amount" field is in cents
"currencyCode" => "978",
"keyVersion" => "1",
"responseEncoding" => "base64",
"orderChannel" => "MOTO",
);
$dataStr = flatten_to_sips_payload($requestData);
$dataStrEncode = base64_encode($dataStr);
$_SESSION['seal'] = compute_seal_from_string($_SESSION['sealAlgorithm'], $dataStrEncode, $_SESSION['secretKey']);
$_SESSION['data'] = $dataStrEncode;
header('Location: Common/redirectionForm.php');
?>