Step by step:
1. Go to admin magento 2. Navigate to Sales > Orders.
2. Click "Create new order" button. Select an existing customer.
3. Add products. Fill in the Shipping and Billing addresses.
4. Add a new payment method (credit card). Check "Save card on customer".
5. Complete the order by submitting it.
6. On the frontend, log in as the customer from step 2.
7. Navigate to My Account > Stored Payment Methods.
8. Actual result: The new card is not saved in the "Stored Payment Methods" section.
9. Expected result: The new card should be saved in the "Stored Payment Methods" section.
Environment: Magento EE 2.4.6-p3 + stripe/module-payments 4.0.10
FIXED: StripeIntegration/Payments/Helper/Generic.php
public function assignPaymentData($payment, $data)
{
$this->resetPaymentData($payment);
if ($this->isMultiShipping())
{
$payment->setAdditionalInformation("payment_location", "Multishipping checkout");
}
else if ($this->isAdmin())
{
$payment->setAdditionalInformation("payment_location", "Admin area");
/**
* The card is not being saved for the user after placing an order in Magento
* $data = {"payment_method":"pm_1Q0xfP2MVsduPvSkD8t4bjfw","save_payment_method":"on"}
*/
if (isset($data['save_payment_method'])) {
$payment->setAdditionalInformation("save_payment_method", $data['save_payment_method']);
}
}