I am integrating PayPal in react native mobile application i am getting error for android emulatore, kindly help me, Kindly find request body, header and api request let currency = '100 USD'; currency.replace(' USD', ''); const dataDetail = { intent: 'sale', payer: { payment_method: 'paypal', }, transactions: [ { amount: { total: 55, currency: 'THB', details: { subtotal: 55, tax: '0', shipping: '0', handling_fee: '0', shipping_discount: '0', insurance: '0', }, }, }, ], redirect_urls: { return_url: 'https://example.com', cancel_url: 'https://example.com', }, }; -------------------------------------------------------- const config2 = { headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${this.state.accessToken}`, }, }; ------------------------------------------- axios .post( 'https://api.sandbox.paypal.com/v1/payments/payment', JSON.stringify(dataDetail), config2, ) .then(response => { console.log('Response payment', response); const {id, links} = response.data; const approvalUrl = links.find(data => data.rel == 'approval_url'); this.setState({ paymentId: id, approvalUrl: approvalUrl.href, }); }) .catch(err => { console.log('payment error', {...err}); console.log('payment error :', err); });
... View more