PHP code example of ehcan / myket_validation

1. Go to this page and download the library: Download ehcan/myket_validation 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/ */

    

ehcan / myket_validation example snippets



use \MyketValidator\Validator;

class SomeClass extends SomeInterface {
  public function someMethod(){
    $myket = new Validator($packageName, $token);
    $paymentResult = $myket->validate($sku, $payment_token);

    if($paymentResult['status'] === 200 && $paymentResult['data']['purchaseState'] === 0){
      // success
      // your logic
    }
    else{
      // failed
      // your logic here
    }

  }

}