Authentication

When using the SDK you have two options.

  1. Have users login to Yoco from within your application (this is usually the easiest approach if you will have lots of businesses using your integration)

  2. Have your application pass in a pre-configured API token for each business. You will need to co-ordinate with Yoco to create a token for each business that will use your integration.

When using either approach, you must also attach your YocoClientDelegate so that you can receive transaction results.

Approach 1: To allow your user to login to Yoco from within your app

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
//...your other code
//Configure the YocoClient with your integrator secret (this identifies your software)
[YocoClient initWithSecret:@"your-yoco-integration-secret"];
//...more code
return YES;
}

As soon as the business initiates their first Yoco transaction they will be shown a login dialog. If you would like to control when they are shown this dialog, you can force the login process by using the following:

[YocoClient login:self success:^{
NSLog(@"Yoco logged in!");
} cancel:^{
NSLog(@"User cancelled without logging in successfully");
}];

Approach 2: To use a pre-negotiated API token

[YocoClient initWithSecret:@"your-yoco-integration-secret" andApiToken:@"your-api-token"];