Skip to content

Commit

Permalink
feat: added Authtoken in authorisation headers (#248)
Browse files Browse the repository at this point in the history
* fix: added req headers

* fix: footer links

* fix: pay button

* fix: pay button

* fix: request params

* feat: added auth in headers
  • Loading branch information
Srish-ty authored Nov 6, 2024
1 parent 4346ffb commit f7a1c38
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pages/api/phonepePayment.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import crypto from 'crypto';
import generateToken from '@/utils/generateToken';

export default async function handler(req, res) {
if (req.method === 'POST') {
Expand Down Expand Up @@ -28,11 +29,13 @@ export default async function handler(req, res) {
const raw = JSON.stringify({
request: base64Payload,
});
const authToken = generateToken();

try {
const response = await fetch(`${process.env.NEXT_PUBLIC_PHONEPE_API_URL}/pg/v1/pay`, {
method: 'POST',
headers: {
Authorization: `Bearer ${authToken}`,
'Content-Type': 'application/json',
'X-VERIFY': xVerify,
},
Expand Down

0 comments on commit f7a1c38

Please sign in to comment.