#harshil-ahir_code

1 messages ¡ Page 1 of 1 (latest)

left novaBOT
#

👋 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/1265536654865858620

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

open sapphire
#

Yes you shouldn't do this at all

#

What do you want to implement? We recommend to use Checkout or Elements, where you let Stripe collect the card for you

pastel crown
#

I have to generate a token for the card and store that token in database and with the help of that i have to show the user that these are the card you have added till now while it was an mobile application

open sapphire
#

If you have the card information (number) in your server, you would need to be PCI compliance. Normally you shouldn't and should avoid the PCI burden

pastel crown
#

So how can i do these ,can these will be done from the frontend side by Android/Ios developer will this will be possible that they can directly save that card and also with the customer id they can show the all cards that can be saved by the user

open sapphire
#

No, Android and iOS should use our official Android SKD or iOS SDK, which securely collect the information for you

pastel crown
#

so how can i show the user multiple card which he have added in the application ,can from Android/iOS i can get token of the card and i will save it in my database and attach that token to customer and with the help of customer i will get all the token and from that i can get the card details

open sapphire
#

No, you let Stripe tokenize the card and give back you a Payment Method Id pm_xxx, alongside with its last4. You can then display last4 for your customer with asterisk (*) before it, and link with the Id

#

PaymentSheet already does it for you (a component within iOS and Android SDK)

pastel crown
#

also i have seen online that there is a functionality of Process payments unsafely in my dashboard and if i enable it then it will work but i am not able to find that funcationality in my dashboard

open sapphire
#

I would recommend staying away from PCI

pastel crown
#

Can you refer the code where i can show all the cards for a specific user for both android and ios

open sapphire
pastel crown
#

okay and how i can take the card for the payment can you reffer that too

pastel crown
open sapphire
#

Okie, you can use PaymentSheet instead which already has built in features for showing customer saved PaymentMethod when creating a new Payment

pastel crown
#

Currently we are using test mode in which the Android developer are using the default option for saving the card details in in the payment information still its not saving the card for the next payment for the same customer

open sapphire
#

Are they (your Android developer) using PaymentSheet? Please provide the request id req_xxx where you create a PaymentIntent for it

pastel crown
#

class StripePaymentHandler(
private val listener: StripePaymentListener,
private val fragment: Fragment
) {

private val paymentSheetResultCallback = PaymentSheetResultCallback {
    when (it) {
        PaymentSheetResult.Completed -> {
            listener.onPaymentSuccess()
        }

        PaymentSheetResult.Canceled -> {
            listener.onPaymentCancelled()
        }

        is PaymentSheetResult.Failed -> {
            listener.onPaymentFailed()
        }
    }
}

private val paymentSheet = PaymentSheet(fragment, paymentSheetResultCallback)

fun initiatePayment(data: InitiatePaymentResponse) {

    println("customer ${data.customerId.toString()}")
    val paymentIntentClientSecret = data.payamentIntenetClientSecretKey
    val customerConfig = PaymentSheet.CustomerConfiguration(
        data.customerId.toString(),
        data.ephemeralKey.toString()
    )


    PaymentConfiguration.init(fragment.requireContext(), data.publishableKey.toString())

    paymentSheet.presentWithPaymentIntent(
        paymentIntentClientSecret = paymentIntentClientSecret.toString(),
        configuration = PaymentSheet.Configuration(
            merchantDisplayName = fragment.requireContext().getString(R.string.app_name),
            customer = customerConfig,
            allowsDelayedPaymentMethods = false
        )
    )
}

}

this is my code how can i send the request id

#

and i have same doubt for ios also

open sapphire