问题
I am getting very frustrated as I have spent long hours on a solution to this problem. I am creating a request using the code below:
PKPaymentRequest *request = [Stripe
paymentRequestWithMerchantIdentifier:merchantId];
// Configure your request here.
NSString *label = @"Product Description";
NSDecimalNumber *amount = [NSDecimalNumber decimalNumberWithString:[productpriceDouble stringByReplacingOccurrencesOfString:@"$" withString:@""]];
request.paymentSummaryItems = @[
[PKPaymentSummaryItem summaryItemWithLabel:label
amount:amount]
];
request.merchantIdentifier = @"merchantId";
request.countryCode = @"US";
request.currencyCode = @"USD";
request.merchantCapabilities = PKMerchantCapability3DS;
PKPaymentAuthorizationViewController *paymentController;
paymentController = [[PKPaymentAuthorizationViewController alloc]
initWithPaymentRequest:request];
paymentController.delegate = self;
[self presentViewController:paymentController animated:YES completion:nil];
When the code runs, it starts off fine as the Apple Pay view pops up with the finger print, however, when the finger print is confirmed, it spirals around for a bit and then pops up with an alert and says:
'Apple Pay is Not Available in "AppName"'
Check the settings for this app and make sure it was designed to use Apple Pay.
Any thoughts would be greatly appreciated.
回答1:
May 2015 - Also encountered this problem.
I had to redo all the certificates for my app due, because I had an issue with the provisioning profile and other stuff that were not set up correctly.
Apple pay WAS working before all the changes...still worked after I changed all the certificates, but....day later it stopped working!!!
Here is what I did.
I check the Apple Pay settings in the phone, re-added my billing address (sometimes this could be the problem, but it wasn't).
I check the entitlements certificate in the app, to make sure that it was properly setup. Here make sure you have your merchant id included...should start with merchant.com.nameOfApp (you can get this from apple center under merchant id. (This was good - not the problem)
Checked all my certificates - everything seem to be correct.
The last thing I did was to regenerate the certificate for apple pay. BOOM! That was the issue. Not sure why, it just worked. Delete the old certificates for stripe and apple apple pay from your computer and follow the instructions in the stripe/apple pay documentation.
See here
https://stripe.com/docs/mobile/apple-pay
Hope this help!
回答2:
You may have created a merchant ID and matching cert, but have you checked that merchant ID is in your entitlements file, and ensured that your entitlements file is being put into your binary? Double check your project capabilities in Xcode to make sure your merchant ID is listed there, and triple check by seeing if the entitlements file is in your target's build settings.
It's also not clear to me why you're explicitly setting the merchantID, when presumably Stripe's factory method should create it for you pre-set?
回答3:
We encountered this problem in Jun, 2016.
Fixed by revoking the merchant Certificate and recreating it by uploading the same CSR.
It is really confusing because Apple Pay seems "Enabled" and there was nothing wrong.
回答4:
I found the solution. Add the string STRIPE_ENABLE_APPLEPAY to both Debug and Release under Preprocessor Macros.
I too faced the same problem.
Update : Now it was fixed. refer: github.com
来源:https://stackoverflow.com/questions/29618296/stripe-and-apple-pay-not-working-in-ios-app