• Hi, how can I add API code to registration for users? I have some php scripts, and I need help, how to implement it. Where should I give these scripts for SMS pay and how to implement HTML code for SMS payment registration?

    Thank you very much for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Can you give some more details? Where did the scripts come from (are you trying to use a payment plugin, are you trying to code it yourself)? What have you done so far?

    Thread Starter denvanmond

    (@denvanmond)

    I have mo.php and dr.php files

    <?php
    
    define('CONFIG_HASH_KEY', 'ABCDEFGH');
    
    try {
    
    	// read json data
    	$postdata = file_get_contents("php://input");
    	$json = json_decode($postdata);
    	$mosms = $json->mosms;
    
    	// check hash
    	$hashedStr = $mosms->id . $mosms->src_no . $mosms->dst_no . $mosms->gtw_type . $mosms->message;
    	$hashedStr = hash_hmac('SHA1', $hashedStr, CONFIG_HASH_KEY);
    	if($hashedStr != $mosms->hash) {
    		throw new Exception('Hash error');
    	}
    
    	////////////////////////////////////////////////////////////////////
    	// process SMS
    	// your code
    
    	// response example
    	$response = array(
    		'status' => 'ok',
    		'mtsms' => array(
    			'message' => 'Dakujeme za platbu',
    			'bill_key' => 'MYPAY-01-00',
    		),
    	);
    
    	// or
    	$response = array(
    		'status' => 'ok',
    		'mtsms' => array(
    			'message' => 'SMS ste nenapisali v spravnom formate, prosim opravte sa...',
    			'bill_key' => 'MYPAY-00-00',
    		),
    	);
    
    	////////////////////////////////////////////////////////////////////
    
    	$hashedStr = $response['mtsms']['message'] . $response['mtsms']['bill_key'];
    	$response['mtsms']['hash'] = hash_hmac('SHA1', $hashedStr, CONFIG_HASH_KEY);
    
    }
    catch(Exception $e) {
    	$response = array(
    		'status' => 'error',
    		'mtsms' => null,
    	);
    }
    
    echo json_encode($response);

    There should I give some information about provider. Then I should give these .php files or code somewhere, I want it for registration on my page.

    Idobnt know, what I should do, where I should give these code. I dont have any plugin and I dont know, if I should some plugin to use. Its provider in Slovakia, and they dont have any WordPress plugin.

    Thank you for your response.

    Zdeno

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘SMS api code and payment implemetation for registered users’ is closed to new replies.