forked from bukakios21/tokopay-php-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create-advance-order.php
41 lines (41 loc) · 1.51 KB
/
create-advance-order.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
40
41
<?php
require 'tokopay.lib.php';
/*
merchant id dan secret_key bisa di temukan di link ini :
https://dash.tokopay.id/pengaturan/secret-key
*/
$merchant_id = "M240509URZTI530"; //put your merchant id here
$secret_key = "5bc43dda41b1893283f01d3e2c5ba567076fbe7ac80840576a701fdc9dfa23ca"; //put your secret key here
$ref_id = "YOUR_REFERENCE_ID";
$channel = "QRIS"; //list channel bisa di cek di https://docs.tokopay.id/persiapan-awal/metode-pembayaran atau https://dash.tokopay.id/metode-pembayaran
$tokopay = New Tokopay($merchant_id,$secret_key);
$generateSignature = $tokopay->generateSignature($ref_id);
$data = [
'merchant_id' => $merchant_id,
'kode_channel' => $channel,
'reff_id' => $ref_id,
'amount' => 160000,
'customer_name' => "Joko Susilo",
'customer_email' => "[email protected]",
'customer_phone' => "082277665544",
'redirect_url' => "https://tokokamu.com/transaksi/INV231010JKALTES1",
'expired_ts' => 0,
'signature'=>$generateSignature,
'items'=> [
[
'product_code'=>'PR-01',
'name'=>"Celana Panjang Hitam",
'price'=>90000,
'product_url'=>'https://example.com/product',
'image_url'=>'https://example.com/image.jpg'
],
[
'product_code'=>'PR-01',
'name'=>"Kaos Pendek Hitam",
'price'=>70000,
'product_url'=>'https://example.com/product',
'image_url'=>'https://example.com/image.jpg'
]
]
];
echo $tokopay->createAdvanceOrder($data);