{"_id":"@abdelrahman.rabie/payment-sdk-react-native","name":"@abdelrahman.rabie/payment-sdk-react-native","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@abdelrahman.rabie/payment-sdk-react-native","version":"1.0.0","description":"React Native SDK for payment processing with E_API and E_LINKS support","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","prepare":"npm run build","test":"jest","lint":"eslint src --ext .ts,.tsx","clean":"rm -rf lib"},"keywords":["react-native","payment","sdk","eapi","elinks","apple-pay","google-pay"],"author":{"name":"Adam Romano"},"license":"MIT","peerDependencies":{"react":">=16.8.0","react-native":">=0.60.0"},"dependencies":{"axios":"^1.7.9"},"devDependencies":{"@types/react":"^18.2.0","@types/react-native":"^0.72.0","@typescript-eslint/eslint-plugin":"^6.0.0","@typescript-eslint/parser":"^6.0.0","eslint":"^8.0.0","jest":"^29.0.0","typescript":"^5.0.0"},"repository":{"type":"git","url":"git+https://github.com/adamromano/payment-sdk-react-native.git"},"homepage":"https://github.com/adamromano/payment-sdk-react-native#readme","bugs":{"url":"https://github.com/adamromano/payment-sdk-react-native/issues"},"_id":"@abdelrahman.rabie/payment-sdk-react-native@1.0.0","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-DxpcOqAyAM8ooHN1i9AG98v4tnyuA6rBNbyfCjHfZBOzXL7cibPmhbWWOGSebNr8uR7KAAXKL5Acj5QQM/I6+g==","shasum":"6017537eb6104e75ce28b8e7615ab8a55c8faeb9","tarball":"https://registry.npmjs.org/@abdelrahman.rabie/payment-sdk-react-native/-/payment-sdk-react-native-1.0.0.tgz","fileCount":18,"unpackedSize":31300,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGtop7F3j5FaLoEvF3pm0CbYqvpiwgl6DX5a7KhOT48NAiEA4XkLofdxLr+pjv/kxG+WsgR2HfJWPcaXgrdJnfjD8iA="}]},"_npmUser":{"name":"abdelrahman.rabie","email":"abdulrahmanmaher@ecom.io"},"directories":{},"maintainers":[{"name":"abdelrahman.rabie","email":"abdulrahmanmaher@ecom.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/payment-sdk-react-native_1.0.0_1755691169180_0.4909546043229298"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-20T11:59:29.113Z","1.0.0":"2025-08-20T11:59:29.339Z","modified":"2025-08-20T11:59:29.618Z"},"maintainers":[{"name":"abdelrahman.rabie","email":"abdulrahmanmaher@ecom.io"}],"description":"React Native SDK for payment processing with E_API and E_LINKS support","homepage":"https://github.com/adamromano/payment-sdk-react-native#readme","keywords":["react-native","payment","sdk","eapi","elinks","apple-pay","google-pay"],"repository":{"type":"git","url":"git+https://github.com/adamromano/payment-sdk-react-native.git"},"author":{"name":"Adam Romano"},"bugs":{"url":"https://github.com/adamromano/payment-sdk-react-native/issues"},"license":"MIT","readme":"# Payment SDK React Native\n\nA comprehensive React Native SDK for payment processing with E_API and E_LINKS support, including Apple Pay and Google Pay integration.\n\n## Features\n\n- 🚀 Easy integration with React Native apps\n- 💳 Support for multiple payment methods (Visa, Mastercard, Apple Pay, Google Pay, KNET)\n- 🔄 E_API and E_LINKS payment products\n- 🍎 Apple Pay merchant validation\n- 🎣 React hooks for seamless state management\n- 📱 TypeScript support with full type definitions\n- 🌍 Multi-language support (Arabic/English)\n\n## Installation\n\n```bash\nnpm install @abdelrahman.rabie/payment-sdk-react-native\n# or\nyarn add @abdelrahman.rabie/payment-sdk-react-native\n\nFor iOS projects using CocoaPods:\n\n```bash\ncd ios && pod install\n```\n\n## Quick Start\n\n### 1. Initialize the SDK\n\n```typescript\nimport { PaymentSDK } from \"payment-sdk-react-native\";\n\nconst sdk = new PaymentSDK({\n  baseURL: \"https://your-payment-api.com\",\n  paymentPageApiToken: \"your-api-token\",\n  paymentCoreURL: \"https://your-payment-core-api.com\", // optional\n});\n```\n\n### 2. Using React Hooks\n\n```typescript\nimport React from \"react\";\nimport { View, Button, Text } from \"react-native\";\nimport {\n  usePayment,\n  EPaymentProduct,\n  EPaymentMethods,\n  ELanguages,\n} from \"payment-sdk-react-native\";\n\nconst PaymentScreen = () => {\n  const { loading, error, paymentInfo, executePayment, initializePayment } =\n    usePayment({ sdk });\n\n  const handleInitialize = async () => {\n    await initializePayment(EPaymentProduct.E_API, \"your-payment-token\");\n  };\n\n  const handlePayment = async () => {\n    await executePayment(EPaymentProduct.E_API, \"your-payment-token\", {\n      paymentMethod: EPaymentMethods.VISA,\n      language: ELanguages.EN,\n    });\n  };\n\n  return (\n    <View>\n      <Button title=\"Initialize Payment\" onPress={handleInitialize} />\n      <Button\n        title=\"Pay with Visa\"\n        onPress={handlePayment}\n        disabled={loading}\n      />\n      {error && <Text style={{ color: \"red\" }}>{error}</Text>}\n      {paymentInfo && <Text>Amount: {paymentInfo.data.amount.value}</Text>}\n    </View>\n  );\n};\n```\n\n### 3. Apple Pay Integration\n\n```typescript\nimport { useApplePay } from \"payment-sdk-react-native\";\n\nconst ApplePayComponent = () => {\n  const { loading, error, validateMerchant } = useApplePay({ sdk });\n\n  const handleApplePayValidation = async (validationURL: string) => {\n    await validateMerchant(validationURL);\n  };\n\n  // Use with Apple Pay button implementation\n};\n```\n\n## API Reference\n\n### PaymentSDK\n\nMain SDK class for payment operations.\n\n#### Methods\n\n- `initializePayment(product, paymentToken)` - Get payment information\n- `executePayment(product, paymentToken, payload)` - Process payment\n- `getPaymentStatus(product, paymentToken)` - Get payment status\n- `validateApplePayMerchant(validationURL)` - Validate Apple Pay merchant\n\n### Hooks\n\n#### usePayment\n\nReact hook for payment operations.\n\n**Returns:**\n\n- `loading` - Loading state\n- `error` - Error message\n- `paymentInfo` - Payment information\n- `paymentResult` - Payment result\n- `initializePayment()` - Initialize payment function\n- `executePayment()` - Execute payment function\n- `getPaymentStatus()` - Get status function\n\n#### useApplePay\n\nReact hook for Apple Pay operations.\n\n**Returns:**\n\n- `loading` - Loading state\n- `error` - Error message\n- `applePaySession` - Apple Pay session data\n- `validateMerchant()` - Validate merchant function\n\n## Payment Products\n\n- `EPaymentProduct.E_API` - API-based payments\n- `EPaymentProduct.E_LINKS` - Link-based payments\n\n## Payment Methods\n\n- `EPaymentMethods.VISA`\n- `EPaymentMethods.MASTERCARD`\n- `EPaymentMethods.APPLE_PAY`\n- `EPaymentMethods.GOOGLE_PAY`\n- `EPaymentMethods.KNET`\n- And more...\n\n## Error Handling\n\nThe SDK provides comprehensive error handling:\n\n```typescript\ntry {\n  const result = await sdk.executePayment(product, token, payload);\n  if (result.success) {\n    // Payment successful\n    console.log(\"Payment completed:\", result.data);\n  } else {\n    // Payment failed\n    console.error(\"Payment failed:\", result.error);\n  }\n} catch (error) {\n  console.error(\"SDK error:\", error.message);\n}\n```\n\n## TypeScript Support\n\nThe SDK is fully typed with TypeScript. All interfaces and types are exported for use in your application.\n\n## License\n\nMIT\n\n# New SDK Package Structure\n\npayment-sdk-react-native/\n├── src/\n│ ├── core/PaymentSDK.ts # Main SDK class\n│ ├── services/\n│ │ ├── httpClient.ts # HTTP client for API calls\n│ │ └── paymentService.ts # Payment logic extracted from your app\n│ ├── hooks/\n│ │ ├── usePayment.ts # React hook for payments\n│ │ └── useApplePay.ts # React hook for Apple Pay\n│ ├── types/payment.types.ts # All TypeScript interfaces\n│ ├── constants/endpoints.ts # API endpoints and regex\n│ └── index.ts # Main exports\n├── example/App.tsx # Complete usage example\n├── package.json # NPM package config\n├── tsconfig.json # TypeScript config\n└── README.md # Documentation\n","readmeFilename":"README.md","_rev":"1-b8b2d3878e7be79a8e498787a9215815"}