craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
217 stars 170 forks source link

[4.x]: Payment source is not associated to the order #3099

Closed goraxan closed 1 year ago

goraxan commented 1 year ago

What happened?

Description

When paying, the payment source is saved correctly when using the savePaymentSource in the paymentsources table but the paymentSourceId column from the orders table is not populated, so I'm not able to know which payment source is used to which order.

This is the request to commerce/payments/pay controller image

The paymentsource correctly created image

The order not being updated correctly (both gatewayId and paymentSourceId are NULL) image

Craft CMS version

4.3.6.1

Craft Commerce version

4.2.4

PHP version

8.0.26

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

-

pdaleramirez commented 1 year ago

@goraxan That is the expected value for that paymentSourceId column. The attribute on the order is used just during the payment process.

More details: https://github.com/craftcms/commerce/blob/develop/src/elements/Order.php#L1611-L1614

We’ll be looking into saving the paymentSourceId in the transaction table In future releases.

goraxan commented 1 year ago

@pdaleramirez oh, I see. Associating it to the transaction instead of the order makes sense, thank you!