Stripe, registration and cancellation problem

I uploaded the code suggested by @john in this post:

I noticed that $ 50 is shown as $ 5, I don’t know what kind of problem it is, so I’ll show you some screens.



Regarding the deletion problem, I deleted all the stripe test data, and now I want to delete the user from ghost, I get this error:

Resource not found error, cannot delete member. Resource could not be found.

I don’t know what kind of passage I did, but in live could it happen to register several times with the same account? what problems may arise?

I noticed that 50 is shown as 5, I don’t know what kind of problem it is, so I’ll show you some screens.

Can you try replacing the foreach in that snippet with:

                        {{#foreach @member.subscriptions}}

                        <ul id="{{id}}"> <!-- Update this -->
                            <li><strong>Plan:</strong> Early adopter — $<span class="plan-price">0</span>/{{plan.interval}}</li>
                            <li><strong>Card:</strong> **** **** **** {{default_payment_card_last4}}</li>
                            <li><strong>Renews:</strong> {{date current_period_end format="DD MMM YYYY"}}</li>
                        </ul>

                        {{#contentFor "scripts"}}
                        <script>
                            $(document).ready(function () {
                                var planAmount = {{plan.amount}} / 100;
                                $("#{{id}} .plan-price").html(planAmount); // Update this
                            });
                        </script>
                        {{/contentFor}}

                        {{/foreach}}

Regarding the deletion problem, I deleted all the stripe test data, and now I want to delete the user from ghost, I get this error:

Did you have your webhooks set up and configured? Sounds like possibly Ghost tried to delete the stripe subscription but it was already gone maybe :thinking: Do you have the server side logs from this?

In future - when you delete a member, it will cancel all of their subscriptions - I think we could improve the error message though if that is the case.

but in live could it happen to register several times with the same account? what problems may arise?

Yes it is possible, if your signup flow is payment first, rather than signup followed by payment. Once the payment succeeds we attach it to the member in Ghost. This would be a decision made by the user to make multiple subscription payments through Stripe Checkout.

The subscriptions can be cancelled individually however :relaxed:

Well, it seems correct thanks.

I think the webhooks are well configured, if I try to register as a new user and pay I don’t see any kind of error.
I definitely deleted all the data from the stripe, and then tried to delete the user from Ghost.
The user is still on Ghost and I can’t delete it.

Server side error /var/log/nginx:

46....- - [05/Dec/2019:11:03:02 +0100] "DELETE /ghost/api/v3/admin/members/5db4663a711e9a744d628a46/ HTTP/2.0" 404 251 "https://domain.it/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"

../ghost/...production.log:

{"name":"Log","hostname":"domain","pid":1209,"level":30,"req":{"meta":{"requestId":"c794fcec-d7c9-48c5-9760-7a04aad3ecda","userId":"1"},"url":"/members/5db4663a711e9a744d628a46/","method":"DELETE","originalUrl":"/ghost/api/v3/admin/members/5db4663a711e9a744d628a46/","params":{},"headers":{"x-forwarded-for":"ADDRESS_IP","x-forwarded-proto":"https","x-real-ip":"ADDRESS_IP","host":"domain.it","connection":"close","origin":"https://domain.it","app-pragma":"no-cache","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36","content-type":"application/json; charset=UTF-8","accept":"application/json, text/javascript, */*; q=0.01","x-requested-with":"XMLHttpRequest","x-ghost-version":"3.1","sec-fetch-site":"same-origin","sec-fetch-mode":"cors","referer":"https://domain.it/","accept-encoding":"gzip, deflate, br","accept-language":"it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7","cookie":"**REDACTED**"},"query":{}},"res":{"_headers":{"x-powered-by":"Express","cache-control":"no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0","access-control-allow-origin":"https://domain.it","vary":"Origin, Accept-Encoding","content-type":"application/json; charset=utf-8","content-length":"251","etag":"W/\"fb-K5OYE9I3vK4b3Fo9yuVlyzX4jaw\""},"statusCode":404,"responseTime":"288ms"},"msg":"","time":"2019-12-05T10:09:59.343Z","v":0}

Ghost admin:
Resource not found error, cannot delete member. Resource could not be found.