React Native SDK
React Native SDK for NeoX Payment Gateway
Use
import { NeoXProvider } from '@neox/react-native-sdk'
const App = () => {
return (
<NeoXProvider
options={{
header: {
// containerStyle: {
// backgroundColor: 'blue',
// },
// titleStyle: {
// fontSize: 25,
// color: 'red',
// fontFamily: 'Montserrat-BoldItalic',
// },
// screenTitles: {
// paymentGatewayTitle: 'Cổng thanh toán NeoX',
// cardPaymentTitle: 'Thanh toán thẻ',
// transferPaymentTitle: 'Chuyển khoản ngân hàng',
// resultTitle: 'Ví NeoX',
// },
},
button: {
style: {
backgroundColor: 'blue',
color: 'white',
borderRadius: 0,
// fontSize: 22,
},
paymentLabel: 'Thanh toán ngay',
},
}}
>
<NavigationContainer>
<RootStack.Navigator
initialRouteName='ProductScreen'
screenOptions={{
animation:
Platform.OS === 'android' ? 'fade_from_bottom' : 'default',
}}
>
<RootStack.Screen
component={Products}
name='ProductScreen'
options={{ headerShown: false }}
/>
<RootStack.Screen
component={ProductDetails}
name='ProductDetailsScreen'
options={{ headerTitle: 'Chi tiết sản phẩm' }}
/>
</RootStack.Navigator>
</NavigationContainer>
</NeoXProvider>
)
}
export default App
Methods
initialize
Initialize the necessary configurations for the SDK and UI
Example
import { initialize, dismiss } from '@neox/react-native-sdk'
initialize(
{
neo_PaymentBaseUrl: 'https://uat-api.neopay.vn/',
neo_MerchantCode: 'HUYEN1',
neo_Amount: product.price * count,
neo_OrderInfo: 'Thanh toan don hang',
neo_ReturnURL: '',
neo_MerchantTxnID: 'T' + Math.floor(Math.random() * 100000),
neo_SecureHash: '123456',
neo_OrderID: 'DH' + Math.floor(Math.random() * 200000),
neo_PaymentMethod: paymentMethod || [],
neo_Currency: 'VND',
neo_Version: '',
neo_Command: '',
},
{
onSuccess: (res) => {
console.log('res=>Success', res)
// dismiss()
},
onFailure: (res) => {
console.log('res=>Failure', res)
// dismiss()
},
onClose: () => {
},
}
)
Params in initialize function
neo_MerchantCode
String
Merchant code is provided by NeoX
neo_Currency
String
VND
Transaction currency, VND as default
neo_Locale
String
vi
Language will display on the checkout page. Support: “vi”, “en”.
neo_Version
string
1
Payment gateway version, “1” as default
neo_PaymentMethod
String
["WALLET", "ATM", "CC", "QR"]
Allows to choose to display direct or list payment channels. If this field is not transmitted, all channels will be displayed.
neo_Amount
number
Payment amount
neo_MerchantTxnID
String
Unique - Transaction ID is provided by merchant
neo_OrderID
String
Order ID
neo_PaymentBaseUrl
String
Environment
Callback
onSuccess
The event occurs when payment is successful.
onFailure
The event occurs when payment fails.
Callback data from onSuccess and onFailure
neo_MerchantCode
string
Merchant code is provided by NeoX
neo_Currency
string
Transaction currency, VND as default
neo_Locale
string
Language will display on the checkout page. Support: “vi”, “en”.
neo_Version
string
Payment gateway version, “1” as default
neo_Command
string
“PAY” as default
neo_Amount
string
Payment amount
neo_MerchantTxnID
string
Unique - Transaction ID is provided by merchant
neo_OrderID
string
Oder ID
neo_OrderInfo
string
Oder Information
neo_TransactionID
string
Unique - Transaction ID is generated by the NeoX system, for reconciling.
neo_ResponseCode
string
The error code is returned by NeoX, indicates the transaction result.
neo_ResponseMsg
string
Error description.
neo_CustomerID
string
The customer ID on the merchant system.
neo_ResponseData
string
The data response of customer's payment.
neo_SecureHash
string
Use SHA256 to hash the above parameters (sort the key by Alphabet order) + Secret Key (will be provided by NeoX after actual integration)
Was this helpful?