stripe / stripe-ios

Stripe iOS SDK
https://stripe.com
MIT License
2.09k stars 976 forks source link

Cant get STPCardParams and can't delete cards #504

Closed welove closed 7 years ago

welove commented 7 years ago

Hi, i'm feeling desperate here! been around this for hours and can't figure out your SDK.

i'm trying to sync the customer cards from the iOS app to their Stripe account as they add them. i have the following:

func paymentContextDidChange(_ paymentContext: STPPaymentContext) {
        if paymentContext.paymentMethods != nil {
            for card in paymentContext.paymentMethods! {
                if let theCard:STPCardParams = card as? STPCardParams {
                    STPAPIClient.shared().createToken(withCard: theCard, completion: { (token, error) -> Void in
                        if let error = error  {
                            print(error)
                        } else if let token = token {
                            print(token)
                        }
                    })
                }
            }
        }
    }

HOW, do i get STPCardParams so i can create the token afterwords? Your documentation doesn't explain nothing of this.

Also, how does the user deletes a card at PaymentMethodsViewController?

jack-stripe commented 7 years ago

@welove - you shouldn't do this in your STPPaymentContextDelegate; you should do it in the STPBackendAPIAdapter that you give to your payment context: https://stripe.github.io/stripe-ios/docs/Protocols/STPBackendAPIAdapter.html#/c:objc(pl)STPBackendAPIAdapter(im)attachSourceToCustomer:completion:

welove commented 7 years ago

Perfect! It was right in front of me. Thank you. Got it all working now 👍

matt-shepherd commented 7 years ago

Sorry to bump a close issue but the second question about a user deleting a card from their previously used cards wasn't answered.

Is it possible?

bdorfman-stripe commented 7 years ago

Users can't currently delete a card from your added cards if you are using just our pre-built screens, sorry. You would have to make the necessary Stripe api calls directly.

amyworrall commented 7 years ago

Do you know if deleting a card via the prebuilt screens is on the roadmap?

danielgomezrico commented 6 years ago

@amyworrall any plans now on it?

danj-stripe commented 6 years ago

@caipivara Yes, the STPPaymentMethodsViewController allows your users to remove saved payment methods. You can try it out in the sample app if you'd like.

Once there's more than one payment method, the Edit button appears:

screen shot 2018-03-27 at 11 11 19 am

It then uses standard UITableView controls for deleting rows:

screen shot 2018-03-27 at 11 15 12 am screen shot 2018-03-27 at 11 11 35 am

Users can also just swipe to delete/remove

danielgomezrico commented 6 years ago

great, it works excelente, thanks

On Tue, Mar 27, 2018 at 3:16 PM, Dan Jackson notifications@github.com wrote:

@caipivara https://github.com/caipivara Yes, the STPPaymentMethodsViewController allows your users to remove saved payment methods. You can try it out in the sample app if you'd like.

Once there's more than one payment method, the Edit button appears: [image: screen shot 2018-03-27 at 11 11 19 am] https://user-images.githubusercontent.com/30532866/37986294-f157c01c-31af-11e8-82d9-a882b4cec952.png

It then uses standard UITableView controls for deleting rows: [image: screen shot 2018-03-27 at 11 15 12 am] https://user-images.githubusercontent.com/30532866/37986390-2ace6698-31b0-11e8-9a24-7aa80496ae98.png [image: screen shot 2018-03-27 at 11 11 35 am] https://user-images.githubusercontent.com/30532866/37986299-f47a6ea2-31af-11e8-8948-a58407156285.png

Users can also just swipe to delete/remove

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/stripe/stripe-ios/issues/504#issuecomment-376623990, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEqPKChtTCj0A962k2_O0e_mGrekMU5ks5tioIFgaJpZM4K0Zae .

--

Daniel Gómez Rico

lmendezk9 commented 6 years ago

@danj-stripe How can I enable the edit button? I'm implementing stripe in my app but with your api I wanted to know how I can enable the edit button in the view of adding credit cards

danj-stripe commented 6 years ago

Hi @lmendezk9,

You can write into Stripe support at https://support.stripe.com/email/login and they'll be happy to help you integrate Stripe into your application & work through any issues.

You can also look at our sample applications in this github repo for examples of how to integrate.

Thanks, Dan