Fixed Stripe not sending callback or upgrading user account

Affected version
2.0.10
Hi,

I was using BDPaygate for Stripe on 1.x, and recently updated to the latest release of XF2 and was happy to see there is now native stripe support.

I've tried to fix this problem on my own, both by dabbling with the code and from other threads that had this issue marked as solved (I read this thread about 5 times).

After correctly re-setting up my endpoint, the first transaction correctly processed and the users account was upgraded, however any transactions since then haven't worked. I can't see why either.



Not only this, but I can't seem to find where to manually upgrade users with the option that was there in XF1.

All help would be appreciated, Stripe is the only platform I trust to accept payments worldwide and my entire network relies upon XenForo payments being registered correctly.

Thank you, XF2 is fantastic and I'm very glad I upgraded, just need to figure this out ASAP.
 
All of a sudden it has started working. I limited which messages Stripe will send to the callback file in the Stripe dashboard to use only relevant ones to what XenForo expects, seemed to have fixed the problem.
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. The issue is now resolved and we are aiming to include that in a future XF release (2.0.11).

Change log:
When handling a Stripe webhook that is missing required metadata, when attempting to find a previous related log, ensure said log actually contains a purchase_request_key.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 

Jonathan Long

Active member
Same issue. Paying for upgrades and they get a message that once the payment is confirmed the account will be upgrading, but then nothing happens.

What is the fix for this?
 

Chris D

XenForo developer
Staff member
It can be fixed with a file edit (you will need to ignore any file health check errors on this file until the next upgrade). Open src/XF/Payment/Stripe.php.

Find:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'transaction_id' => $chargeId
]);

Replace with:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'transaction_id' => $chargeId,
   ['purchase_request_key', '!=', null]
]);

And then find:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'subscriber_id' => $state->subscriberId
]);

And replace with:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'subscriber_id' => $state->subscriberId,
   ['purchase_request_key', '!=', null]
]);
 

Jonathan Long

Active member
It can be fixed with a file edit (you will need to ignore any file health check errors on this file until the next upgrade). Open src/XF/Payment/Stripe.php.

Find:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'transaction_id' => $chargeId
]);

Replace with:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'transaction_id' => $chargeId,
   ['purchase_request_key', '!=', null]
]);

And then find:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'subscriber_id' => $state->subscriberId
]);

And replace with:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'subscriber_id' => $state->subscriberId,
   ['purchase_request_key', '!=', null]
]);

Thank you! đź‘Ť
 

ichpen

Well-known member
It can be fixed with a file edit (you will need to ignore any file health check errors on this file until the next upgrade). Open src/XF/Payment/Stripe.php.

Find:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'transaction_id' => $chargeId
]);

Replace with:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'transaction_id' => $chargeId,
   ['purchase_request_key', '!=', null]
]);

And then find:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'subscriber_id' => $state->subscriberId
]);

And replace with:
PHP:
$providerLog = \XF::em()->findOne('XF:PaymentProviderLog', [
   'provider_id' => $this->providerId,
   'subscriber_id' => $state->subscriberId,
   ['purchase_request_key', '!=', null]
]);

After applying the file edits (and recycling caches) I'm still showing Error: Event data received from Stripe does not contain the expected values. on a subsequent test transaction I ran through Stripe. Not sure if this is intended @Chris D
 
Top