Skip to content

Commit 6dfd30a

Browse files
committed
feat: added ngrok information for notify url
1 parent 882d26e commit 6dfd30a

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

src/components/PayHereTester.tsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ export default function PayHereTester() {
156156
custom1: '',
157157
custom2: '',
158158
sandbox: true,
159-
returnUrl: 'http://localhost:5173/return',
160-
cancelUrl: 'http://localhost:5173/cancel',
161-
notifyUrl: 'http://localhost:5173/notify'
159+
returnUrl: 'https://klass-lk.github.io/payhere-sanbox-client/return',
160+
cancelUrl: 'https://klass-lk.github.io/payhere-sanbox-client/cancel',
161+
notifyUrl: 'https://klass-lk.github.io/payhere-sanbox-client/notify'
162162
});
163163
setErrors({});
164164
setLogs([]);
@@ -229,7 +229,7 @@ export default function PayHereTester() {
229229
</div>
230230

231231
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
232-
<div className="bg-white rounded-xl shadow-lg p-6 overflow-y-auto" style={{ maxHeight: 'calc(100vh - 200px)' }}>
232+
<div className="bg-white rounded-xl shadow-lg p-6 overflow-y-auto" style={{ maxHeight: 'calc(100vh + 200px)' }}>
233233
<div className="flex items-center justify-between mb-6">
234234
<h2 className="text-2xl font-semibold text-slate-800">Configuration Form</h2>
235235
<button
@@ -672,10 +672,23 @@ export default function PayHereTester() {
672672

673673
<div className="space-y-2 text-sm text-slate-700">
674674
<p>1. Go to <a href="https://sandbox.payhere.lk" target="_blank" rel="noopener noreferrer" className="text-blue-600 hover:underline">sandbox.payhere.lk</a> and create an account.</p>
675-
<p>2. In the "Integrations" tab, create a new app. Use "localhost" for the domain.</p>
675+
<p>2. In the "Integrations" tab, create a new app. Use "github.io" for the domain when testing using this tool.</p>
676676
<p>3. Copy the "Merchant ID" and the app's "Merchant Secret" into the form on the left.</p>
677677
</div>
678678

679+
<div className="mt-6">
680+
<h4 className="font-semibold text-slate-700 mb-2">Testing Notify URL with a Backend Server</h4>
681+
<div className="space-y-2 text-sm text-slate-700">
682+
<p>The <code>notify_url</code> is used by PayHere to send a server-to-server notification to your backend to confirm the payment status. This frontend tester does not include a backend service.</p>
683+
<p>To test this, you will need a separate backend application running that can receive these notifications. You can use <a href="https://ngrok.com/" target="_blank" rel="noopener noreferrer" className="text-blue-600 hover:underline">ngrok</a> to expose your local backend server to the internet.</p>
684+
<p>1. Run your backend application on a specific port (e.g., port 8080).</p>
685+
<p>2. In a new terminal, run ngrok to expose that port: <code className="bg-slate-100 text-slate-800 px-2 py-1 rounded-md font-mono">ngrok http 8080</code> (replace 8080 with your backend's port).</p>
686+
<p>3. Copy the "Forwarding" URL provided by ngrok.</p>
687+
<p>4. Paste this URL into the "Notify URL" field in the form on the left.</p>
688+
<p>When a payment is completed, PayHere will send a POST request with the payment status to your backend server via this ngrok URL.</p>
689+
</div>
690+
</div>
691+
679692
<div className="mt-6">
680693
<h4 className="font-semibold text-slate-700 mb-2">Test Cards for Successful Payments</h4>
681694
<p className="text-xs text-slate-500 mb-3">For ‘Name on Card’, ‘CVV’ & ‘Expiry date’ you can enter any valid data.</p>

0 commit comments

Comments
 (0)