Using the PHP SDK in five minutes

Download UpiPaymentsClient.php from Developers and include it in your project.

require 'UpiPaymentsClient.php';
$upi = new UpiPaymentsClient(getenv('UPI_SECRET_KEY'), 'https://upipayments.demo.pepploweb.com');

$order = $upi->createOrder([
    'amount' => 799,
    'order_id' => 'INV-2045',
    'customer_phone' => '9876543210',
    'redirect_url' => 'https://shop.demo.pepploweb.com/thanks',
]);
header('Location: ' . $order['payment_url']);

Check a payment

$p = $upi->getOrder('INV-2045');
if ($p['status'] === 'success') { /* fulfil */ }

Verify a webhook

$ok = UpiPaymentsClient::verifyWebhook($body, $ts, $sig, $signingSecret);

Errors throw UpiPaymentsException with an errorCode such as daily_count_limit or insufficient_wallet.

0 comments

Leave a comment

Not shown publicly.
Chat with us
Hi! Send us a message and we will reply here as soon as we can.