Skip to content

Instantly share code, notes, and snippets.

@mikebob
Last active August 29, 2015 14:06
Show Gist options
  • Save mikebob/002c8c70596c824d9ef4 to your computer and use it in GitHub Desktop.
Save mikebob/002c8c70596c824d9ef4 to your computer and use it in GitHub Desktop.
Apple Pay PaymentAuth Snippet
// Gathered from the iOS 8 Documentation & examples on https://github.com/stripe/stripe-ios
// Apple Pay avialable October 2014
if([PKPaymentAuthorizationViewController canMakePayments])
{
NSDecimalNumber *amonut = [NSDecimalNumber decimalNumberWithString:@"3.99"]
PKPaymentRequest *paymentRequest = [PKPaymentRequest new];
PKPaymentSummaryItem *totalItem = [PKPaymentSummaryItem summaryItemWithLabel:@"Swiss Cheeze" amount:amount];
[paymentRequest setMerchantIdentifier:YOUR_MERCHANT_ID];
[paymentRequest setSupportedNetworks:@[PKPaymentNetworkAmex, PKPaymentNetworkMasterCard, PKPaymentNetworkVisa]];
[paymentRequest setMerchantCapabilities:PKMerchantCapability3DS];
[paymentRequest setCountryCode:@"US"];
[paymentRequest setCurrencyCode:@"USD"];
[paymentRequest setPaymentSummaryItems:@[totalItem]];
PKPaymentAuthorizationViewController *paymentAuthController = [[PKPaymentAuthorizationViewController alloc] initWithPaymentRequest:request];
[paymentAuthController setDelegate:self];
[self presentViewController:paymentAuthController animated:YES completion:nil];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment