npx expo install expo-tappay-line-pay
- Please install
expo-tappay-direct
in your project, becasue it is a dependency of this package
npx expo install expo-tappay-direct
- Please add the following config in your app.json
{
"expo": {
"plugins": [
[
"expo-tappay-line-pay"
]
]
}
}
Check if Line Pay is available
import * as ExpoTappayLinePay from "expo-tappay-line-pay";
const isAvailable = ExpoTappayLinePay.isLinePayAvailable();
console.log(isAvailable);
Setup Tappay (You can get credentials from Tappay)
import * as ExpoTappayLinePay from "expo-tappay-line-pay";
const appId = 11340; // Replace with your own appId
const appKey = "app_whdEWBH8e8Lzy4N6BysVRRMILYORF6UxXbiOFsICkz0J9j1C0JUlCHv1tVJC"; // Replace with your own appKey
const serverType = "sandbox"; // Replace with your own serverType (sandbox or production)
ExpoTappayLinePay.setupTappay({ appId, appKey, serverType });
import * as ExpoTappayLinePay from "expo-tappay-line-pay";
const callbackUrl = "expotappaylinepayexample://linepay"; // Replace with your own callbackUrl (e.g. expotappaylinepayexample://linepay)
ExpoTappayLinePay.setupLine(callbackUrl);
import * as ExpoTappayLinePay from "expo-tappay-line-pay";
const prime = await ExpoTappayLinePay.getPrime();
console.log(prime);
import * as ExpoTappayLinePay from "expo-tappay-line-pay";
const payment = await ExpoTappayLinePay.redirect(paymentUrl); // You will get payment result from this function