Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

zong.com open api


megaplatinum

Recommended Posts

I'm not a coding guru, but this looks quite possible to implement. Zong.com offers a unique possibility of payment via sms shortcode, and the billing goes to the end user's cell/mobile phone! This is interesting for customers who don't have credit cards, and I want to offer this as a payment alternative. They have service in the USA/UK/Europe! Anyone want to take a crack at this?

 

zong.com

 

Go to applications / open API. Full documentation is there

Link to comment
Share on other sites

example php code supplied by zong.com

 

<?php

/*
* function sendSMS(...), send a SMS MT (Mobile Terminated)
* arguments are:
* msisdn = phone number in international format, must be URL encoded using rawurlencode (ex: %2B41791234567)
* pwd = your Zong open API password
* ssid = Sub Service Id for this MT, must be the same as the MO
* shortcode = short number of the service (ex: 911)
* price = Tariff class for this MT, must be URL encoded using rawurlencode (ex: CHF%200.50)
* category = category of the MT (ex: rsp), please refer to the Z-Open API documentation
* txt = the text of the MT, UTF8 end URL encoded
* flags (optionnal) = please refer to doc
* ref (optionnal) = opaque reference that will be returned to your acknowledge handler
*/
function sendSMS($msisdn, $pwd, $ssid, $shortcode, $price, $category, $txt, $flags, $ref)
{
	$url = "https://secure.echosms.net/premium/smsmt-utf8.asp?";
	$querystr = '';
	$query = Array();

	$query["MSISDN"] = $msisdn;
	$query["SSID"] = $ssid;
	$query["PWD"] = $pwd;

	/*
	 * If short_code, price or category are not defined, the SMS will be sent as bulk
	 */		if($shortcode != '' && $price != '' && $category != '')
	{
		$query["SC"] = $shortcode;
		$query["TCL"] = $price;
		$query["CAT"] = $category;
	}

	if($txt != '')
		$query["TXT"] = $txt;

	if($flags != '')
		$query["FLAGS"] = $flags;

	if($ref != '')
		$query["REF"] = $ref;

	foreach($query as $key => $value)
		$querystr .= "&$key=$value";

	//removes the first &		 $querystr = substr($querystr, 1, strlen($querystr));

	/*
	 * CURL is used here to send data over HTTP
	 */		$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url.$querystr);
	curl_setopt ($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
	curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
	$getResult = curl_exec($ch);

	if(curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200)
	{
		curl_close($ch);
		return false;
	}

	curl_close ($ch);

	return true;
}
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...