Giter Site home page Giter Site logo

paybuttoniosexample's Introduction

PaySky PayButton SDK Example

The PayButton helps make the integration of card acceptance into your app easy.

You simply provide the merchant information you receieve from PaySky to the payment SDK. The PayButton displays a ready-made view that guides the merchant through the payment process and shows a summary screen at the end of the transaction.

Getting Started

Prerequisites

This project uses cocoapods for dependencies management. If you don't have cocoapods installed in your machine, or are using older version of cocoapods, you can install it in terminal by running command sudo gem install cocoapods or brew install cocoapods. For more information go to Cocoapods.org

๐Ÿ’ป Installation

  1. Close Xcode project.
  2. Create a Podfile to your project. From the terminal navigate to project location then use next command
pod init
  1. Add the pod to your Podfile: Open Podfile with any text editor tool then add the next line inside "target 'PayButton' do "scoop
pod 'PayButtonIOS', :git => 'https://github.com/payskyCompany/PayButtonIOS.git', :branch => 'master'
  1. Open the terminal and run
pod deintegrate
pod install
๏นข Optional step (recommended)

To avoid pods DEPLOYMENT_TARGET errors add the next lines to the end of podFile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
    end
  end
end
  1. Disable USER_SCRIPT_SANDBOXING
    1. Reopen _.xcworkspace.
    2. Navigate to targets and select your app name.
    3. Navigate to Build Settings
    4. Search for USER_SCRIPT_SANDBOXING and set it to NO.

โš ๏ธ Addition step

If you have this error :

Multiple commands produce '/Users/paysky106/Library/Developer/Xcode/
DerivedData/TestPayButton-ghdftwdswnoxgexfnpfxqmwsgah/Build/Products/
Debug-iphonesimulator/TestPayButton.app/Assets.car'

Place disable_input_output_paths: true in Podfile, to skip optimisation and always download resources from Pods cleanly every time, since it is not copying bundled assets during build. Adding extra overhead to build doesn't seem optimal, and leads to bad experience during local App development
# Podfile
# platform :ios, '13.0'
install! 'cocoapods', :disable_input_output_paths => true

๐Ÿš€ Deployment

  1. Before deploying your project live, you should get a merchant ID and terminal ID provided by PaySky.
  2. You should keep your merchant ID and terminal ID secured in your project, encrypt them before save them in project.

๐Ÿ›  How to use

In order to use the SDK you should use a production merchantId, terminalId and secure_hash key provided by PaySky.

๐Ÿ‘‰ Usage/Examples

In the class you want to intiate the payment from, you should import the framework

import PayButtonIOS

After the import, create a new instance from PayButton

let paymentViewController = PaymentViewController(
                merchantId: "merchantId", //Mandatory
                terminalId: "terminalId", //Mandatory
                amount: 100.0, //Mandatory - provide the amount and currency with it's decimal factor
                currencyCode: 0, //Mandatory - Provided by PaySky
                secureHashKey: "secure_hash",//Mandatory - Provided by PaySky
                trnxRefNumber: "", //Optinal (remove it if not use), Provided by PaySky
                customerId: "", //Optinal (remove it if not use), Provided by PaySky
                customerMobile: "", //Optinal (remove it if not use), Provided by PaySky
                customerEmail: "", //Optinal (remove it if not use), Provided by PaySky
                isProduction: false //Choose the needed inviroment
            )

Then confirm to PaymentDelegate :-

paymentViewController.delegate = self // Payment Delegate
paymentViewController.pushViewController()

In order to create transaction callback in delegate PaymentDelegate, implement delegate on your ViewController.

extension ViewController: PayButtonDelegate {
     func finishedSdkPayment(_ response: PayButtonIOS.PayByCardReponse) {
        if response.success == true {
            print("Transaction completed successfully")
            print(response.networkReference ?? "") // reference number of transaction.
        } else {
            print("Transaction failed")
            print(response.message ?? "") // response error
        }
    }
}

๐Ÿ› ๏ธ Built With

โœ๏ธ Authors

PaySky Company

paysky

๐Ÿ”— Links

paysky paysky

๐Ÿ‘€ SDK Repo

PayButtonIOS SDK

paybuttoniosexample's People

Contributors

abdullahtarek-paysky avatar nadakamel-paysky avatar nadakamel avatar abdallatarek avatar hanyfekrey avatar hanhon avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

paybuttoniosexample's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.