Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Pay iOS not working, amount nil inside ApplePayExecutor #351

Open
2 of 8 tasks
PronosSport opened this issue Apr 26, 2024 · 1 comment
Open
2 of 8 tasks

Apple Pay iOS not working, amount nil inside ApplePayExecutor #351

PronosSport opened this issue Apr 26, 2024 · 1 comment
Labels

Comments

@PronosSport
Copy link

Platform

  • Web
  • iOS
  • Android

Describe the bug
Apple Pay not working, amount is nil inside ApplePayExecutor. working fine with Android play, and classic credit card/paypal with createPaymentSheet method.

To Reproduce
Steps to reproduce the behavior:
1.
await Stripe.createApplePay({ paymentIntentClientSecret: paymentIntent, paymentSummaryItems: [ { label: 'xxx', amount: 500, }, ], merchantIdentifier: 'merchant.com.xxx', countryCode: 'FR', currency: 'EUR', });

error inside ApplePayExecutor :
`
func createApplePay(_ call: CAPPluginCall) {
let paymentIntentClientSecret = call.getString("paymentIntentClientSecret") ?? nil
if paymentIntentClientSecret == nil {
call.reject("Invalid Params. this method require paymentIntentClientSecret")
return
}

    let items = call.getArray("paymentSummaryItems", [String: Any].self) ?? nil
    if items == nil {
        call.reject("Invalid Params. this method require paymentSummaryItems")
        return
    }

    var paymentSummaryItems: [PKPaymentSummaryItem] = []
    if let strs = items {
        for item in strs {
            let label = item["label"] as? String ?? ""
            let amount = item["amount"] as? NSNumber
            let amountD: NSDecimalNumber

            amountD = NSDecimalNumber(decimal: **amount!**.decimalValue)

       // .........
    `

CapacitorCommunityStripe/ApplePayExecutor.swift:42: Fatal error: Unexpectedly found nil while unwrapping an Optional value

Expected behavior
getting amount should not be nil

Screenshots
Capture d’écran 2024-04-26 à 11 35 15

Additional context
iOS simulator : iPhone 15 pro.
I follow all step from documentation, merchant certificate etc...

Using Function:

  • Payment Sheet / Payment Flow
  • Apple Pay
  • Google Pay
  • Identity (@capacitor-community/stripe-identity)
  • Terminal(@capacitor-community/stripe-terminal)
@rdlabo
Copy link
Member

rdlabo commented Aug 11, 2024

Please amount: 500 to amount: 500.0. Decimal Number is required.

@shiv19 shiv19 added the payment label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants