IOS


  IMPORTANT


Read all the blue sections to better understand the documentation and the orange sections signifying the alert so avoid mistakes to be made during integrations and detailed integration procedures.

GENERATE YOUR API KEYS

API keys are your digital references towards PayDunya systems. We use them to identify your account and the applications you will create. These keys are necessary for any integration of the APIs of PayDunya's payments APIs. Here are the steps to follow:

  • First you need have a PayDunya Business account activated. Create one if it is not yet the case.

  • Login to your account and click on Integration API at the menu level on the left.

  • Click on the button Set up a new application and fill out the form.

  • Choose Test mode, I want to make payment tests and Enable production mode.

INSTALLATION AND CONFIGURATION


1 - PLUGIN INSTALLATION MANAGER


  Mandatory


PayDunya's PSR IOS plugin is installed by Cocoapods


2 - PLUFIN NSTALLATION STEPS

  • Initialize your PodFile in your project.
  • And add 'psr_api_framework', '~> 1.2'
  • 
    target ‘your_app_name_here’ do       
      pod 'psr_api_framework', '~> 1.2.2'
    end
    
  • Run the command pod install . Once the installation is complete, you can open the file . Xcworkspace generated after during the installation. Now you just have to 'to open your controller and follow the instructions:

    • import the library
    • 
      import psr_api_framework
      
    • Initialize our payment popup when you click on your payment trigger button
    • 
      @IBActionfunc showFullCustomPopupButtonTapped(_ sender: Any) {
        IFrameViewController.showCustomIFrame(vcontroller: self)
      }
      
    • Initialize your api keys and payment details
    • 
      private func CheckoutInvoice() {
        let Store = PaydunyaStore(
          name: "paydunyaIOS-Plugin", 
          tagline: "L'élégance c'est nous!",
          postal_address: "11500",
          phone: 778064927,
          logo_url: "",
          website_url: "")
      
        let item1 = [
          "name": "Chaussures Croco", 
          "quantity": 3, 
          "unit_price": "10000", 
          "total_price": "30000",
          "description": "Chaussures faites en peau de crocrodile"
        ] as [String : Any]
      
        let item2 = [
          "name": "Chaussures Python",
          "quantity": 2,
          "unit_price": "10000",
          "total_price": "30000",
          "description": "Chaussures faites en peau de crocrodile"
        ] as [String : Any]
      
        let tax1 = [
          "name": "TVA (18%)",
          "amount": 12
        ] as [String : Any]
      
        let tax2 = [
          "name": "TVA (18%)",
          "amount": 2
        ] as [String : Any]
      
        let Order = PayDunyaOrder(
          total_amount: 200,
          description: "Chaussures Croco et Python",
          items: [item1, item2],
          taxes: [tax1, tax2]
        )
      
        let Setup = PaydunyaSetup(
          master_key: "......",
          private_key: "...",
          token: "...",
          cancel_url: "...",
          return_url:  "...",
          callback_url: "..."
        )
      }
      
      CheckoutInvoice(store: Store, setup: Setup, order: Order)
      
    • And finally, call the CheckoutInvoice () method after initializing the popup
    • 
      @IBActionfunc showFullCustomPopupButtonTapped(_ sender: Any) {
        IFrameViewController.showCustomIFrame(vcontroller: self)
        CheckoutInvoice()
      }