PRINTPAY
Profile
Printpay Gateway Developer Integration Documentation

Developer API Documentation

Welcome to the Printpay multi-tenant payment gateway. Integrate instantaneous secure M-Pesa STK push checkout procedures, automated backend status querying, and fast processing listeners.

Gateway Endpoint URL: https://printpay.site/api/

1. Authentication Security Parameters

Every API transaction executing against production hooks routes through server validating schemas using your personal gateway profile signature. Send this signature in your transaction execution payloads:

Requirement Field Data Variable Typology Payload Location
x_api_key String HTTP Body Data Parameter

2. Initialize Payment Prompt (`stk_push`)

Triggers an automated transaction interface directly on your user's smartphone handset screen matching standard merchant billing routines.

POST https://printpay.site/api/stk_push

Required Field Protocol

Parameter Type Mandate Description Map
x_api_key String REQUIRED Your private live production gateway authorization hash.
phone_number String REQUIRED Safaricom subscriber identity. Supports formats: 07XXXXXXXX, 01XXXXXXXX, or 254XXXXXXXX.
amount Integer REQUIRED Total KES numeric capacity volume values to collect. Minimum: 1.

Source Code

  • PHP
  • Node.js
  • Python
  • cURL
<?php
$gatewayUrl = "https://printpay.site/api/stk_push";

$payload = [
    'x_api_key'    => 'YOUR_MERCHANT_X_API_KEY',
    'phone_number' => '0712345678',
    'amount'       => 10
];

$ch = curl_init($gatewayUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($payload));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
curl_close($ch);

echo $result;
?>

Response Return

{
  "status": "success",
  "checkout_id": "ws_CO_070720261234567890"
}

3. Transaction Verification Polling (`check_status`)

Allows external script nodes to dynamically audit structural data parameters on demands via native handshake transaction reference channels.

GET https://printpay.site/api/stk_push?check_status={CHECKOUT_ID}

Status Request Execution Syntaxes

  • PHP
  • Node.js
  • Python
  • cURL
<?php
$checkoutID = "ws_CO_070720261234567890";
$queryUrl = "https://printpay.site/api/stk_push?check_status=" . $checkoutID;

$response = file_get_contents($queryUrl);
echo $response;
?>

Success Completed Payment

{
  "id": "241",
  "status": "SUCCESS",
  "phone_number": "254712345678",
  "amount": "10.00",
  "mpesa_receipt_number": "TGR7XYZ890"
}

Pending Status Check

{
  "id": "241",
  "status": "PENDING",
  "phone_number": "254712345678",
  "amount": "10.00",
  "mpesa_receipt_number": null
}

4. Instant Callback Notifications (`Webhooks`)

Provide a dynamic URL listener target path within your dashboard configuration pane. The transaction engine will execute an external automated inbound JSON POST payload the moment confirmation values resolve from Safaricom API endpoints.

GET https://printpay.site/api/callback

Inbound Received JSON Post Blueprint

{
  "checkout_id": "ws_CO_070720261234567890",
  "status": "SUCCESS",
  "mpesa_receipt": "TGR7XYZ890",
  "amount": 10.00,
  "phone": "254712345678",
  "result_code": 0
}

5. Standard Result Code

Response Result Code Status Map Mapping Core Operational System Context Reason
0 SUCCESS Checkout confirmed, credentials validated, and settlement completed successfully.
1032 FAILED The mobile handset interface overlay validation request was explicitly cancelled by the subscriber.
1037 FAILED The pipeline timed out due to systemic connectivity degradation on the end-user's SIM stack.
2001 FAILED Credential rejection failure. The customer inputted an invalid security access profile PIN code.