until
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
now I want to have both options in but one thing at a time I guess
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
changed the stripe method to payment and used a one off payment stripe product id
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
the rest was the same
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
oh I just added the increment of credits
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
I'm very new at this.
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
I managed to make it work by adding the following
await context.entities.User.update({
where: {
id: context.user.id,
},
data: {
checkoutSessionId: session?.id ?? null,
stripeId: customer.id ?? null,
// Added credits increment here
credits: {
increment: 10,
},
},
});
But I did this by basically replacing the subscription mode :/
Now I need to get both to work ^^
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
no matter what button I click
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
actually not getting any error, it just ignores the one off payment of credits and always redirects to the subscription mode (which works fine)
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
Cant seem to make it work
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
I'll be enabling this:
// action stripeCreditsPayment {
// fn: import { stripeCreditsPayment } from "@server/actions.js",
// entities: [User]
// }
// action updateUser {
// fn: import { updateUser } from "@server/actions.js",
// entities: [User]
// }
Removing "Disabled:True" from this:
{
name: 'Credits',
id: 'credits',
href: '',
price: '$2.95',
description: 'Buy credits to use for your projects.',
features: ['10 credits', 'Use them any time', 'No expiration date'],
disabled: true,
},
and enabling this:
/**
* and here is an example of handling a different type of product
* make sure to configure it in the Stripe dashboard first!
*/
// if (line_items?.data[0]?.price?.id === process.env.CREDITS_PRICE_ID) {
// console.log('Credits purchased: ');
// await context.entities.User.updateMany({
// where: {
// stripeId: userStripeId,
// },
// data: {
// credits: {
// increment: 10,
// },
// },
// });
// }
Also added a one off payment id to the env file as CREDITS_PRICE_ID
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
Ok the payment does change the status of the user to a subscription based planned. Now I will be trying credits
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
Yeah I checked it and the events are showing up. I think I'm going to do a whole new install and go from there
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
Tried a new install, didnt change a thing, users dont get any sort of credit increment
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
Ok almost got it. Changed method to "payment". Credits not incrementing on user though
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
Regarding the following on main.wasp operations:
action stripeCreditsPayment {
fn: import { stripeCreditsPayment } from "@server/actions.js",
entities: [User]
}
Do I need to uncomment this?
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
@Vinny (@Wasp)
I've created a CREDITS_PRICE_ID in the .env file.
I've then replaced subscripton_price_id places with credits_price_id and commented this:
// if (line_items?.data[0]?.price?.id === process.env.SUBSCRIPTION_PRICE_ID) {
// console.log('Subscription purchased ');
// await context.entities.User.updateMany({
// where: {
// stripeId: userStripeId,
// },
// data: {
// hasPaid: true,
// datePaid: new Date(),
// },
// });
// }
Im getting the following console error:
[Server!] Error: You must provide at least one recurring price in
subscription
mode when using prices.
I understand this but I wanted the app to run solely on non-subscription credits.
(I do not mind running a subscription model on the side, just dont want it to be mandatory). What do I have to change?39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
Yeah I've created a few products just unsure on where I configure productID X to be the one that lets the users buy credits on wasp side
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
ended up creating a vm to circumvent this
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
any documentation explaining what exactly I need to configure on Stripe to achieve this? Credits is exactly what I need
39 replies
WWasp
•Created by until on 2/9/2024 in #đŸ™‹questions
Payment for Credits / Credit Balance System
yeah having an issue where it cant install a distro, tried every trick in the book
39 replies