Quick Start
Get up and running with PayGate in under 5 minutes.
Quick Start
This guide will help you integrate PayGate and create your first payment in under 5 minutes.
Prerequisites
Before you begin, make sure you have:
- A PayGate account (Sign up here)
- Your API keys from the Dashboard
- Node.js 18+ (or your preferred language)
Installation
npm install @paygate/nodepip install paygate-pythoncomposer require paygate/paygate-phpgo get github.com/paygate/paygate-goCreate Your First Payment
Initialize the SDK
Configure the SDK with your secret API key:
import PayGate from '@paygate/node'
const paygate = new PayGate('sk_test_...')import paygate
client = paygate.Client('sk_test_...')<?php
require 'vendor/autoload.php';
$paygate = new \PayGate\PayGate('sk_test_...');import "github.com/paygate/paygate-go"
client := paygate.New("sk_test_...")Create a Payment
Create a mobile money payment request:
const payment = await paygate.payments.create({
amount: 5000, // Amount in pesewas (GHS 50.00)
currency: 'GHS',
payment_method: 'mobile_money',
provider: 'mtn',
phone: '0241234567',
description: 'Order #1234',
metadata: {
order_id: '1234',
customer_email: 'customer@example.com'
}
})
console.log(payment.id) // pay_abc123...
console.log(payment.status) // pendingpayment = client.payments.create(
amount=5000,
currency='GHS',
payment_method='mobile_money',
provider='mtn',
phone='0241234567',
description='Order #1234',
metadata={
'order_id': '1234',
'customer_email': 'customer@example.com'
}
)
print(payment.id) # pay_abc123...
print(payment.status) # pending$payment = $paygate->payments->create([
'amount' => 5000,
'currency' => 'GHS',
'payment_method' => 'mobile_money',
'provider' => 'mtn',
'phone' => '0241234567',
'description' => 'Order #1234',
'metadata' => [
'order_id' => '1234',
'customer_email' => 'customer@example.com'
]
]);
echo $payment->id; // pay_abc123...
echo $payment->status; // pendingpayment, err := client.Payments.Create(&paygate.PaymentParams{
Amount: 5000,
Currency: "GHS",
PaymentMethod: "mobile_money",
Provider: "mtn",
Phone: "0241234567",
Description: "Order #1234",
Metadata: map[string]string{
"order_id": "1234",
"customer_email": "customer@example.com",
},
})
fmt.Println(payment.ID) // pay_abc123...
fmt.Println(payment.Status) // pendingHandle the Payment
The customer will receive a prompt on their phone to authorize the payment. You can:
- Poll for status - Check the payment status periodically
- Use webhooks - Receive real-time notifications (recommended)
// Option 1: Poll for status
const updatedPayment = await paygate.payments.retrieve(payment.id)
console.log(updatedPayment.status) // succeeded, failed, or pending
// Option 2: Set up webhooks (see Webhooks guide)Test Your Integration
Use test API keys (sk_test_...) during development. No real money is moved in test mode.
Test Phone Numbers
| Phone Number | Behavior |
|---|---|
0241234567 | Always succeeds |
0241234568 | Always fails (insufficient funds) |
0241234569 | Always fails (timeout) |
Test Amounts
| Amount (pesewas) | Behavior |
|---|---|
| Any amount | Succeeds normally |
99999999 | Fails (amount too large) |
What's Next?
Now that you've created your first payment, explore more features:
- Handle Webhooks - Get real-time payment notifications
- Accept Subscriptions - Set up recurring billing
- Process Payouts - Send money to customers
- Go Live Checklist - Prepare for production