Fixed Stripe product ID not unique per purchasable item

mattrogowski

Well-known member
Licensed customer
Affected version
2.2, 2.3
The Stripe payment handler generates the Product and Plan ID with this:

PHP:
protected function getStripeProductAndPlanId(Purchase $purchase)
{
    return $purchase->purchasableTypeId . '_' . md5(
        $purchase->currency . $purchase->cost . $purchase->lengthAmount . $purchase->lengthUnit
    );
}

However this doesn't differentiate between the entity ID being purchased. For example if you had "User Upgrade 1" and "User Upgrade 2" with the same price and length, it would only create a single Product and Plan in Stripe for whichever one was purchased first, and sales of both upgrades would be attributed to the same Product in Stripe.

It should use $purchase->purchasableId as well to make sure these are unique.
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.10).

Change log:
Include purchasable ID in Stripe product and plan ID generation (#2287)
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom