woocommerce / woocommerce-ios

WooCommerce iOS app
https://www.woocommerce.com/mobile
GNU General Public License v2.0
314 stars 113 forks source link

Send `ipp_channel` metadata in payment intent from store management/POS use cases #14479

Open jaclync opened 1 day ago

jaclync commented 1 day ago

Closes: #14478

Why

As we are launching POS to external merchants soon, we want to identify if a transaction is from POS or IPP in the mobile apps for data analysis purposes.

How

As shared in pdfdoF-5QB-p2 > Apps, we want to add a new metadata ipp_channel: mobile_store_management | mobile_pos to the payment intent from IPP and POS respectively.

I thought about giving the channel parameter a default value of .storeManagement, but I'm afraid that this parameter will be forgotten and be the wrong value if we add more use cases in the future. I'm open to adding a default value if you think it will simplify the code though.

Steps to reproduce

  1. Create a new Jurassic Ninja site – include Jetpack, WooCommerce, WooPayments, and WooPayments Dev Tools
  2. Set up Jetpack to link the site to WPCOM user in the app (or skip this if you're loggin in with site credentials)
  3. Add a US address in WooCommerce settings
  4. Activate WooPayments. Go through the onboarding steps in WP-Admin > Payments > Activate. Alternatively, you can go through the onboarding in the app
  5. Launch the app and switch to your new site
  6. Create a purchasable product
  7. Go to the orders tab. Create an order and collect payment with a card reader --> the payment collection should succeed. after that, verify that the payment intent metadata includes ipp_channel: mobile_store_management in the Stripe account (* check instructions below)
  8. Go to the menu tab > Point of Sale mode. Add product to the cart and pay for the order --> the payment collection should succeed. after that, verify that the payment intent metadata includes ipp_channel: mobile_pos in the Stripe account (* check instructions below)

* How to check the transaction payment intent

Prerequisite: you have access to the WooPayments Stripe account (ask in #payment-operations if not)

Testing information

I also tested with local server-side changes.

Screenshots

Screenshot 2024-11-21 at 2 03 28 PM

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

dangermattic commented 1 day ago
1 Warning
:warning: This PR is assigned to the milestone 21.2. This milestone is due in less than 2 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by :no_entry_sign: Danger

wpmobilebot commented 1 day ago

WooCommerce iOS📲 You can test the changes from this Pull Request in WooCommerce iOS by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS WooCommerce iOS
Build Numberpr14479-339f092
Version21.1
Bundle IDcom.automattic.alpha.woocommerce
Commit339f092f049a77d209efcff262889bc870988b80
App Center BuildWooCommerce - Prototype Builds #11693

Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.