0

The scenario is payment gateway post some payment data to url '/payment-check'. On successful verification, I redirect the user to a particular url and set the header to be accessed by the angular client later.

Now the problem is headers are set in the post method and from angular, I can't make post method because payment gateway is posting data.

I also don't have payment data in the get method(express server) to send to the angular client.

Now how can I get set headers(payment data) in angular?

Or is there any alternative / easier way to achieve it. One of the ways to do is querystring. But as payment_data is sensitive it is not a good idea to expose it in url

Here is my code

express.js file

router.post('/payment-check', function(req,res ) {

    var options = req.body
    console.log(options)
    let secret ='XXXXXXXXX'
    console.log(options.razorpay_order_id + "|" + options.razorpay_payment_id, secret)

    if(// verification code) {
        console.log("matched")

        var payment_id = options.razorpay_payment_id
        res.setHeader('payment_id' ,payment_id)
        res.redirect('http://localhost:8100/menu/items/carts/payment-options/netbanking/order-success')
    }


})

angular service

getPayemnt_id(): Observable<any> {
    return this.http.get<any>(this.url + 'payment-check')
}

.ts page

 this.serivename.getPayemnt_id().subscribe(data =>{
          console.log(data)
        })
pratik jaiswal
  • 1,855
  • 9
  • 27
  • 59
  • Does this answer your question? [Read response headers from API response - Angular 5 + TypeScript](https://stackoverflow.com/questions/48184107/read-response-headers-from-api-response-angular-5-typescript) – canbax Feb 25 '20 at 09:53
  • Sorry but no... – pratik jaiswal Feb 25 '20 at 09:59

0 Answers0