Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
// ElePayObjCBridge.swift
// ElePayObjCBridge
// Created by xuzhe on 2019/01/15.
// Copyright © 2018 All rights reserved.
import ElepaySDK
final public class ElePayObjCBridge: NSObject {
public static func initElePay(publicKey: String) {
Elepay.initApp(key: publicKey)
public static func handleOpenURL(_ url: URL) -> Bool {
return Elepay.handleOpenURL(url)
public static func handlePaymentEvent(payload: String, senderViewController sender: UIViewController) -> Bool {
return Elepay.handlePayment(chargeJSON: payload, viewController: sender) { (paymentResult) in
switch (paymentResult) {
case let .succeeded(paymentId):
print("Payment ID: \(paymentId), Payment Succeed")
case let .cancelled(paymentId):
print("Payment ID: \(paymentId), Canceled by user")
case let .failed(paymentId, error):
switch (error) {
case let .alreadyMakingPayment(paymentId):
print("Already making payment: \(paymentId)")
print("Payment ID: \(paymentId ?? ""), Make Payment Failed \(String(describing: error.errorDescription))")
@unknown default:
// handle newly added case here