#Suleman Hassan
1 messages ยท Page 1 of 1 (latest)
๐ happy to help
i have a question regarding add card in stripe
i want to add card in stripe using swift
generate the token in stripe but card is not added in stripe account
please remove the other messages from the main channel and we can continue here
removed
are you using your own inputs?
nop
visa card inputs
i want to test card is added or not but card is not added but stripe token generated
are you using Stripe SDK?
yes
are you following this guide?
https://stripe.com/docs/payments/save-and-reuse?platform=ios&ui=payment-sheet
let cardParams = STPCardParams()
cardParams.number = "4242424242424242"
cardParams.expMonth = UInt(11)
cardParams.expYear = UInt(24)
cardParams.cvc = "123"
// self.showSpinner(onView: self.view)
STPAPIClient.shared().createToken(withCard: cardParams) { (token: STPToken?, error: Error?) in
guard let token = token, error == nil else {
return
}
let Token = token.tokenId
print(Token)
}
this is an old API
what I shared is the newer/simpler way of handling collecting a payment method and directly attaching it to a customer
reason of card not added is old API
in all cases what you did here is just what we call a tokenization
once your token is created you need to then attach it to a customer
otherwise it wouldn't show in your dashboard
i can attach information of user as well but not showing the card in stripe dashboard
you need to update the default_source on the customer object https://stripe.com/docs/api/customers/update#update_customer-default_source
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.