{"id":536,"date":"2026-10-31T12:00:00","date_gmt":"2026-10-31T12:00:00","guid":{"rendered":"https:\/\/paymentsetu.com\/blog\/?p=536"},"modified":"2026-10-31T12:00:00","modified_gmt":"2026-10-31T12:00:00","slug":"upi-payment-integration-php","status":"publish","type":"post","link":"https:\/\/paymentsetu.com\/blog\/upi-payment-integration-php\/","title":{"rendered":"UPI Payment Integration in PHP: Order, QR and Webhook"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">UPI payment integration in PHP is a practical way to add a QR-based checkout to a custom website while keeping your order state on your own server. This guide shows the complete PaymentSetu flow: create an order, send the customer to its QR page, verify the signed webhook, and mark the order paid only after your server checks the event.<\/p>\n\n\n\n<aside class=\"ap-card\" aria-label=\"PaymentSetu Pro\">\n<span class=\"ap-card__badge\">Recommended<\/span>\n<div class=\"ap-card__body\"><p class=\"ap-card__name\">PaymentSetu Pro<\/p><p class=\"ap-card__best\">Best for growing WooCommerce \/ WHMCS stores and service businesses with up to 1,000 UPI payments a month (most popular)<\/p><ul class=\"ap-card__features\"><li>1,000 credits (1 credit = 1 successful payment verified)<\/li><li>0% commission, direct-to-bank UPI settlement<\/li><li>Dynamic QR, webhooks and API access<\/li><li>WooCommerce and WHMCS plugins<\/li><li>Priority support<\/li><\/ul><\/div>\n<div class=\"ap-card__side\"><p class=\"ap-card__price\">\u20b9999 <small>Most popular \u00b7 \u20b9999 \/ 30 days \u00b7 1,000 verified payments<\/small><\/p><a class=\"ap-card__btn\" href=\"https:\/\/paymentsetu.com\/auth\/register\">Get Pro \u2192<\/a><\/div>\n<\/aside>\n\n\n\n<h2 class=\"wp-block-heading\">What you&#8217;ll build<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The integration has two server-side paths and one customer-facing page:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Your PHP application creates an order with a unique order ID and amount in paisa.<\/li>\n\n\n<li>PaymentSetu returns a <code>payment_url<\/code>; your application redirects the customer to it.<\/li>\n\n\n<li>The customer scans the QR and pays directly to your connected merchant account.<\/li>\n\n\n<li>PaymentSetu sends a signed JSON webhook to your PHP endpoint.<\/li>\n\n\n<li>Your endpoint verifies the signature, checks the order and amount, then marks the order paid once.<\/li>\n\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The QR is displayed on the hosted <code>payment_url<\/code>. You do not need to put your API key into JavaScript or manually create a QR image in the browser. PaymentSetu is a payment verification service, not a payment gateway: the payment goes to your own Paytm Business or PhonePe Business merchant account, while the service matches the payment to the order and notifies your application.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This separation matters. The browser can start the checkout, but only your server should create orders, hold the API key, accept webhooks and change fulfilment state.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What you need before starting<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Prepare these items before writing the PHP endpoint:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>A PHP website with HTTPS and the cURL extension enabled.<\/li>\n\n\n<li>A PaymentSetu account with a connected Paytm Business or PhonePe Business merchant account.<\/li>\n\n\n<li>An API key created in the PaymentSetu dashboard.<\/li>\n\n\n<li>A public HTTPS webhook URL, such as <code>https:\/\/example.com\/paymentsetu\/webhook.php<\/code>.<\/li>\n\n\n<li>An orders table or equivalent application storage with <code>order_id<\/code>, expected amount, payment status and transaction UTR fields.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Create your account from the <a href=\"https:\/\/paymentsetu.com\/auth\/register\">PaymentSetu registration page<\/a>, then review the <a href=\"https:\/\/paymentsetu.com\/developer\/api-documentation\">official API documentation<\/a>. Keep the key in a server environment variable or a secrets manager. Never commit it to Git, place it in a public JavaScript bundle, or print it in an error page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PaymentSetu Pro costs <strong>\u20b9999 per 30 days<\/strong> and includes <strong>1,000 credits<\/strong>. One credit represents one successful payment verified. The plan also includes the API, webhooks, dynamic QR and a unified dashboard; the <a href=\"https:\/\/paymentsetu.com\/#pricing\">pricing page<\/a> shows the current plan details.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Configure the API key and webhook<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: every API request needs authentication, and the webhook must be registered before a payment can update your order automatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Store the key outside the web root. For a simple PHP deployment, an environment variable is enough:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n$apiKey = getenv('PAYMENTSETU_API_KEY');\n\nif (!$apiKey) {\n    throw new RuntimeException('PaymentSetu API key is not configured.');\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In your PaymentSetu dashboard, create an API key and configure the public URL of your webhook. The API base URL is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:\/\/paymentsetu.com\/api<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Every API call uses this header:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Authorization: Bearer YOUR_PAYMENTSETU_API_KEY<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like this: a request from your PHP server reaches the API over HTTPS, while a request made from a browser cannot see the secret key. Open the webhook URL in your browser only to confirm that the route exists; the actual handler should accept POST requests and read the raw request body.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Create an order with PHP<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: the order ID and amount are the link between your checkout, the QR payment and the webhook event.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use a unique ID from your own order record. Convert rupees to integer paisa before sending the request: \u20b9100 is <code>10000<\/code> paisa. The <code>redirect_url<\/code> is where the customer is sent after the hosted payment page; it is not proof that the payment succeeded.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\nfunction paymentSetuRequest(string $method, string $url, string $apiKey, ?array $body = null): array\n{\n    $ch = curl_init($url);\n\n    $headers = [\n        'Accept: application\/json',\n        'Authorization: Bearer ' . $apiKey,\n    ];\n\n    $options = [\n        CURLOPT_RETURNTRANSFER =&gt; true,\n        CURLOPT_CUSTOMREQUEST =&gt; $method,\n        CURLOPT_HTTPHEADER =&gt; $headers,\n        CURLOPT_TIMEOUT =&gt; 20,\n    ];\n\n    if ($body !== null) {\n        $json = json_encode($body, JSON_THROW_ON_ERROR);\n        $options[CURLOPT_POSTFIELDS] = $json;\n        $options[CURLOPT_HTTPHEADER][] = 'Content-Type: application\/json';\n    }\n\n    curl_setopt_array($ch, $options);\n    $responseBody = curl_exec($ch);\n\n    if ($responseBody === false) {\n        throw new RuntimeException('PaymentSetu request failed: ' . curl_error($ch));\n    }\n\n    $httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);\n    curl_close($ch);\n\n    $response = json_decode($responseBody, true);\n\n    if (!is_array($response)) {\n        throw new RuntimeException('PaymentSetu returned invalid JSON.');\n    }\n\n    if ($httpStatus &lt; 200 || $httpStatus &gt;= 300 || ($response['status'] ?? false) !== true) {\n        $message = $response['msg'] ?? 'PaymentSetu returned an error.';\n        throw new RuntimeException($message);\n    }\n\n    return $response;\n}\n\n$apiKey = getenv('PAYMENTSETU_API_KEY');\n$orderId = 'ORDER-' . bin2hex(random_bytes(8)); \/\/ Replace with your stored order ID.\n$amountInPaisa = 10000; \/\/ \u20b9100.00\n\n\/\/ Save the order as pending in your database before sending the request.\n$result = paymentSetuRequest(\n    'POST',\n    'https:\/\/paymentsetu.com\/api\/create_order',\n    $apiKey,\n    [\n        'order_id' =&gt; $orderId,\n        'amount' =&gt; $amountInPaisa,\n        'redirect_url' =&gt; 'https:\/\/example.com\/payment-return',\n        'customer_name' =&gt; 'Asha Sharma',\n        'customer_email' =&gt; 'asha@example.com',\n        'customer_mobile' =&gt; '9876543210',\n        'remarks' =&gt; 'Order ' . $orderId,\n    ]\n);\n\nheader('Location: ' . $result['payment_url'], true, 303);\nexit;<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/www.php.net\/manual\/en\/curl.examples-basic.php\" target=\"_blank\" rel=\"noopener\">PHP cURL documentation<\/a> shows the same core pattern: initialise cURL, send JSON with <code>CURLOPT_POSTFIELDS<\/code>, set the JSON content type, return the response and handle transport errors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like a JSON response with <code>status: true<\/code> and a <code>payment_url<\/code>. Save the order ID and expected amount before the redirect. If the response is an error, show a generic checkout message to the customer and log the server-side response without exposing the API key.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Important order rules:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li>Use a unique <code>order_id<\/code> for each payment intent.<\/li>\n\n\n<li>Send <code>amount<\/code> as an integer number of paisa, not a formatted string such as <code>\u20b9100<\/code>.<\/li>\n\n\n<li>Creating a payment link uses one credit.<\/li>\n\n\n<li>If an order is already paid, do not create another payment link for it.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Show the QR checkout to the customer<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: the hosted payment URL gives the customer a QR checkout without exposing your API credentials or requiring a client-side API call.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>Location<\/code> header in the previous step sends the customer to the returned <code>payment_url<\/code>. If your checkout uses JavaScript, keep the URL in a server-generated response and redirect the browser only after your PHP server has created the order. Do not call <code>create_order<\/code> directly from a public script with the bearer key.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Your checkout can send a normal POST request to a server-side <code>create-order.php<\/code> route:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>POST \/create-order.php\ncart_token=YOUR_INTERNAL_CART_TOKEN<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Your application should look up the cart on the server, calculate the amount from trusted product data, create the order, and then redirect to <code>payment_url<\/code>. Do not accept the payable amount only from a hidden input; a hidden field is visible to the customer and can be changed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Success looks like the customer reaching the PaymentSetu payment page and seeing the QR for that order. The return page is useful for showing \u201cWe are checking your payment\u201d, but it must not fulfil the order by itself. The signed webhook is the server-to-server confirmation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Verify the signed webhook in PHP<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: a browser redirect or a screenshot is not a trusted payment confirmation; the webhook signature proves that the event was created with your API key and has not been changed in transit.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">PaymentSetu sends these headers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><code>X-PaymentSetu-Timestamp<\/code>: the Unix timestamp for the event.<\/li>\n\n\n<li><code>X-PaymentSetu-Signature<\/code>: the hexadecimal HMAC-SHA256 signature.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The signed message is the timestamp, a dot, and the exact raw JSON body. Read <code>php:\/\/input<\/code> before decoding JSON, because re-encoding the decoded array can change whitespace or key ordering and produce a different signature.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\nfunction verifyPaymentSetuWebhook(\n    string $signature,\n    string $timestamp,\n    string $rawPayload,\n    string $apiKey\n): bool {\n    if ($timestamp === '' || !ctype_digit($timestamp)) {\n        return false;\n    }\n\n    \/\/ Reject old events; the API documentation uses a five-minute window.\n    if (abs(time() - (int) $timestamp) &gt; 300) {\n        return false;\n    }\n\n    $expected = hash_hmac(\n        'sha256',\n        $timestamp . '.' . $rawPayload,\n        $apiKey\n    );\n\n    return $signature !== '' &amp;&amp; hash_equals($expected, $signature);\n}\n\n$apiKey = getenv('PAYMENTSETU_API_KEY');\n$signature = $_SERVER['HTTP_X_PAYMENTSETU_SIGNATURE'] ?? '';\n$timestamp = $_SERVER['HTTP_X_PAYMENTSETU_TIMESTAMP'] ?? '';\n$rawPayload = file_get_contents('php:\/\/input');\n\nif (!is_string($rawPayload) || !verifyPaymentSetuWebhook($signature, $timestamp, $rawPayload, $apiKey)) {\n    http_response_code(401);\n    echo json_encode(['status' =&gt; false, 'error' =&gt; 'Invalid signature']);\n    exit;\n}\n\n$data = json_decode($rawPayload, true);\n\nif (!is_array($data)) {\n    http_response_code(400);\n    echo json_encode(['status' =&gt; false, 'error' =&gt; 'Invalid JSON']);\n    exit;\n}\n\n$orderId = (string) ($data['order_id'] ?? '');\n$receivedAmount = (int) ($data['amount'] ?? 0);\n$status = (string) ($data['status'] ?? '');\n$utr = (string) ($data['txn_utr'] ?? '');\n\n\/\/ Load the pending order by $orderId from your database here.\n\/\/ Compare its expected amount with $receivedAmount before fulfilment.\n\/\/ Store $utr and make the update idempotent so duplicate events are harmless.\n\nif ($status === 'success' &amp;&amp; $orderId !== '' &amp;&amp; $utr !== '') {\n    \/\/ markOrderPaidOnce($orderId, $receivedAmount, $utr);\n}\n\nhttp_response_code(200);\necho json_encode(['status' =&gt; true]);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The PHP <a href=\"https:\/\/www.php.net\/manual\/en\/function.hash-hmac.php\" target=\"_blank\" rel=\"noopener\"><code>hash_hmac<\/code><\/a> function generates the keyed digest, and <code>hash_equals<\/code> performs a timing-safe comparison. The webhook payload includes the order ID, amount, status and transaction UTR. Use those values to find the pending order, compare the amount in paisa, and record the UTR before releasing a product, service or download.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Make <code>markOrderPaidOnce<\/code> idempotent. A safe database operation should update an order only when its current state is <code>pending<\/code>, and should keep a unique record for the UTR or webhook event. If the same webhook arrives again, return HTTP 200 without sending the fulfilment a second time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Check payment status from the server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: status checks give your return page or a scheduled reconciliation task a second server-side view of an order; they are not a replacement for webhook verification.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The integration brief exposes this endpoint:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GET \/api\/order_status\/{client_txn_id}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Call it from PHP with the same bearer header. URL-encode the transaction identifier and never put the API key in the browser:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n$clientTxnId = 'ORDER-abc123'; \/\/ Use the identifier stored for this payment.\n$url = 'https:\/\/paymentsetu.com\/api\/order_status\/' . rawurlencode($clientTxnId);\n\n$ch = curl_init($url);\ncurl_setopt_array($ch, [\n    CURLOPT_RETURNTRANSFER =&gt; true,\n    CURLOPT_HTTPGET =&gt; true,\n    CURLOPT_HTTPHEADER =&gt; [\n        'Accept: application\/json',\n        'Authorization: Bearer ' . getenv('PAYMENTSETU_API_KEY'),\n    ],\n    CURLOPT_TIMEOUT =&gt; 20,\n]);\n\n$responseBody = curl_exec($ch);\n\nif ($responseBody === false) {\n    throw new RuntimeException(curl_error($ch));\n}\n\n$httpStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);\ncurl_close($ch);\n\n$statusResponse = json_decode($responseBody, true);\n\nif ($httpStatus &gt;= 200 &amp;&amp; $httpStatus &lt; 300 &amp;&amp; is_array($statusResponse)) {\n    \/\/ Inspect the documented response for this order and reconcile locally.\n    error_log(json_encode($statusResponse));\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use the webhook as the normal event path. A status check is useful when the customer returns before the webhook handler finishes or when you are reconciling pending records. Your application should still validate that the returned identifier and amount belong to the local order before changing state.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 6: Monitor credits with PHP<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Why: each payment link creation consumes one credit, so a small server-side check helps you see whether the account can create more links.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The credits endpoint needs no request body:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n\n$ch = curl_init('https:\/\/paymentsetu.com\/api\/check_credits');\ncurl_setopt_array($ch, [\n    CURLOPT_RETURNTRANSFER =&gt; true,\n    CURLOPT_HTTPGET =&gt; true,\n    CURLOPT_HTTPHEADER =&gt; [\n        'Accept: application\/json',\n        'Authorization: Bearer ' . getenv('PAYMENTSETU_API_KEY'),\n    ],\n    CURLOPT_TIMEOUT =&gt; 20,\n]);\n\n$responseBody = curl_exec($ch);\n\nif ($responseBody === false) {\n    throw new RuntimeException(curl_error($ch));\n}\n\ncurl_close($ch);\n\n$result = json_decode($responseBody, true);\n$remaining = $result['credits']['remaining_credits'] ?? null;\n\nif (($result['status'] ?? false) === true &amp;&amp; is_int($remaining)) {\n    echo 'Remaining credits: ' . $remaining;\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The response contains remaining, total and used credits, along with subscription status and expiry information. Display the count in an admin-only page or log it for operations; do not expose the API key or private account details to customers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify the complete PHP flow<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run through one low-value test order before connecting fulfilment:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n\n<li>Submit your checkout form and confirm that your server stores a pending order.<\/li>\n\n\n<li>Confirm that <code>create_order<\/code> returns <code>status: true<\/code> and a <code>payment_url<\/code>.<\/li>\n\n\n<li>Scan the QR and complete the UPI payment from the customer side.<\/li>\n\n\n<li>Check your webhook logs for the raw body, timestamp and signature headers. Do not log the API key.<\/li>\n\n\n<li>Confirm that the signature passes before JSON business logic runs.<\/li>\n\n\n<li>Confirm that the local order ID and paisa amount match the webhook.<\/li>\n\n\n<li>Confirm that the order becomes paid once and stores the UTR.<\/li>\n\n\n<li>Replay the same event in a safe test environment and verify that it does not fulfil twice.<\/li>\n\n\n<li>Use the status endpoint to reconcile the order, then check the credits endpoint from an admin-only command or page.<\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Troubleshooting common PHP integration errors<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><code>curl_exec<\/code> returns false<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Check that the PHP cURL extension is enabled, the server can make outbound HTTPS requests, and the host has a valid CA certificate bundle. Log <code>curl_error($ch)<\/code> on the server, but show the customer a short retry message rather than the internal error.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The API rejects the amount<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Send an integer in paisa. For example, \u20b9249 becomes <code>24900<\/code>; do not send <code>249<\/code>, <code>\"\u20b9249\"<\/code>, or a value with a comma. Calculate the amount from trusted server-side order data.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The webhook says \u201cInvalid signature\u201d<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Verify that you are using the exact raw body, the same API key, the timestamp string from the header, and the message format <code>timestamp.payload<\/code>. Do not run <code>json_encode<\/code> on the decoded payload before hashing. Also check that your server clock is accurate and that your web server passes the <code>X-PaymentSetu-*<\/code> headers to PHP.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">The customer returns but the order is still pending<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The return URL is only a navigation step. Check the webhook handler logs, confirm that the endpoint is public over HTTPS, and use the server-side status endpoint for reconciliation. Keep the order pending until a verified event or trusted status response matches the local order.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">A webhook fulfils the same order twice<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Add a database guard around the paid transition and store the transaction UTR with a unique constraint. Process only a pending order; if it is already paid, acknowledge the event and stop before sending another email, download or service activation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Can I integrate UPI payments in a plain PHP website?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Yes. A plain PHP site can use cURL to create an order, redirect to the returned payment URL and receive the webhook on a PHP route. You do not need WordPress, WooCommerce or a framework for the API flow.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is PaymentSetu a payment gateway for PHP?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. PaymentSetu is a payment verification service. The customer pays directly into your connected Paytm Business or PhonePe Business merchant account, and PaymentSetu matches the transaction and sends your server a webhook.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Should I trust the payment return URL or a screenshot?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">No. Treat both as customer-facing signals only. Verify the HMAC-signed webhook, match the order ID and amount, and make the database update idempotent before fulfilling the order.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What amount format does the PHP API use?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>amount<\/code> field is an integer in paisa, so 100 paisa equals \u20b91 and 10000 paisa equals \u20b9100. Convert and validate the amount on your server before calling <code>POST \/api\/create_order<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How many credits does a PHP order use?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Each payment link creation consumes one credit. You can call <code>GET \/api\/check_credits<\/code> with your bearer API key to read the remaining, total and used credit counts.<\/p>\n\n\n\n<aside class=\"ap-cta\" aria-label=\"Add UPI to PHP\"><div class=\"ap-cta__content\"><p class=\"ap-cta__eyebrow\">Start integrating<\/p><p class=\"ap-cta__title\">Add UPI to PHP<\/p><p class=\"ap-cta__text\">Create orders, show a hosted QR and verify signed webhooks with PaymentSetu.<\/p><\/div><a class=\"ap-cta__btn\" href=\"https:\/\/paymentsetu.com\/auth\/register\">Create your account<\/a><\/aside>\n\n\n\n<p class=\"wp-block-paragraph\">DONE upi-payment-integration-php words=1915<\/p>\n\n\n\n<script type=\"application\/ld+json\">{\"@context\": \"https:\/\/schema.org\", \"@type\": \"FAQPage\", \"mainEntity\": [{\"@type\": \"Question\", \"name\": \"Can I integrate UPI payments in a plain PHP website?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Yes. A plain PHP site can use cURL to create an order, redirect to the returned payment URL and receive the webhook on a PHP route. You do not need WordPress, WooCommerce or a framework for the API flow.\"}}, {\"@type\": \"Question\", \"name\": \"Is PaymentSetu a payment gateway for PHP?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. PaymentSetu is a payment verification service. The customer pays directly into your connected Paytm Business or PhonePe Business merchant account, and PaymentSetu matches the transaction and sends your server a webhook.\"}}, {\"@type\": \"Question\", \"name\": \"Should I trust the payment return URL or a screenshot?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"No. Treat both as customer-facing signals only. Verify the HMAC-signed webhook, match the order ID and amount, and make the database update idempotent before fulfilling the order.\"}}, {\"@type\": \"Question\", \"name\": \"What amount format does the PHP API use?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"The amount field is an integer in paisa, so 100 paisa equals \u20b91 and 10000 paisa equals \u20b9100. Convert and validate the amount on your server before calling POST \/api\/create_order.\"}}, {\"@type\": \"Question\", \"name\": \"How many credits does a PHP order use?\", \"acceptedAnswer\": {\"@type\": \"Answer\", \"text\": \"Each payment link creation consumes one credit. You can call GET \/api\/check_credits with your bearer API key to read the remaining, total and used credit counts. DONE upi-payment-integration-php words=1915\"}}]}<\/script>\n\n","protected":false},"excerpt":{"rendered":"Learn upi payment integration in php with a complete PaymentSetu flow for API orders, hosted QR checkout, signed webhooks, status checks and credits.","protected":false},"author":1,"featured_media":535,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[29],"tags":[110,69,109,30,28],"class_list":["post-536","post","type-post","status-publish","format-standard","has-post-thumbnail","category-upi-payment-verification","tag-api-integration","tag-payment-verification-2","tag-php","tag-upi","tag-webhooks","cs-entry"],"_links":{"self":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/comments?post=536"}],"version-history":[{"count":1,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/536\/revisions"}],"predecessor-version":[{"id":729,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/posts\/536\/revisions\/729"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/media\/535"}],"wp:attachment":[{"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/media?parent=536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/categories?post=536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/paymentsetu.com\/blog\/wp-json\/wp\/v2\/tags?post=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}