PHP code example of decoderid / gojek-api

1. Go to this page and download the library: Download decoderid/gojek-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

decoderid / gojek-api example snippets



Decoderid/GojekApi;

$phone = '[PHONE]';
$pin = '[PIN]';

$gojek = new GojekApi();
$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_