01.
<?php
02.
03.
require_once
dirname(
__FILE__
).
'/omise-php/lib/Omise.php'
;
04.
define(
'OMISE_API_VERSION'
,
'2015-11-17'
);
05.
06.
07.
define(
'OMISE_PUBLIC_KEY'
,
'pkey_test_00000'
);
08.
define(
'OMISE_SECRET_KEY'
,
'skey_test_00000'
);
09.
10.
$charge
= OmiseCharge::create(
array
(
11.
'amount'
=> 3000,
12.
'currency'
=>
'thb'
,
13.
'card'
=>
$_POST
[
"omiseToken"
]
14.
));
15.
16.
if
(
$charge
[
'status'
] ==
'successful'
) {
17.
echo
'Success'
;
18.
}
else
{
19.
echo
'Fail'
;
20.
}
21.
22.
print(
'<pre>'
);
23.
print_r(
$charge
);
24.
print(
'</pre>'
);
25.
?>