SMS Gateway

G K G Guru

PayPal SMS Integration

PayPal IPN integration for payment notifications and transaction SMS alerts.

Instant Notifications

Real-time SMS alerts for important events

Global Reach

Send SMS to 200+ countries worldwide

Reliable Delivery

99.9% uptime with delivery reports

Easy Integration

Simple REST API with webhooks

Requirements

Before you begin:
  • Active SMS Gateway account with API access
  • API Key from your dashboard
  • PayPal account with webhook/API access
  • Basic understanding of REST APIs

Setup Guide

  1. Get Your API Key
    Log in to your SMS Gateway dashboard and navigate to Settings > API Keys to generate a new API key.
  2. Configure PayPal Webhook
    In your PayPal settings, configure a webhook URL pointing to your application endpoint.
  3. Create SMS Handler
    Set up an endpoint in your application to receive PayPal webhooks and send SMS via our API.
  4. Test the Integration
    Trigger a test event in PayPal and verify SMS delivery.

Webhook Integration

Create a webhook endpoint to receive events from PayPal and trigger SMS notifications.

Webhook Handler (Node.js)

JavaScript
const express = require('express');
const axios = require('axios');
const app = express();

app.use(express.json());

// SMS Gateway configuration
const SMS_API_KEY = process.env.SMS_API_KEY;
const SMS_API_URL = 'https://whitelabled.securesmsc.com/api/v2/sms/send';

// Webhook endpoint for PayPal
app.post('/webhook/paypal', async (req, res) => {
    try {
        const event = req.body;
        
        // Extract relevant data from the event
        const phoneNumber = event.phone || event.mobile;
        const message = formatMessage(event);
        
        if (phoneNumber && message) {
            await sendSMS(phoneNumber, message);
        }
        
        res.status(200).json({ success: true });
    } catch (error) {
        console.error('Webhook error:', error);
        res.status(500).json({ error: 'Internal server error' });
    }
});

async function sendSMS(recipient, message) {
    const response = await axios.post(SMS_API_URL, {
        sender_id: 'NOTIFY',
        recipient: recipient,
        message: message,
        route: 'transactional'
    }, {
        headers: {
            'Authorization': `Bearer ${SMS_API_KEY}`,
            'Content-Type': 'application/json'
        }
    });
    
    return response.data;
}

function formatMessage(event) {
    // Customize message based on event type
    return `PayPal Notification: ${event.type || 'New event'} - ${event.description || 'Check your dashboard'}`;
}

app.listen(3000, () => console.log('Webhook server running'));

Webhook Handler (Python)

Python
from flask import Flask, request, jsonify
import requests
import os

app = Flask(__name__)

SMS_API_KEY = os.environ.get('SMS_API_KEY')
SMS_API_URL = 'https://whitelabled.securesmsc.com/api/v2/sms/send'

@app.route('/webhook/paypal', methods=['POST'])
def handle_webhook():
    try:
        event = request.json
        
        phone_number = event.get('phone') or event.get('mobile')
        message = format_message(event)
        
        if phone_number and message:
            send_sms(phone_number, message)
        
        return jsonify({'success': True}), 200
    except Exception as e:
        return jsonify({'error': str(e)}), 500

def send_sms(recipient, message):
    headers = {
        'Authorization': f'Bearer {SMS_API_KEY}',
        'Content-Type': 'application/json'
    }
    
    data = {
        'sender_id': 'NOTIFY',
        'recipient': recipient,
        'message': message,
        'route': 'transactional'
    }
    
    response = requests.post(SMS_API_URL, json=data, headers=headers)
    return response.json()

def format_message(event):
    event_type = event.get('type', 'New event')
    description = event.get('description', 'Check your dashboard')
    return f'PayPal Notification: {event_type} - {description}'

if __name__ == '__main__':
    app.run(port=3000)

Code Examples

Send SMS via API

cURL
curl -X POST "https://whitelabled.securesmsc.com/api/v2/sms/send" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sender_id": "PAYPAL",
    "recipient": "1234567890",
    "message": "Your PayPal notification: Event triggered successfully!",
    "route": "transactional"
  }'

PHP Integration

PHP
<?php

class PayPalSmsIntegration
{
    private $apiKey;
    private $apiUrl = 'https://whitelabled.securesmsc.com/api/v2/sms/send';
    
    public function __construct($apiKey)
    {
        $this->apiKey = $apiKey;
    }
    
    public function sendNotification($phone, $event)
    {
        $message = $this->formatMessage($event);
        
        $data = [
            'sender_id' => 'PAYPAL',
            'recipient' => $phone,
            'message' => $message,
            'route' => 'transactional'
        ];
        
        $ch = curl_init($this->apiUrl);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($ch, CURLOPT_HTTPHEADER, [
            'Authorization: Bearer ' . $this->apiKey,
            'Content-Type: application/json'
        ]);
        
        $response = curl_exec($ch);
        curl_close($ch);
        
        return json_decode($response, true);
    }
    
    private function formatMessage($event)
    {
        return "PayPal Alert: " . ($event['type'] ?? 'Notification') . 
               " - " . ($event['description'] ?? 'Check your dashboard');
    }
}

// Usage
$sms = new PayPalSmsIntegration('YOUR_API_KEY');
$result = $sms->sendNotification('+1234567890', [
    'type' => 'New Event',
    'description' => 'Action required'
]);
print_r($result);
?>

Common Use Cases

Event Notifications

Send instant SMS alerts when important events occur in PayPal.

  • New lead or customer notifications
  • Status change alerts
  • Deadline reminders
Team Alerts

Keep your team informed with SMS notifications for critical updates.

  • Assignment notifications
  • Urgent task alerts
  • Escalation messages

Troubleshooting

Common Issues

SMS Not Delivering

  • Verify your API key is correct and active
  • Check the phone number format (include country code)
  • Ensure you have sufficient SMS credits
  • Check for any sender ID restrictions in the destination country

Webhook Not Triggering

  • Verify the webhook URL is publicly accessible
  • Check PayPal webhook logs for errors
  • Ensure your server returns a 200 status code
  • Verify SSL certificate is valid (HTTPS required)
Need Help?
Contact our support team at smsalerts.noreply@racksserver.com or check our API documentation.