This repository was archived by the owner on Sep 29, 2024. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathExample.php
More file actions
Latest commit
45 lines (33 loc) · 971 Bytes
/
Copy pathExample.php
File metadata and controls
45 lines (33 loc) · 971 Bytes
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
42
43
44
45
<?php
require_once'vendor/autoload.php';
useDecoderid\GojekApi;
$gojek = newGojekApi();
/** SET UUID */
$uuid = $gojek->generateUuid();
$gojek->setUuid($uuid);
/** LOGIN */
$phone = '[PHONE]';
$pin = '[PIN]';
$login = $gojek->login($phone, $pin);
/**
* VERIFY OTP
*/
$verifyOtp = $gojek->verifyOtp('[OTP]', $login->data->otp_token);
if ($verifyOtp->access_token) {
print_r($verifyOtp);
}
if ($verifyOtp->success) {
print_r($verifyOtp);
}
/**
* IF PIN AUTHENTICATION AFTER OTP
*/
if ($verifyOtp->errors[0]->code === 'mfa:customer_send_challenge:challenge_required') {
$challengeToken = $verifyOtp->errors[0]->details->challenge_token;
$challengeId = $verifyOtp->errors[0]->details->challenges[0]->gopay_challenge_id;
$verifyMFA = $gojek->verifyMFA($challengeId, $pin);
if ($verifyMFA->success) {
$verifyMFAToken = $gojek->verifyMFAToken($challengeToken, $verifyMFA->data->token);
print_r($verifyMFAToken);
}
}