Skip to content

Instantly share code, notes, and snippets.

@manuelgeek
Created December 21, 2017 07:18
Show Gist options
  • Save manuelgeek/02f981e1eef36500988db9872094852c to your computer and use it in GitHub Desktop.
Save manuelgeek/02f981e1eef36500988db9872094852c to your computer and use it in GitHub Desktop.
Mpesa Call Back Json pattern and saving
{
"Body": {
"stkCallback": {
"MerchantRequestID": "8948-2950929-465",
"CheckoutRequestID": "ws_CO_251120171533239788",
"ResultCode": 0,
"ResultDesc": "The service request is processed successfully.",
"CallbackMetadata": {
"Item": [
{
"Name": "Amount",
"Value": 150
},
{
"Name": "MpesaReceiptNumber",
"Value": "LKP3DA0Q6F"
},
{
"Name": "Balance"
},
{
"Name": "TransactionDate",
"Value": 20171125153789
},
{
"Name": "PhoneNumber",
"Value": 254724540039
}
]
}
}
}
}
-- phpMyAdmin SQL Dump
-- version 4.6.5.2
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Dec 21, 2017 at 08:14 AM
-- Server version: 10.1.21-MariaDB
-- PHP Version: 7.0.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `eldoclassifieds`
--
-- --------------------------------------------------------
--
-- Table structure for table `transactions`
--
CREATE TABLE `transactions` (
`id` int(10) UNSIGNED NOT NULL,
`merchant_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`checkout_id` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`result_code` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`phone_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`amount` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`mpesa_receipt_no` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`valid` tinyint(1) NOT NULL DEFAULT '0',
`user_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`listing_id` varchar(191) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Dumping data for table `transactions`
--
INSERT INTO `transactions` (`id`, `merchant_id`, `checkout_id`, `result_code`, `phone_no`, `amount`, `mpesa_receipt_no`, `valid`, `user_id`, `listing_id`, `created_at`, `updated_at`) VALUES
(1, '13759-195812-2', 'ws_CO_26112017005057355', '0', '254724540039', '240', 'LKQ5DKNPU9', 1, '1', '1', '2017-11-25 18:53:02', '2017-11-27 15:44:41'),
(5, '8956-3002815-1', 'ws_CO_26112017005513937', '0', '254724540039', '200', 'LKQ5DKO1QB', 1, '1', '10', '2017-11-25 18:58:34', '2017-12-13 12:46:17'),
(6, '8948-2950929-1', 'ws_CO_25112017153323944', '0', '254724540039', '10', 'LKP3DA0Q0J', 1, '1', '13', '2017-12-18 12:00:47', '2017-12-18 13:49:05'),
(7, '8948-2950929-465', 'ws_CO_251120171533239788', '0', '254724540039', '150', 'LKP3DA0Q6F', 1, '1', '12', '2017-12-18 12:03:24', '2017-12-18 13:51:19');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `transactions`
--
ALTER TABLE `transactions`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `transactions_mpesa_receipt_no_unique` (`mpesa_receipt_no`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `transactions`
--
ALTER TABLE `transactions`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment