1.0.1 • Published 6 years ago

react-native-payfort v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

React Native PayFort

A react native wrapper for PayFort SDK.

Install

1.Download and follow the installation steps in PayFort documentation

https://docs.payfort.com/docs/mobile-sdk/build/index.html#download

2.Run

npm install react-native-payfort --save react-native link react-native-payfort

Usage

let { Payfort } = require('react-native').NativeModules;
........
let options = {
  isLive: false, // true for production, false for sandbox
  access_code: '', // Access Code
  command: 'AUTHORIZATION', //Command (AUTHORIZATION, PURCHASE)
  merchant_identifier: '', //The Merchant Identifier
  merchant_reference: 'XYZ9239-yu8100', //The Merchant’s unique order number (XYZ9239-yu8100)
  merchant_extra: '', //Extra data sent by merchant. Will be received and sent back as received. Will not be displayed in any report
  merchant_extra1: '', //Extra data sent by merchant. Will be received and sent back as received. Will not be displayed in any report
  merchant_extra2: '', //Extra data sent by merchant. Will be received and sent back as received. Will not be displayed in any report
  merchant_extra3: '', //Extra data sent by merchant. Will be received and sent back as received. Will not be displayed in any report
  merchant_extra4: '', //Extra data sent by merchant. Will be received and sent back as received. Will not be displayed in any report
  customer_name: '', //The customer’s name
  customer_email: 'email@domain.com', //The customer’s email (email@domain.com)
  phone_number: '', //The customer’s phone number (00962797219966)
  payment_option:'', //Payment option (MASTERCARD,VISA,AMEX)
  language: 'en', // The checkout page and messages language (en, ar)
  currency: 'EGP', //The currency of the transaction’s amount in ISO code 3 (EGP)
  amount: '1000', //The transaction’s amount
  eci: 'ECOMMERCE', //Ecommerce indicator (ECOMMERCE)
  order_description: '' //A description of the order
};
Payfort.initPayfort(options, (err, results) => {
  if (err) {
      console.log("error initializing Payfort: ", err);
      return;
  }
  // Payfort initialized...
  console.log(results)
});

Response

{
  amount: "1000",
  authorization_code: "******",
  card_number: "400555******0001",
  command: "AUTHORIZATION",
  currency: "EGP",
  customer_email: "email@domain.com",
  customer_ip: "**.**.**.**",
  customer_name: "",
  eci: "ECOMMERCE",
  expiry_date: "2105",
  fort_id: "**1904821400021901",
  language: "en",
  merchant_reference: "XYZ9239-yu8100",
  payment_option: "VISA",
  phone_number: "",
  response_code: "02000",
  response_message: "Success",
  sdk_token: "**8FE89271477477E053321E320AEE28",
  status: "02",
  token_name: "**8FE0E32A5D7475E053321E320A1300"
}

Test Card Details

You want to test a transaction but you don’t have a credit card or user credentials for our other payments options? Well we’ve got your back, here you can find card numbers for any type of test you wish to do.

Credit Cards

CARD TYPENUMBEREXPIARY DATECVV / CVC
Visa400555000000000105/21123
MasterCard512345678901234605/21123
AMEX34567890123456405/211234

3-D Secure Credit Cards

CARD TYPENUMBEREXPIARY DATECVV / CVC
Visa455701234567890205/21123
MasterCard531358100012343005/21123
AMEX37420000000000405/211234

Local Payment Methods

PAYMENT OPTIONNUMBEREXPIARY DATECVV / CVC
Knet000000000105/171234

PAYMENT OPTIONNUMBEREXPIARY DATEOTPPIN
Naps421537550088324306/1712341234

PAYMENT OPTIONPAYMENT IDPASSWORDOTP
SadadsadadOlpTest1234112358

PAYMENT OPTIONNUMBERCARD TYPE
E-dirham4724439901004942Gold Card

Digital Wallets

PAYMENT OPTIONNUMBEREXPIARY DATECVV / CVC
MasterPass400000000000000205/21123
Visa Checkout400000000000000205/21123