Regular Member
Posts: 481
Registered: ‎05-29-2014
Kudos: 100
Solutions: 7

uCRM 2.14.7 Not Recording First Subscription Payment

So I'm running into an item where when someone sets a Stripe subscription payment it's not recording the payment that happens automatically.  All 3 I've caught were created when the account was overdue but they successfully paid, subscription shows in the CRM but the payment wasn't logged.

 

I confirmed in each situation the json looked clean on the Stripe side.  How can I research this further?  I hadn't seen this behavior with any other version of the tool.

Ubiquiti Employee
Posts: 3,923
Registered: ‎12-10-2015
Kudos: 1380
Solutions: 299

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Hi, thanks for reporting. I would like to discuss some details though:
- so the subscription was successfully created in UCRM and it's also visible on Stripe side
- the payment was created and is visible only on Stripe, right? it's not visible in UCRM

Is this the case? The following payments we created and visible in UCRM? Does this happen for all your clients or only some of them?
Please send us your UCRM version + the export of client log could be helpful (form UCRM's client profile page)
Regular Member
Posts: 481
Registered: ‎05-29-2014
Kudos: 100
Solutions: 7

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Payment was created in uCRM and is also visible in Stripe -  Yes

-Payment was visible only in Stripe - Yes

 

In addition, a few of the people did a one time payment then immediately created a subscription.  This is a common situation and leads to a double payment that I have to back out (been an issue forever).  In this situation the "One Time" recorded but the subscription did now, however did charge in Stripe.

 

This is specific to 2.14.7, I've never seen this behavior in any other version.  I've also found that subscription will record the next time it automatically pays.  It's not everyone this happens to, but does appear to occur more regularly when a subscription is created when the account is overdue.

 

I'm not sure where the client log is, but I'll keep looking.

Ubiquiti Employee
Posts: 3,923
Registered: ‎12-10-2015
Kudos: 1380
Solutions: 299

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Thanks for info. The client's log export is here:

 

Selection_999(341).png

Ubiquiti Employee
Posts: 1,391
Registered: ‎03-21-2016
Kudos: 226
Solutions: 155

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Hello @dballan, we can't reproduce the problem. In UCRM 2.14.7 the first subscription payment always shows up in UCRM for us. We tried this for an empty account, account with unpaid invoice and even an account with overdue invoice and it works every time. Both for custom and linked Stripe subscriptions.

 

Could you please try the following commands to check if the payment is actually in UCRM?

First is to find the info given to UCRM by Stripe for a payment:

sudo docker exec -t ucrm_web_app_1 bash -c 'export PGPASSWORD="${POSTGRES_PASSWORD}" && psql -d "${POSTGRES_DB}" -h "${POSTGRES_HOST}" -p "${POSTGRES_PORT}" -U "${POSTGRES_USER}" -t -c "SELECT payment_stripe_id, client_id, stripe_id, amount, status FROM payment_stripe WHERE stripe_id = '"'"'CHANGE_THIS_TO_STRIPE_ID'"'"';"'

First please replace the "CHANGE_THIS_TO_STRIPE_ID" in the command with payment ID, that you see in Stripe, but not in UCRM. You can get it by opening the payment's detail in your Stripe dashboard, there is a "Payment details" section with the field for ID, it will probably look something like "ch_1E5Z4XLgt7Bmp8JntW4uCsMy"

 

If you get some results from this command, you can then find the actual payment in UCRM database. For example in my testing instance, I am getting the following result:

6 |         1 | ch_1E5Z4XLgt7Bmp8JntW4uCsMy |   1000 | succeeded

The first number (6) can be used to find the payment with the following command:

sudo docker exec -t ucrm_web_app_1 bash -c 'export PGPASSWORD="${POSTGRES_PASSWORD}" && psql -d "${POSTGRES_DB}" -h "${POSTGRES_HOST}" -p "${POSTGRES_PORT}" -U "${POSTGRES_USER}" -t -c "SELECT payment_id, client_id, amount FROM payment WHERE payment_details_id = CHANGE_THIS_TO_ID_FROM_FIRST_STEP AND provider_id = 3;"'

Please replace the "CHANGE_THIS_TO_ID_FROM_FIRST_STEP" in this command to the number you got from the first command (6 in the example).

 

In my testing instance I am getting the following result:

7 |         1 |     10

This means there is a payment with ID 7, it belongs to client with ID 1 and the amount is 10.

 

Please let us know if you get any results from this.

Regular Member
Posts: 481
Registered: ‎05-29-2014
Kudos: 100
Solutions: 7

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Ok I ran it, and it was the manual pay that wasn't credited from Stripe to the CRM.  The autopay was the one that successfully shows.  Using both commands on the subscription payment shows successful through both queries.

 

I think this may be a short term glitch in the transaction between Stripe and my CRM.  I rebooted the server over the maintenance window and have been keeping an eye on any dropped packets, not seeing anything dropped.  I also haven't had to correct any issues in a week or so.

 

I know the manual pay send works, so this was probably just a timing deal or some other glitch between the two that corrected itself.  Thanks for taking a look.

 

 

Regular Member
Posts: 481
Registered: ‎05-29-2014
Kudos: 100
Solutions: 7

Re: uCRM 2.14.7 Not Recording First Subscription Payment

So this happened again, very similar situation.  First payment was a subscription payment which paid in Stripe but has no record in uCRM.  Other subscription payments record, it always appears to be related to the first payment.  

Ubiquiti Employee
Posts: 1,391
Registered: ‎03-21-2016
Kudos: 226
Solutions: 155

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Hello @dballan, could you please check with the commands above again? And if it really was a subscription payment that went missing, can you please check the payment event in your Stripe dashboard to see what was UCRM response for it?

Regular Member
Posts: 481
Registered: ‎05-29-2014
Kudos: 100
Solutions: 7

Re: uCRM 2.14.7 Not Recording First Subscription Payment

So there is absolutely no record of the stripe payment for this customer in the CRM.  

 

 

Result.png

 

Stripe recorded that though, so it made it, the CRM just ignored it or something.  I'm going to PM you the actual API send (since it has some private data).

New Member
Posts: 17
Registered: ‎08-01-2015
Kudos: 1
Solutions: 2

Re: uCRM 2.14.7 Not Recording First Subscription Payment

[ Edited ]

Same problem I'm having.  The stripe subscription payment webhook runs correctly, but it doesn't show up in UCRM.

 

Addendum:

I tried adding another client and subscription payment - and it worked!  It is possibly related to being the first subscription ??

 

BTW, the SQL query above showed nothing when it failed to be put in the database, but found the payment record when it succeeded  :-)

Ubiquiti Employee
Posts: 1,391
Registered: ‎03-21-2016
Kudos: 226
Solutions: 155

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Hello @DennyBoll, UCRM 2.15 stable coming either today or tomorrow will have extended logging for this on UCRM side. As we were never able to reproduce this, it should give us more information about the problem.

Ubiquiti Employee
Posts: 1,391
Registered: ‎03-21-2016
Kudos: 226
Solutions: 155

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Hello @dballan @DennyBoll, UCRM 2.15 with extended logging for Stripe was just released. If this happens again after you've updated to it, please send us the UCRM "prod.log". There should be information about why the payment was ignored.

You can find the log at /home/ucrm/data/ucrm/log/ucrm/app/logs/prod.log

New Member
Posts: 17
Registered: ‎08-01-2015
Kudos: 1
Solutions: 2

Re: uCRM 2.14.7 Not Recording First Subscription Payment

Wow, that was fast :-). I have 2.15 running.  Just ran another test - so far it is working fine.  Only interesting thing is I don't see the stripe webhook in prod.log...  Do I have to turn on something?

Highlighted
Ubiquiti Employee
Posts: 1,391
Registered: ‎03-21-2016
Kudos: 226
Solutions: 155

Re: uCRM 2.14.7 Not Recording First Subscription Payment

@DennyBoll There will be entries only in case UCRM ignores the payment, because it thinks it does not belong to it. If that happens, log entry will be created in the prod.log telling us why it thinks that.