#sagar_code

1 messages ยท Page 1 of 1 (latest)

patent cobaltBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1217537081346359459

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

sacred fieldBOT
broken garden
#

Hi, can you share the request id where you only see the card payment?

broken garden
sacred fieldBOT
glass lark
#

we are currently using the test mode of payment and the simulator location is set to sweden.

#

can you guides us for creating the payment intents
what should be in the payment intent object if
payment_method_types: ['card','swish','klarna'],

and what should be
payment_method_data
return_url
considering the types as card ,swish,klarna at once.

scarlet grail
#

Yeah, that is surprising that the payment sheet is only showing cards. Trying to think of what may be happening here. Can you show me your code for setting up your payment sheet once the intent has been created?

glass lark
#

Sure
const paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: "sek",
payment_method_types: ['card','swish','klarna'],
// automatic_payment_methods: {enabled: true, allow_redirects: "never"},
customer: customer.id,
receipt_email: user.email,
confirm: true,
transfer_group: booking,
use_stripe_sdk:true,
// payment_method_data: {
// type: 'swish',
// },
return_url: cravioz,
});

return {
paymentIntentId: paymentIntent.id,
paymentIntentClientSecret: paymentIntent.client_secret,
ephemeralKey: ephemeralKey.secret,
customer: customer.id,
publishableKey: process.env.STRIPE_PUBLISHABLE_KEY
}

scarlet grail
#

Gotcha and what is your client side code for initiating the sheet?

glass lark
#

client side code

STPAPIClient.shared.publishableKey = self.objOrderProject.objOrderProductStripeUserModel?.data?.publishableKey ?? ""
// MARK: Create a PaymentSheet instance
var configuration = PaymentSheet.Configuration()
configuration.merchantDisplayName = "Foodarna"
configuration.customer = .init(id: self.objOrderProject.objOrderProductStripeUserModel?.data?.customer ?? "", ephemeralKeySecret: self.objOrderProject.objOrderProductStripeUserModel?.data?.ephemeralKey ?? "")
// Set allowsDelayedPaymentMethods to true if your business can handle payment
// methods that complete payment after a delay, like SEPA Debit and Sofort.
configuration.allowsDelayedPaymentMethods = true
self.paymentSheet = PaymentSheet(paymentIntentClientSecret: self.objOrderProject.objOrderProductStripeUserModel?.data?.paymentIntentClientSecret ?? "", configuration: configuration)

            self.paymentSheet?.present(from: self) { paymentResult in
            // MARK: Handle the payment result
            switch paymentResult {
            case .completed:
              print("Your order is confirmed")                        
            case .canceled:
              print("Canceled!")
            case .failed(let error):
              print("Payment failed: \(error)")
            }
          }
scarlet grail
#

Thank you, looking in to what may be causing this

glass lark
#

๐Ÿ‘Œ

scarlet grail
#

Strangely I am getting these payment methods ot show up properly with very similar code.

#

What version of stripe-ios are you using? I think support for these payment methods was added in specific versions

glass lark
#

can you share the server side and client side code
that will be much helpful

scarlet grail
#

My parameters for the payment intent are:

    amount: 1099,
    currency: 'sek',
    payment_method_types: [
        'card',
        'swish',
        'klarna'
    ],
    on_behalf_of: 'acct_1OtxBjR3L23i9uRi',
    customer: 'cus_123'
}```
#

For the payment sheet I am just passing in

  merchantDisplayName: 'Company name',
  allowsDelayedPaymentMethods: true,
  customerEphemeralKeySecret: 'ephkey_45678```
#

Can you try this again in your app and print out the payment intent ID before you send the client secret to your app? I am wondering if a PI that only has cards is somehow getting used instead