Payments to this merchant are not allowed (invalid clientId) - Ionic iOS - ionic-framework

Im using the paypal plugin for ionic and is not working on iOS
I already have running this plugin on android and it is working perfect, and also have the clientid generated on https://developer.paypal.com/developer/applications/
doPayment() {
const total: any = 10;
const currency: any = 'USD';
const envProduct: any = '';
const envSandbox: any = '{Client ID from developer.paypal.com/developer/applications/}';
this.payPal.init({
PayPalEnvironmentProduction: envProduct,
PayPalEnvironmentSandbox: envSandbox
})
.then(() => {
// Environments: PayPalEnvironmentNoNetwork, PayPalEnvironmentSandbox, PayPalEnvironmentProduction
this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
// Only needed if you get an "Internal Service Error" after PayPal login!
// payPalShippingAddressOption: 2 // PayPalShippingAddressOptionPayPal
})).then(() => {
const payment = new PayPalPayment(total, currency, 'Description', 'sale');
this.payPal.renderSinglePaymentUI(payment).then(async ( res ) => {
// rest of the code after payment
}, ( errclose ) => {
console.log( errclose ); // Error or render dialog closed without being successful
});
}, ( errconf ) => {
console.log( errconf ); // Error in configuration
});
}, ( errinit ) => {
console.log( errinit ); // Error in initialization, maybe PayPal isn't supported or something else
});
}
Here is the Error:
Payments to this merchant are not allowed (invalid clientId)
Any help is appreciated. Thank you very much.

I get the same error, also on iOS only, when used Ionic Capacitor for runtime instead of Cordova. When I built the app using Cordova runtime it worked correctly on both platforms. Also, you could get the same error when specifying the 'PayPalEnvironmentSandbox' environment name but use production clientId and vice versa.

Related

How do I get carrier name and cell tower ID in Android 11 and above using IONIC?

We have developed app to show mobile internet speed using IONIC framework. We want to display the carrier name and cell tower ID. Everything is working fine till Android 10 but starting Android 11 onwards the data is not displayed. Any help to resolve this will be great.
our code looks as follows
hasReadPermission() {
this.sim.hasReadPermission().then(
(result) => {
console.log('hasReadPermission: ', result);
this.sim.getSimInfo().then(
(info) => {
this.simInfo = info.carrierName;
console.log(this.simInfo);
},
(err) => console.log('getSimInfo error: ', err);
);
},
(err) => {
console.log('Dont have permission: ', err)
this.requestReadPermission();
};
);
}
we not able to figure out where we went wrong

Firebase auth web SDK not working on Ionic iOS?

My issue is the login with the email and password function works fine on android but on iOS, the promise is never returned ( nor failed ) when correct credentials are provided but it fails if I provide incorrect credentials. The login works on iOS with live reload simulating on an iOS device, but when installed with test-flight or via xCode promise is never returned nor rejected.
How can I debug it further or know what the underlying issue is?
onSubmit: async (values) => {
try {
const auth = getAuth(firebaseApp);
auth.setPersistence(browserSessionPersistence);
// Never called on IOS
auth.onAuthStateChanged(() => {
console.log('I am here', auth.currentUser);
if (auth.currentUser) {
updateIsAuthenticated(true);
}
});
const userCred = await signInWithEmailAndPassword(auth, values.email, values.password);
//Never runs
console.log('After Success', userCred);
} catch (error) {
// Runs when provided with false credentials
setError('Error: Authentication failed');
console.error('An error Occurred');
} finally {
console.log('Running Finally');
}
},
});

How to use Pushwoosh in Ionic 5 project with capacitor

Hi everyone I am migrating an app from ionic 1 to ionic 5 and I need to integrate the pushwoosh notification service, my project was started not using cordova, instead I use capacitor and I can't find information about how to integrate this service to an ionic 5 application.
Please, we already know that you can use cordova but when using the cordova plugin add pushwoosh-cordova-plugin#8.0.0 it gives you the following message:
Current working directory is not a Cordova-based project.
because as I said before it is a capacitor project not a cordovan project, Btw I already use ionic integrations enable cordova
So... if anyone can help us, It would be very helpful.
OK guys after many hours trying to integrate Pushwoosh into an ionic 5 application for me it was impossible,
If you set everything up correctly, the following will happen:
Your app will connect to Pushwoosh correctly
Your app will correctly register your device in pushwoosh
But your app will not listen to the listeners offered by the official Pushwoosh documentation
document.addEventListener('push-receive',
function (event) {
var message = (<any>event).notification.message;
var userData = (<any>event).notification.userdata;
alert("Push message received: " + message);
console.info(JSON.stringify((<any>event).notification));
//dump custom data to the console if it exists
if (typeof (userData) != "undefined") {
console.warn('user data: ' + JSON.stringify(userData));
}
}
);
This does not work in an ionic 5 app 👆🏽
This does work:
import { Component, OnInit } from '#angular/core';
import {
Plugins,
PushNotification,
PushNotificationToken,
PushNotificationActionPerformed,
} from '#capacitor/core';
const { PushNotifications } = Plugins;
#Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage implements OnInit {
ngOnInit() {
console.log('Initializing HomePage');
// Request permission to use push notifications
// iOS will prompt user and return if they granted permission or not
// Android will just grant without prompting
PushNotifications.requestPermission().then(result => {
if (result.granted) {
// Register with Apple / Google to receive push via APNS/FCM
PushNotifications.register();
} else {
// Show some error
}
});
PushNotifications.addListener(
'registration',
(token: PushNotificationToken) => {
alert('Push registration success, token: ' + token.value);
},
);
PushNotifications.addListener('registrationError', (error: any) => {
alert('Error on registration: ' + JSON.stringify(error));
});
PushNotifications.addListener(
'pushNotificationReceived',
(notification: PushNotification) => {
alert('Push received: ' + JSON.stringify(notification));
},
);
PushNotifications.addListener(
'pushNotificationActionPerformed',
(notification: PushNotificationActionPerformed) => {
alert('Push action performed: ' + JSON.stringify(notification));
},
);
}
}
I tried to combine Pushwoosh with the capacitor but the tokens of the devices that are generated are different so I still didn't get my notifications.
At the end of the day and after many hours and days of work I have no other option than to use firebase and now everything is going much better.

403 on Google Action push notification request

I'm trying to perform a push notification for Google Actions Intent.
Thus far, I've followed the instructions here: https://developers.google.com/actions/assistant/updates/notifications#send_notifications
This is my resulting code:
const {google} = require('googleapis');
var request = require('request');
const key = require('./bot.json');
module.exports = async function (context, myQueueItem) {
context.log('JavaScript queue trigger function processed work item', myQueueItem);
let jwtClient = new google.auth.JWT(
key.client_email, null, key.private_key,
['https://www.googleapis.com/auth/actions.fulfillment.conversation'],
null
);
jwtClient.authorize((err, tokens) => {
// code to retrieve target userId and intent
let notif = {
userNotification: {
title: [message],
},
target: {
userId:[obtained from permission request],
intent: [name of intent],
// Expects a IETF BCP-47 language code (i.e. en-US)
locale: 'en-US'
},
};
request.post('https://actions.googleapis.com/v2/conversations:send', {
'auth': {
'bearer': tokens.access_token,
},
'json': true,
'body': {'customPushMessage': notif},
}, (err, httpResponse, body) => {
console.log(body);
console.log(httpResponse.statusCode + ': ' + httpResponse.statusMessage);
});
});
};
//module.exports(console, "Test");
This results in a 403 from the notification service. Is this because of the user id, intent name or jwtoken that was generated?
Following are the steps we need to check before sending the push notification
Check your Google permission settings
In order to test the Action, you need to enable the necessary permissions.
Go to the ‘Activity Controls' page (https://myaccount.google.com/activitycontrols).
Sign in with your Google account, if you have not already done so.
Ensure that the following permissions are enabled:
a.Web & App Activity
b.Device Information
c.Voice & Audio Activity
2.Target intent name should be added into the Implicit invocation field.
with enabled push notification.
3.use the same email id in your google assistant which you had used for login in GCP.

ionic3 native paypal init error

I am doing an integration between my ionic3 app and Paypal, I am following the doc from official ionic native paypal plugin website. But when I press the button to trigger the paypal, it refresh to the root page of the app.
Here is my code:
gotoPaypal(){
this.pppayment = new PayPalPayment('3.33', 'USD', 'Description', 'sale');
this.payPal.init({
PayPalEnvironmentProduction: 'dgdfghfjfhgjghjadsasfdsdfsghkgjkjhk',
PayPalEnvironmentSandbox: 'hasvahgsdvajbdhgvcasdh sahgdvasdvagksd'
}).then(() => {
this.payPal.prepareToRender('PayPalEnvironmentSandbox', new PayPalConfiguration({
})).then(() => {
this.payPal.renderSinglePaymentUI(this.pppayment).then(() => {
}, () => {
console.log("Paypal 3333");
});
}, () => {
console.log("Paypal 2222");
});
}, () => {
console.log("Paypal 1111");
});
}
And before it's auto refresh, I see console printed "Paypal 1111", so I think init Paypal have error, Anyone know what happen or how to fix?