Skip to main content

Line Pay

Prerequisites

  • Please create a Tappay account and get the app ID from Tappay Dashboard.
  • Integrate your Merchant with Tappay Dashboard.
  • Please add the following config in your app.json
{
"expo": {
"plugins": [
[
"expo-tappay", {
"linePay": {
"enable": true
},
// other payment methods...
}
]
]
}
}
ParameterTypeDescription
enablebooleanWhether to enable Line Pay

Usage

Setup Tappay

This method configures the Tappay instance. This setup must be completed before any Apple Pay transaction can be processed.

ParameterTypeDescription
appIdnumberYour Tappay App ID
appKeystringYour Tappay App Key
serverTypeServerTypeYour Tappay Server Type

Server Type

  • sandbox: for testing
  • production: for production
import Tappay from "expo-tappay";

const tappay = new Tappay({
appId: 11340, // replace with your Tappay App ID
appKey: "app_whdEWBH8e8Lzy4N6BysVRRMILYORF6UxXbiOFsICkz0J9j1C0JUlCHv1tVJC", // replace with your Tappay App Key
serverType: "sandbox",
});

Checking Line Pay Availability

Checks if Line Pay is available and properly configured on the device

return: boolean


if (tappay.linePay.isAvailable) {
console.log("Line Pay is available");
} else {
console.log("Line Pay is not available");
}

Install Line Pay

This method installs Line Pay.

IMPORTANT: This method only available for iOS cause the Tappay native dependency limitation.

return: void

tappay.linePay.install();

Get Prime Token

Call getPrimeToken() to get the prime token.

return: Promise<string>

tappay.linePay.getPrimeToken();

Setup Callback

You must use setupCallback function to setup the callback URL.

IMPORTANT: If setupCallback() is not called, the payment will not be successful.

Parameters:

ParameterTypeDescription
callbackUrlstringThe callback URL

return: void

import * as Linking from "expo-linking";

// To Get Deep Link URL from your app
const callbackUrl = Linking.createURL("{PATH}");
tappay.linePay.setupCallback(callbackUrl);

Start Payment

Call startPayment() to start the payment.

IMPORTANT: First call getPrimeToken() to obtain the prime token, then send this token to your backend server to generate the payment URL.

Parameters:

ParameterTypeDescription
paymentUrlstringThe payment URL

PaymentResult

return: Promise<PaymentResult>

tappay.linePay.startPayment("{Payment_URL}");

Example

LinePay Example

Type

Line Pay Payment Result

PropertyTypeDescription
statusnumberTransaction status code
recTradeIdstringTransaction ID
orderNumberstringOrder number
bankTransactionIdstringBank transaction ID

Version

  • TPDirect: v2.17.0