2017-11-19 3 views
0

Ich hatte eine http.post() mit den Daten für die Zahlung gataway gemacht, aber die Antwort ist die Vorlage der Zahlungsseite.Ich habe sie in Absprache und sagte mir, die Daten zu senden a formdata .wie kann ich das als form daten senden?So senden Sie als Formular Daten Winkel

payment.ts

var paymentdata={ 
    'api_key':'6953gbfa-939a-4bd8-927c-fdsdd6e0fa72f', 
    'order_id':'11111111111124', 
    'mode':'TEST', 
    'amount':200, 
    'currency':'INR', 
    'description':'BLABLA', 
    'name':'Ajith', 
    'email':'[email protected]', 
    'phone':'8086502009', 
    'city':'tvm', 
    'country':'IND', 
    'zip_code':'695505', 
    'return_url':'http://localhost:8100/#/payment/paymentrequest', 
    'hash':'8A9DBABCF0CBB9618F74DEA95982DD5D710347B643F45A1E1DFF 
    A42941EACB77C9F8D5C79F7D2EF8fdfDDFCD944E7EDE36F5D2FF8FBC5D0 
    822A2C79CBDCE73DE05' 
    } 
    console.log(paymentdata) 
    return 
this.http.post('https://biz.traknpay.in/v2/paymentrequest',paymentdata). 
map(res=>res).subscribe(res=> 
{ 
    this.body=res.text(); 
    console.log(this.body) 
    }, 
err=>{ 
console.log(err) 
}) 

Antwort

0

let paymentData = new FormData(); 
 

 
paymentData.append('api_key', '6953gbfa-939a-4bd8-927c-fdsdd6e0fa72f'); 
 
paymentData.append('order_id', '11111111111124); 
 
. 
 
. 
 
. 
 
//add all the data the same way 
 

 
return http.post('url', paymentData,...);

technisch, verwenden nur eine Formdata-Objekt anstelle des Arrays.

Verwandte Themen