Work with Payment Requests

  1. After initializing GiniBankAPI and GiniBank, get the payment requestID in AppDelegate. For handling incoming URLs, use the code snippet:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { receivePaymentRequestId(url: url) { result in switch result { case let .success(requestId): self.paymentRequestId = requestId case .failure: break } } return true }

Getting the payment request ID from the incoming URL should be called inside function: func application(_ application: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:] ) -> Bool

public func receivePaymentRequestId(url: URL, completion: @escaping (Result<String, GiniBankError>) -> Void)

url

The incoming url from the business app

completion

An action for processing asynchronous data received from the service with Result type as a paramater. Result is a value that represents either a success or a failure, including an associated value in each case. In success case it includes payment request ID. In case of failure error that there is no requestID in incoming url from the business app.

  1. After receiving the payment request ID, you can get fetch the payment information:

    bankSDK.receivePaymentRequest(paymentRequestId: appDelegate.paymentRequestId)

    The method above returns the completion block with the struct PaymentRequest, which includes recipient, IBAN, amount, and purpose fields.

  2. The following method returns the completion block with the struct ResolvedPaymentRequest, which includes requesterUri for redirecting back to the payment requester’s app.

  3. If the payment request is successfully resolved, let the user redirect back to the payment requester app:

    Â