I am new in ionic 4. I want to add alipay plugin in my ionic apps. I saw all the tutorial do like this only :
import { Alipay } from '@ionic-native/alipay/ngx';
constructor(private alipay: Alipay) {
//alipayOrder is a string that has been generated and signed by the server side.
this.alipay.pay(alipayOrder)
.then(result => {
console.log(result); // Success
})
.catch(error => {
console.log(error); // Failed
});
}
But this only show the loading say openning the alipay but do not open the alipay page to pay. What I need to change inside the code? I want to send the total payment to use the alipay do payment
The documentation for the Ionic Native packages isn't really a full tutorial for implementing it. You need to have done it a few times to learn what it means.
Go to the main Ionic Native community page and follow the generic setup instructions that all packages should have done:
The first line of your snippet goes at the top
The rest of this is just a rough outline of the API, but not a full guide to its use.
Often you can find more information by clicking through to the github repo.
From my investigation it has revealed that you need to install with an app_id variable:
Which means you need to sign up for a developer account with AliPay and have an app created on their platform.
The documentation also links out to this page:
Which has details for all of the types of parameters you can use to generate an order on their side which can be turned into a url like this:
And then finally passed into the plugin to manage the payment process.
Also, it seems that you might have some success by contacting AliPay for specific questions.
[Update] How To Get An App ID
On this page it has these instructions:
So you need to go to the signup page and register a normal account and then find the option to upgrade it to a developer account.
After that you can register an app with the platform to get the id.