Linked Questions

Popular Questions

PayHere sandbox implementation for typescript

Asked by At

My app is an ionic 4 mobile app for android. I'm using PayHere sandbox as my payment gateway. I installed cordova-payhere-client to my app and there is no any documentation for how I can use it. If some one can give a sample code for typescript implementation it will be great full. Thankyou

 window.payhereClient.checkout({
                   merchantId: '<PAYHERE_SANDBOX_MERCHANT_ID>',
                   merchantSecret: '<PAYHERE_SANDBOX_MERCHANT_SECRET>',
                   amount: 1180.50, // Amount which the customer should 
                   pay
                   currency: 'LKR',
                   orderId: '123',
                   itemsDescription: 'Desc',
                   custom1: '',
                   custom2: '',
                   customer: {
                   firstName: 'Dan',
                   lastName: 'Jay',
                   email: '[email protected]',
                   phone: '0715753168'
                   },
                   billing: {
                   address: '5A',
                   city: 'Colombo',
                   country: 'Sri Lanka'
                   },
                   shipping: {
                   address: 'Park Avenue',
                   city: '5A',
                   country: ''
                   }


                   },
                   function (param) {
                   console.log(param);
                   },
                   function (param) {
                   console.log(param);
                   }
                   );

I have used this code and payhereClient is undefined. How can I overcome this issue with typescript implementation?

Related Questions