You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My mobile app is developed with hybrid technologies (javascript). Can I use this one in my mobile app?
I tried it but I'm getting errors after the payment.
hi @ckristhoff can you please share your way. im using in reactjs and all scripts are loaded successfully but issue is response handling. how can we handle callback/return data.
Hi @Cyberfolks ,
were you able to handle the responses in React? Please let me know how you did it if you were able to. I'm stuck in the same situation.
Thanks!
Perhaps my solution in Angular can provide some insight.
1) Load an external script as shown below:
/* eslint-disable @typescript-eslint/no-unused-vars */
let ATHM_Checkout;
let pmtMethodResponse;
let pmtMethodStatus;
function setATHMCheckout(checkout) {
ATHM_Checkout = checkout;
}
2) Declare the setATHMCheckout function in your solution in order to have
access to it.
In Angular this is down as follows:
declare const setATHMCheckout: any;
3) In your solution, use a method to build the ATHM_Checkout object. At the
very end you call your setATHMCheckout function passing the object that you
just built. This function from your external script will assign your
referenced object to the ATHM_Checkout variable name the ATH Móvil's
javascript is expecting.
setATHMovilObject() {
this.athmCheckout = new ATHObject();
this.setATHMovilHeaders(this.athmCheckout);
this.setATHMovilHandlers(this.athmCheckout);
this.setGlobalAmounts(this.athmCheckout);
const items = new Array<ATHItem>();
this.athmCheckout.items = items;
this.setATHMovilItems();
setATHMCheckout(this.athmCheckout);
}
hi @bhuvanmalik007 sorry for too much late we were busy in working.
i did just initial setup and later on client change is mind and stop woking with Movil.
here is my initial code how i handled this.
REACT JS.
load movil script in index.html of project.
then load this script in your component.
declare Variable before starting component.
Activity
Cyberfolks commentedon Jul 7, 2020
hi @ckristhoff can you please share your way. im using in reactjs and all scripts are loaded successfully but issue is response handling. how can we handle callback/return data.
ckristhoff commentedon Jul 13, 2020
Hi @Cyberfolks
don't use this package in your react native app. It uses browser features. Use the android and IOS native libs and integrate by native modules
https://reactnative.dev/docs/native-modules-ios
https://reactnative.dev/docs/native-modules-android
Of course you need to know java and objective-c/swift basis.
bhuvanmalik007 commentedon Jul 9, 2021
Hi @Cyberfolks ,
were you able to handle the responses in React? Please let me know how you did it if you were able to. I'm stuck in the same situation.
Thanks!
fgarciapds commentedon Jul 9, 2021
Cyberfolks commentedon Jul 19, 2021
hi @bhuvanmalik007 sorry for too much late we were busy in working.
i did just initial setup and later on client change is mind and stop woking with Movil.
here is my initial code how i handled this.
REACT JS.
load movil script in index.html of project.
then load this script in your component.
declare Variable before starting component.
let PayPalButton = null;Start your component
const MakePayment = ({ bill, items, itemsTotal }) => {use Hook useEffect to load script.
` useEffect(() => {
//Check button status after each 10 sec. you can change it to any.
PayPalButton = setInterval(intervalBtn, 10 *1000);
})
const paymentVerify= (data) => {
console.log('paymentVerify', data)
fetch(
https://www.athmovil.com/rs/v2/transactionStatus, {method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: {
"publicToken": "",
"privateToken": "",
"referenceNumber": ""
}
})
.then((response) => response.json())
.then((responseData) => {
console.log('responseData', responseData);
})
.catch((error) => {
console.log('error', error);
});
}
const intervalBtn= () => {
if (window.completePay != undefined) {
paymentVerify(window.completePay);
clearInterval(PayPalButton)
}
}`
Remember its was just initial setup but it was working fine on test.