Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to a second checkout on subscriptions with platform tip #587

Merged
merged 7 commits into from
Dec 22, 2023

Conversation

subiabre
Copy link
Member

@subiabre subiabre commented Dec 14, 2023

🎩 What? Why?

This PR fixes the previously undefined behaviour of tips on subscriptions payments. See https://app.asana.com/0/1206149597772083/1206163960878458

Testing

If you choose to do a donation to the platform when paying with a subscription via Stripe, you'll be redirected to a second checkout (for the donation) after the first checkout (for the subscription).

@subiabre subiabre requested a review from davidbeig December 14, 2023 13:40
@subiabre subiabre self-assigned this Dec 14, 2023
@subiabre subiabre changed the title Redirect to a second checkout on subscriptions with donation Redirect to a second checkout on subscriptions with platform tip Dec 14, 2023
'price' => $price->id,
'price' => $this->stripe->prices->create([
'unit_amount' => $invest->amount * 100,
'currency' => 'eur',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change this for the settings field Currency?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this checkout to use the project's currency and the platform tip checkout to use Config currency. This way each checkout matches the payments recipient's (project and platform) currency.

@subiabre subiabre requested a review from davidbeig December 18, 2023 11:26
Copy link
Member

@davidbeig davidbeig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When doing a new invest i found a bug. After paying the first donation, the one that represents the subscription, it will create a new Invest entry. At the end of the process we end with two invests, one with the amount + donation_amount, and another with only the amount, both with valid status.

@davidbeig
Copy link
Member

I belive the problem comes from the StripeSubscriptionController.php

After both invest creation, the controller does not look for a previously created invest based on the metadata of the invest. We should look for it and then update it. When the first donation is correct then we should update the donation_amount to 0, and then when the second payment is correct then return the value.

What do you think? @subiabre

@subiabre subiabre requested a review from davidbeig December 21, 2023 15:32
@subiabre subiabre requested a review from rxnetwalker December 22, 2023 12:42
@subiabre subiabre merged commit e8544e7 into live Dec 22, 2023
3 checks passed
@subiabre subiabre deleted the fix/subscriptions_with_tip branch December 22, 2023 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants