Integration Steps
Order Payment Service
Order "Online payment collection via e-banking and other systems" service.
Settings → Profile Settings → Service managementCreate a Project
Navigate to "Project and Activities" → "My projects" and create a new project.
Get your project_id and project_passwordAdd Website to Project
Add your website domain to the project settings for security.
Project settings → General project informationConfirm Website Ownership
Verify your website ownership using the provided ownership code.
Contact tech_support@paysera.com if neededIntegrate Recurring Billing
Use your credentials to integrate the Recurring Billing API.
Set up subscription cycles and start billingHow It Works
Automatic Recurring Payments
Paysera automatically charges customers based on your billing cycle without manual intervention.
Simple Setup
Enable recurring payments with just a few parameters in your payment request.
Payment Notifications
Receive callback notifications for every successful recurring payment.
Integration Examples
API Endpoint
https://www.paysera.com/pay/- PHP
- JavaScript
- Python
Creating a Recurring Payment
<?php
require_once 'WebToPay.php';
// Set up recurring payment parameters
$request = WebToPay::buildRequest([
'projectid' => '123456',
'sign_password' => 'your_project_password',
'orderid' => 'subscription_' . time(),
'amount' => 2999, // 29.99 EUR in cents
'currency' => 'EUR',
'accepturl' => 'https://yourdomain.com/subscription/success',
'cancelurl' => 'https://yourdomain.com/subscription/cancel',
'callbackurl' => 'https://yourdomain.com/subscription/callback',
'test' => 0,
'p_email' => 'customer@example.com',
// Recurring payment parameters
'repeat' => 1, // Enable recurring payments
'repeatrequest' => 1, // Request permission for recurring
'repeat_type' => 'month', // Billing cycle: day, week, month, year
'repeat_count' => 0, // Number of payments (0 = unlimited)
]);
// Redirect to payment page
header("Location: https://www.paysera.com/pay/?data=" . urlencode($request));
?>Handling Recurring Payment Callback
<?php
require_once 'WebToPay.php';
try {
$response = WebToPay::validateAndParseData(
$_GET,
'123456',
'your_project_password'
);
// Check payment status
if ($response['status'] == 1) {
$orderId = $response['orderid'];
$amount = $response['amount'];
$email = $response['p_email'];
// Check if this is initial or recurring payment
if (isset($response['repeat'])) {
// This is a recurring payment charge
$paymentNumber = $response['payment_number'] ?? 1;
// Update subscription record
updateSubscriptionPayment($orderId, $amount, $paymentNumber);
// Log recurring charge
logRecurringCharge($orderId, $amount, $paymentNumber);
} else {
// Initial subscription setup
activateSubscription($orderId, $amount);
}
// Always respond with OK
echo 'OK';
}
} catch (Exception $e) {
logError($e->getMessage());
echo 'Error: ' . $e->getMessage();
}
?>Server-Side: Creating Payment Request
// Node.js backend example
const crypto = require('crypto');
function createRecurringPayment(orderData) {
const data = {
projectid: '123456',
orderid: `sub_${Date.now()}`,
amount: orderData.amount, // in cents
currency: 'EUR',
accepturl: 'https://yourdomain.com/subscription/success',
cancelurl: 'https://yourdomain.com/subscription/cancel',
callbackurl: 'https://yourdomain.com/api/subscription/callback',
p_email: orderData.email,
// Recurring payment parameters
repeat: 1,
repeatrequest: 1,
repeat_type: orderData.billingCycle, // 'day', 'week', 'month', 'year'
repeat_count: orderData.repeatCount || 0, // 0 = unlimited
test: 0
};
// Encode data
const encodedData = Buffer.from(
new URLSearchParams(data).toString()
).toString('base64');
// Generate signature
const sign = crypto
.createHash('md5')
.update(encodedData + 'your_project_password')
.digest('hex');
return `https://www.paysera.com/pay/?data=${encodedData}&sign=${sign}`;
}
// Usage
const paymentUrl = createRecurringPayment({
amount: 2999, // 29.99 EUR
email: 'customer@example.com',
billingCycle: 'month',
repeatCount: 0 // unlimited
});Handling Payment Callback
// Express.js webhook handler
app.get('/api/subscription/callback', (req, res) => {
const crypto = require('crypto');
const data = req.query.data;
const ss2 = req.query.ss2;
// Verify signature
const expectedSignature = crypto
.createHash('md5')
.update(data + 'your_project_password')
.digest('hex');
if (ss2 !== expectedSignature) {
return res.status(400).send('Invalid signature');
}
// Decode payment data
const decoded = Buffer.from(data, 'base64').toString();
const params = new URLSearchParams(decoded);
const paymentData = Object.fromEntries(params);
if (paymentData.status === '1') {
// Payment successful
const orderId = paymentData.orderid;
const amount = paymentData.amount;
const paymentNumber = paymentData.payment_number || 1;
// Update subscription in database
updateSubscriptionPayment(orderId, {
amount,
paymentNumber,
status: 'active',
lastPayment: new Date()
});
res.send('OK');
} else {
res.send('Payment failed');
}
});Creating a Recurring Payment
import hashlib
import base64
from urllib.parse import urlencode
def create_recurring_payment(order_id, amount, email, repeat_type='month', repeat_count=0):
"""
Create a recurring payment request for Paysera
Args:
order_id: Unique subscription order identifier
amount: Amount in cents (2999 = 29.99 EUR)
email: Customer email address
repeat_type: Billing cycle - 'day', 'week', 'month', or 'year'
repeat_count: Number of payments (0 = unlimited)
"""
project_id = '123456'
project_password = 'your_project_password'
params = {
'projectid': project_id,
'orderid': order_id,
'amount': amount,
'currency': 'EUR',
'accepturl': 'https://yourdomain.com/subscription/success',
'cancelurl': 'https://yourdomain.com/subscription/cancel',
'callbackurl': 'https://yourdomain.com/api/subscription/callback',
'p_email': email,
'test': 0,
# Recurring payment parameters
'repeat': 1,
'repeatrequest': 1,
'repeat_type': repeat_type,
'repeat_count': repeat_count,
}
# Encode data and generate signature
data = base64.b64encode(urlencode(params).encode()).decode()
signature = hashlib.md5(
f"{data}{project_password}".encode()
).hexdigest()
return f"https://www.paysera.com/pay/?data={data}&sign={signature}"
# Create monthly subscription
payment_url = create_recurring_payment(
order_id=f'sub_{int(time.time())}',
amount=2999, # 29.99 EUR
email='customer@example.com',
repeat_type='month',
repeat_count=0 # Unlimited
)
# Redirect customer to payment_urlWebhook Handler
from flask import Flask, request
import hashlib
import base64
from urllib.parse import parse_qs
app = Flask(__name__)
@app.route('/subscription/callback', methods=['GET'])
def handle_subscription_callback():
"""Handle recurring payment callback from Paysera"""
project_password = 'your_project_password'
data = request.args.get('data')
signature = request.args.get('ss2')
# Verify signature
expected_signature = hashlib.md5(
f"{data}{project_password}".encode()
).hexdigest()
if signature != expected_signature:
return 'Invalid signature', 400
# Decode and parse data
decoded = base64.b64decode(data).decode()
params = parse_qs(decoded)
# Process payment
if params.get('status')[0] == '1':
order_id = params.get('orderid')[0]
amount = params.get('amount')[0]
repeat_type = params.get('repeat_type')[0]
# Update subscription status in database
update_subscription_status(order_id, 'active')
# Send confirmation email
send_subscription_email(params.get('p_email')[0])
return 'OK', 200
return 'Payment failed', 200Common Use Cases
SaaS & Software
Automate monthly or annual billing for software services, tools, and platforms.
Digital Content
Recurring billing for premium content, news subscriptions, and media streaming.
Education & Training
Monthly payments for course access, online learning platforms, and coaching programs.