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
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
Callback
Callback data from onSuccess and onFailure
Last updated