Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Receive payment requests

...

Fetch payment requests

...

Resolve payment requests

...

Page Properties
hiddentrue

Status

Status
colourGreen
titleapproved

Approver

Nadzeya Karaban

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

Code Block
languageswift
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
    }
Expand
titlereceivePaymentRequestId(url:completion:)

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

Code Block
languageswift
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:

    Code Block
    languageswift
    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.

    Code Block
    languageswift
    bankSDK.resolvePaymentRequest(paymentRequesId: appDelegate.paymentRequestId,
                                     paymentInfo: paymentInfo)
  3. If the payment request is successfully resolved, let the user redirect back to the payment requester app:

    Code Block
    languageswift
    bankSDK.returnBackToBusinessAppHandler(resolvedPaymentRequest: resolvedPayment)