Skip to content

Commit

Permalink
fix(ios): update publishable key for existing client if exists
Browse files Browse the repository at this point in the history
closes #18
  • Loading branch information
ihadeed committed Jul 8, 2017
1 parent fda4e19 commit 306250e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ios/CordovaStripe.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ - (void)setPublishableKey:(CDVInvokedUrlCommand*)command

NSString* publishableKey = [[command arguments] objectAtIndex:0];
[[STPPaymentConfiguration sharedConfiguration] setPublishableKey:publishableKey];
CDVPluginResult* result = [CDVPluginResult
resultWithStatus: CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];

if (self.client == nil) {
// init client if doesn't exist
client = [[STPAPIClient alloc] init];
} else {
[self.client setPublishableKey:publishableKey];
}

CDVPluginResult* result = [CDVPluginResult
resultWithStatus: CDVCommandStatus_OK];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];

}

- (void)throwNotInitializedError:(CDVInvokedUrlCommand *) command
Expand Down

0 comments on commit 306250e

Please sign in to comment.