Skip to content

Instantly share code, notes, and snippets.

@Kendysond
Kendysond / clean.php
Last active Oct 31, 2018
Clean any Nigerian Number format to be ready for sending SMS
View clean.php
function clean_number($phone_number){
$phone_number = preg_replace('/^0/','234',$phone_number);
$phone_number = preg_replace('/^\+/','',$phone_number);
return $phone_number;
}
// This should convert a number like 09023293092 or +2349023293092 to 2349023293092
View ussd.php
<?php
// Reads the variables sent via POST from our gateway
$sessionId = $_POST["sessionId"];
$serviceCode = $_POST["serviceCode"];
$phoneNumber = $_POST["phoneNumber"];
$text = $_POST["text"];
if ( $text == "" ) {
@Kendysond
Kendysond / paystack-transfers.php
Last active Jun 22, 2017
Paystack Transfers snipper, to be further documented.
View paystack-transfers.php
<?php
error_reporting(-1);
ini_set('display_errors', 1);
define('SK', '');
/// List banks
function list_banks(){
$banks = [];
@Kendysond
Kendysond / gist:95ed6314b43a429c1f0aa571cd25d173
Created Dec 15, 2016
RestSharp Integration for Paystack.
View gist:95ed6314b43a429c1f0aa571cd25d173
var client = new RestClient("https://api.paystack.co/transaction/initialize");
var request = new RestRequest(Method.POST);
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddHeader("authorization", "Bearer SECRET_KEY");
request.AddParameter("application/x-www-form-urlencoded", "email=customer@email.com&amount=10000", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
View gist:734f36d7fbdaa76e11be8dd6d4082440
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
),
View gist:175dbdd1b6f7d0f04486499854b17d99
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
),
@Kendysond
Kendysond / gist:6a12a736aeece46c885445534716b994
Last active Nov 4, 2016
Sampel request to verify transactions
View gist:6a12a736aeece46c885445534716b994
$code = '1212ujwq';
header( 'HTTP/1.1 200 OK' );
$opts = array(
'http'=>array(
'method'=>"GET",
'header'=>"Authorization: Bearer sk_test_877a9699bbc3cf8e42f2190f1b39e35e974d5e2d\r\n"
)
);
$context = stream_context_create($opts);
@Kendysond
Kendysond / Nigeria.sql
Created Jul 25, 2016
List of states and local government areas (lga) in Nigeria.
View Nigeria.sql
-- phpMyAdmin SQL Dump
-- version 4.4.15.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 25, 2016 at 09:44 PM
-- Server version: 5.6.30
-- PHP Version: 7.0.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
You can’t perform that action at this time.