我共享了一个Anguler + NativeScript代码项目,我想使用PayStack API进行付款,但是当我尝试对此URL进行请求时ttps://api.paystack.co/transaction/initialize什么也没发生。
下面是我的代码,有人可以帮我吗?
import { HttpClient,HttpErrorResponse, HttpHeaders } from '@angular/common/http';
let postObject=
{
'email':'000@gmail.com',
'amount': 5000,
'subaccount':'ACCT_....',
'reference':'9979962247',
};
const headers = new HttpHeaders();
headers.set('Content-Type', 'application/json; charset=utf-8');
headers.set('Authorization','Bearer sk_test_...');
this.http.post('https://api.paystack.co/transaction/initialize', JSON.stringify(postObject), {headers: headers}).subscribe(
(data:any) => {
console.log(data);
},
(err: HttpErrorResponse) => {
if (err.error instanceof Error) {
console.log('Client-side error occured.');
} else {
console.log('Server-side error occured.');
}
}
);