Last active
August 29, 2015 14:06
-
-
Save mikebob/002c8c70596c824d9ef4 to your computer and use it in GitHub Desktop.
Apple Pay PaymentAuth Snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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