stripe/stripe-terminal-ios

`paymentMethod` is returned as `nil` in `collectPaymentMethod` completion block for Tap to pay payments

Closed this issue · 2 comments

Summary

When making a Tap to pay payment using Stripe Terminal SDK for iOS payment_method is being returned as (null) in the result of Terminal.shared.collectPaymentMethod. We need this information to apply different charges for different card types.

This is how we have implemented it (it has been instructed to pass false for updatePaymentIntent for Tap To Pay transaction when create CollectConfiguration)

let collectConfig = CollectConfiguration(skipTipping: true, updatePaymentIntent: false)

paymentCancellable = Terminal.shared.collectPaymentMethod(
                                    paymentIntent,
                                    collectConfig: collectConfig) { result, error in
                                    .
                                    .
                                       <Execution code>

We are retrieving card type information by result.paymentMethod but it is being returned as nil. We need this information as we have different charges for different card types.

Code to reproduce

  • Retrieve secret using your client API
 Terminal.shared.retrievePaymentIntent(clientSecret: secret) { retrieveResult, retrieveError in

                            if let paymentIntent = retrieveResult {
                                
                                let collectConfig = CollectConfiguration(skipTipping: true, updatePaymentIntent: false)
                                
                                Terminal.shared.collectPaymentMethod(
                                    paymentIntent,
                                    collectConfig: collectConfig
                                ) { result, error in
                                    
                                    debugPrint(result?.paymentMethod)
                                }
                                
                            }

result?.paymentMethod is being returned as nil

iOS version

iOS 17.3

Installation method

Cocoapods

SDK version

iOS Stripe Terminal SDK 2.23.2

Other information

If we pass updatePaymentIntent as true in CollectConfiguration(skipTipping: true, updatePaymentIntent: false), paymentMethod is being returned correctly.

Example payment intent printed for Tap To Pay payment

<SCPPaymentIntent>
  - some : <SCPPaymentIntent: 0x282ffa9f0; amount = 10; amount_details = <SCPAmountDetails: 0x2819c1020; tip = <SCPTip: 0x2819c3b20; amount = (null)>>; amount_tip = (null); capture_method = manual; currency = gbp; created = 2023-11-01 10:08:46 +0000; charges = (
); metadata = {
    allowNon3DS2 = false;
    carrierProcessingFee = 0;
    charityUnits = 0;
    deviceId = "C855D065-DC89-47CB-BA06-5B34785F137E";
    discountedFeeUnits = 1;
    discountedVolumeUnits = 10;
    isLopay = true;
    isTerminal = true;
    kycApproved = true;
    latitude = "29.91790771484375";
    longitude = "73.86631248051526";
    ownerId = "e77b283f-ab14-4c99-b001-c9f2034318f4";
    paymentLinkProcessingFee = 0;
    posProcessingFee = 0;
    processingFee = 0;
    remoteIPAddress = "49.36.239.27";
    subscriptionProcessingFee = 0;
    tapOnPhone = true;
    tapToPayProcessingFee = 0;
    taxes = "[{\"inclusive\":true,\"amount\":{\"currencyCode\":\"GBP\",\"units\":2},\"rate\":{\"precision\":10000,\"value\":2000},\"name\":\"VAT (20%)\"},{\"rate\":{\"precision\":10000,\"value\":500},\"inclusive\":true,\"name\":\"VAT (5%)\",\"amount\":{\"units\":1,\"currencyCode\":\"GBP\"}}]";
    tipUnits = 0;
}; offline_details = (null); payment_method = (null); statement_descriptor = IKJOTCREATES; statement_descriptor_suffix = (null); status = requires_confirmation; stripeId = pi_3O7bLuKHV9I0GxFc0aXUbFec>

Hi, unfortunately without using updatePaymentIntent the SDK doesn't post the payment data to the API during collect so retrieving the PaymentIntent after that won't have the payment method, as you're seeing.

it has been instructed to pass false for updatePaymentIntent for Tap To Pay transaction when create CollectConfiguration

updatePaymentIntent is a requirement to get the payment method. So until this is supported there isn't a way to get this information after collect. I'm not sure if there's an expected timeline on when this will be supported but I'll check.

update: the concerns with using updatePaymentIntent: true with Tap to Pay for iPhone have been resolved on the backend and you can now safely use that with version 2.23.2 of the SDK. Apologies that that wasn't communicated before. Closing this out but let us know if anything else needed.