Objective C

You can download Objective C demo from here and use MFSDK.

Import framework in AppDelegate

#import <MFSDK/MFSDK-Swift.h>
  • Add below code in didFinishLaunchingWithOptions method
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // set up your My Fatoorah Merchant details
    [[MFSettings shared] configureWithUsername:@"[email protected]" password:@"Mf@12345678" baseURL:@"https://apidemo.myfatoorah.com/"];
    
    // you can change color and title of nvgigation bar
    MFTheme* theme = [[MFTheme alloc] initWithNavigationTintColor:[UIColor whiteColor] navigationBarTintColor:[UIColor lightGrayColor] navigationTitle:@"Payment" cancelButtonTitle:@"Cancel"];
    [[MFSettings shared] setThemeWithTheme:theme];
    return YES;
}

MyFaoorah Visa/Mastercard direct payment

Myfatoorah SDK now support direct payment for Visa and Master card with this feature you can implement your own design for collecting card info from the user pass them to our SDK and let us do the rest for you with only 3 easy steps your payment will be done
follow this steps to know how to use it :-

1600
#import "ViewController.h" 

 
 

@interface ViewController () 

 
 

@end 

 
 

@implementation ViewController 

 
 

- (void)viewDidLoad { 

[super viewDidLoad]; 

// Do any additional setup after loading the view. 

[[MFInvoiceCreateStatus shared] setDelegate:self]; 

} 

- (IBAction)payDidPress:(id)sender { 
  //1- Create invoice model like this:  
 /// - Parameters: 

    ///   - invoiceValue: Invoice amount the customer will pay 

    ///   - customerName: Your customer name  

    ///   - countryCode: Your country code  

    ///   - displayCurrency: Currency will be displayed for the user 

MFInvoice* invoice = [[MFInvoice alloc] initWithInvoiceValue:invoiceValue customerName: @"Test" countryCode: MFCountryKuwait displayCurrency:MFCurrencyKuwaiti_Dinar_KWD]; 
 //2- Create Card model with card info you get from the user: 
 
   /// - Parameters: 

    ///   - cardExpiryMonth: Card expiry month 2 digits 

    ///   - cardExpiryYear: Card expiry year 2 digits 

    ///   - cardSecurityCode: Card security code 3 digits  

    ///   - cardNumber: Card number   

MFCard * invoice = [[MFCard alloc] initWithCardExpiryMonth:: @"05" cardExpiryYear: @"21" cardSecurityCode: @"100" cardNumber: @"54123458888888889"]; 
 
//3- Pass them to createInvoice method and wait the response from the SDK : 
     

  /// - Parameters: 

    ///   - invoice: Invoice model 

    ///   - card: Card model 

    ///   - apiLanguage: Language you prefer for getting msg from the API 

[[MFPaymentRequest shared] createInvoiceWithInvoice:invoice card: card  apiLanguage:MFAPILanguageArabic]; 

 

} 

 
 
 
//*Note : to get response from the SDK you must implement this delegate  like this  

- (void)didInvoiceCreateFailWithError:(MFFailResponse * _Nonnull)error { 

NSLog( @"error:"); 

} 

 
 

- (void)didInvoiceCreateSucessWithTransaction:(MFTransaction * _Nonnull)transaction { 

NSLog( @"Success:"); 


} 

 
 

- (void)didPaymentCancel { 

NSLog( @"responseCode: -1"); 

NSLog(@"Error: Payment Cancelled"); 

} 

 
 
 

@end