#desga-ios-connect
1 messages · Page 1 of 1 (latest)
hello!
reading one sec
ah could you share with me the Customer ID in the error message, and the ID of the PaymentIntent you are instantiating the PaymentSheet with?
That should give me enough to look into whether you're creating one or the other object on the Platform (instead of the connected account)
customer id: cus_LX1BHdF9DrGNJ5
conected account id: acct_1KjsOUGBMZ74XAwi
ephemeralKeySecret: ek_test_YWNjdF8xSXBkM3pKUlFKaTJhNjBCLHByYzU0Rmlma0hYSU5QZ283Y3NXZUYyNHk2OG5wSHo_00x6AhS7Hq
paymentIntentClientSecret: pi_3Kpx9WGBMZ74XAwi1QjUdhBC_secret_cVpl4eajaMLLFJbovFXCs9fpm
with this params, on android works fine, we don't understand was happend
I think I know, its how stripe-ios manages the STPAPIClient instances, checking
okay, I'll wait for you to tell me
ah found it
your Customer is NOT created on the account acct_1KjsOUGBMZ74XAwi
neither is the EphemeralKey. Both are created on the Platform account.
The PaymentIntent is created on the right connected account, so that is correct.
so you need to create the Customer on the connected account, as well as the Ephemeral Key there too
so, i need to change the backend method. ButI have a doubt, why it works fine in android if the customer id and the ephemeral key are not created correctly?
you're probably doing something different on Android. But right now, if you're creating STPAPIClient authenticated as the connected accounts, then you need to create the Customer also on the connected account.
I have been reviewing the backend code and the information that is in the documentation. To create the customer we have the following method:
private fun createCustomer(email:String?): Customer{
val customerParams = CustomerCreateParams.builder().setEmail(email).build()
val customer = Customer.create(customerParams)
customer.email = email
return customer
}
And this is how we are creating the ephemeral key and the payment intent:
val customer = createCustomer(orderEntity.user?.email)
val ephemeralKeyParams = EphemeralKeyCreateParams.builder()
.setCustomer(customer.id)
.build()
val ephemeralKeyOptions =
RequestOptions.RequestOptionsBuilder()
.setStripeVersionOverride(PaymentStripeConstants.API_VERSION)
.build()
val ephemeralKey = EphemeralKey.create(
ephemeralKeyParams,
ephemeralKeyOptions
)
val requestOptions =
RequestOptions.RequestOptionsBuilder()
.setStripeAccount(stripeInternalIdentifier)
.build()
val paymentIntentParams = PaymentIntentCreateParams.builder()
.setAmount(totalPrice)
.setApplicationFeeAmount(feeAmount)
.addPaymentMethodType("card")
.setCurrency(PaymentStripeConstants.CURRENCY)
.putMetadata(PaymentStripeConstants.ORDER_IDENTIFIER_KEY, orderEntity.identifier)
.build()
val paymentIntent = PaymentIntent.create(paymentIntentParams,requestOptions)
The information sent to the apps is as follows:
customer.id
ephemeralKey.secret
paymentIntent.clientSecret
stripeInternalIdentifier
Do you see something wrong? Thanks in advance
Hi there! Stepping in for @queen yoke, give me a second to cathc up.
Looks like you are passing the Stripe Account header server-side here which is what is needed.... are you logging out that value before passing it in request Options to ensure it is the account ID?
Oh wait.
Sorry, you are only passing the Stripe Account for the PaymentIntent in the above.