added test test_secret_key on the authorization header and pointed API is https://a.khalti.com/api/v2/epayment/initiate
interface
export interface Ikhalti {
return_url: string;
website_url: string;
amount: number;
purchase_order_id: string;
purchase_order_name: string;
customer_info: {
name: string;
email: string;
phone: string;
},
amount_breakdown: {
label: string;
amount: number;
}[];
product_details: {
identity: string;
name: string;
total_price: number;
quantity: number;
unit_price: number;
}[];
}
used dummy from repayment docs body
return_url: 'http://localhost:8100/tabs/home',
website_url: 'http://localhost:8100/tabs/home',
amount: 1300,
purchase_order_id: 'test12',
purchase_order_name: 'test',
customer_info: {
name: 'Ashim Upadhaya',
email: 'example@gmail.com',
phone: '9811496763'
},
amount_breakdown: [
{
label: 'Mark Price',
amount: 1000
},
{
label: 'VAT',
amount: 300
}
],
product_details: [
{
identity: '1234567890',
name: 'Khalti logo',
total_price: 1300,
quantity: 1,
unit_price: 1300
}
]
};
method
payment(): Observable<any> {
const headers = new HttpHeaders();
headers.set('Authorization', '<test_secret_key>');
headers.set('content-type', 'application/json');
headers.set('Access-Control-Allow-Origin', '*');
return this.httpClient.post('https://a.khalti.com/api/v2/epayment/initiate', {body: this.body },
{'headers':headers});
}
added test test_secret_key on the authorization header and pointed API is
https://a.khalti.com/api/v2/epayment/initiateinterface
used dummy from repayment docs body
method