#jtapping-ios-currency
1 messages ยท Page 1 of 1 (latest)
hi - yeah I can try. I don't actually control this VC though, its part of the Stripe integration.
evertything else in the app shows correctly .... just this one view controller.
I'm using the Stripe API's of course
this is a surprisingly difficult question to answer actually. Trying to figure it out!
ha ha:)
i get the impression that its hard coded in the stripe API ... bu that would be strange. Must be an override but I can't find it.
my current guess is it's hard coded on Apple's side based on the country of the shipping address but still digging
ah, it takes the value of the STPPaymentContext.paymentCurrency
paymentContext.paymentSummaryItems = [
PKPaymentSummaryItem(label:"Pay", amount:42.42, type:.final)
];
paymentContext.paymentCurrency = "eur"
if that's what you're using, or do you use a different VC? (your code only shows how you interact with your backend, not which part of the SDK you're using)
Excellent that looks great. Now to look at how to use it. Thankyou
this looks like what I am using
cool!
let me know if there's anything else we can help with or if you're not using the STPPaymentContext
MyAPIClient.sharedClient.createPaymentIntent(products: products, orderReferenceId: orderReferenceId!, shippingMethod: paymentContext.selectedShippingMethod, country: shippingCountry, paymentCurrency = "eur") { result in
looks like I need to do this
looks good thanks agin
well not really, that code is how you call your backend
somewhere in your app you should have something that looks like
self.paymentContext = STPPaymentContext(customerContext: customerContext,
configuration: STPPaymentConfiguration.shared,
theme: theme)
for example
it's in that VC where you are setting this up
it's also where you have added code to define that 3.50 amount
look for didUpdateShippingAddress for example
required init?(coder aDecoder: NSCoder) {
let customerContext = STPCustomerContext(keyProvider: MyAPIClient.sharedClient)
self.paymentContext = STPPaymentContext(customerContext: customerContext)
super.init(coder: aDecoder)
self.paymentContext.delegate = self
paymentContext.hostViewController = self
self.paymentContext.paymentAmount = 5000 // This is in cents, i.e. $50 USD
// MyAPIClient.sharedClient.baseURLString = "https://stripetestsjta.herokuapp.com/"
let config = STPPaymentConfiguration.shared
config.appleMerchantIdentifier = self.appleMerchantID
config.companyName = "QRCode for Wifi"
config.requiredBillingAddressFields = .full
config.requiredShippingAddressFields = [.postalAddress, .emailAddress, .name]
//config.shippingType = settings.shippingType
config.applePayEnabled = true
config.fpxEnabled = false
config.cardScanningEnabled = true
}
yep!
so where you have self.paymentContext.paymentAmount = 5000 there
you want to add a line with self.paymentContext.paymentCurrency="eur"
it defaults to USD if you don't pass a currency
(what the STPPaymentContext shows there is technically separate from what the customer is actually charged by the way, since that's controlled by your PaymentIntent created on the backend, just for clarity)
yes understood