1
if(braintree && ![braintree isKindOfClass:[NSNull class]])
{
    self.provider = [braintree paymentProviderWithDelegate:self];
  if ([self.provider canCreatePaymentMethodWithProviderType:BTPaymentProviderTypeApplePay]==0)
  {
     self.provider.paymentSummaryItems = @[[PKPaymentSummaryItem summaryItemWithLabel:@"MakeUp" amount:[NSDecimalNumber decimalNumberWithString:@"1"]]];
  }
  [self.provider createPaymentMethod:BTPaymentProviderTypeApplePay];
  if ([self.provider canCreatePaymentMethodWithProviderType:BTPaymentProviderTypeApplePay]) //False
  {


 }
}

Here i am getting:

canCreatePaymentMethodWithProviderType:BTPaymentProviderTypeApplePay false.

How and where do I need to present PKPaymentAuthorizationViewController?

mins
  • 6,478
  • 12
  • 56
  • 75
Kamlesh Shingarakhiya
  • 2,757
  • 2
  • 16
  • 34
  • 2
    Have you configured Apple Pay in the Braintree control panel? Do you have the correct entitlement enabled in your app's build settings? – mickeyreiss Mar 31 '15 at 15:43
  • @mickeyreiss Yes i have configured Apple Pay and i have the correct entitlement in my app. One more thing is that in the my developer account merchant id certificate shows the production and in braintree i am testing in the sandbox so is this the problem? If yes How can i make development merchant id? – Kamlesh Shingarakhiya Apr 01 '15 at 04:14
  • For Braintree's sandbox, just create another Apple Merchant ID, and set up the certificate in the sandbox control panel (https://sandbox.braintreegateway.com/merchants/YOUR_MERCHANT/processing/apple_pay/certificates). Your app should end up with *two* Apple Merchant IDs, one for each environment. – mickeyreiss Apr 01 '15 at 17:02
  • This line in your code is suspect: `if ([self.provider canCreatePaymentMethodWithProviderType:BTPaymentProviderTypeApplePay]==0)`. Once everything is configured correctly, that method will return `YES`. – mickeyreiss Apr 01 '15 at 17:03
  • @mickeyreiss I have removed it and but still it's giving me the False. I have make it like this: if ([self.provider canCreatePaymentMethodWithProviderType:BTPaymentProviderTypeApplePay]). everything I have configure correctly.But still If possible can you tell me the Steps which I need to follow.So I can re-confirm the configuration. – Kamlesh Shingarakhiya Apr 02 '15 at 05:02
  • @mickeyreiss The Error what i am geeting is: Apple Pay Error:- Error Domain=BTPaymentProviderErrorDomain Code=2 "Failed to initialize a Apple Pay authorization view controller. Check device, OS version, cards in Passbook and configuration." – Kamlesh Shingarakhiya Apr 02 '15 at 06:23
  • Which device are you testing on? Can you share your code? – mickeyreiss Apr 02 '15 at 22:46
  • @mickeyreiss I am testing it on the iPhone 6. – Kamlesh Shingarakhiya Apr 03 '15 at 04:52
  • I see. It's going to be difficult for me to help you further without some more information about your setup. Please make sure you are following all of the setup instructions very carefully (https://developers.braintreepayments.com/ios+ruby/guides/apple-pay/configuration) – mickeyreiss Apr 03 '15 at 04:58
  • @mickeyreiss You can see the Code from below link.:- https://docs.google.com/document/d/1arCiZmkU1q7Ddihwz1eEDJ9A4AJKS7C16SO0Qx_Kv2s/edit?usp=sharing – Kamlesh Shingarakhiya Apr 03 '15 at 05:10
  • It seems like the root of the issue is that `canMakePaymentsUsingNetworks:` is returning `NO`. This can happen when there are no cards on the device, and it can also happen when your provisioning profile does not match up with the Apple Merchant ID in your entitlements and your code. – mickeyreiss Apr 06 '15 at 17:09
  • Theres a workaround described here: http://stackoverflow.com/questions/28090069/how-do-i-test-braintree-apple-pay-on-a-real-device – mickeyreiss Apr 06 '15 at 17:10

0 Answers0