Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,58 @@
|
||||
import type Stripe from "stripe";
|
||||
import { getStripeClient } from "~/utils/stripe.server";
|
||||
|
||||
const stripe = new Proxy({} as Stripe, {
|
||||
get(_target, property, receiver) {
|
||||
return Reflect.get(getStripeClient(), property, receiver);
|
||||
},
|
||||
});
|
||||
|
||||
async function getStripeAccount(id: string) {
|
||||
return await stripe.accounts.retrieve(id);
|
||||
}
|
||||
|
||||
async function createStripeAccount({ email, country, metadata }: { email: string; country: string; metadata?: { [key: string]: string | number } }) {
|
||||
return await stripe.accounts.create({
|
||||
type: "standard",
|
||||
email,
|
||||
country,
|
||||
// capabilities: {
|
||||
// card_payments: {
|
||||
// requested: true,
|
||||
// },
|
||||
// transfers: {
|
||||
// requested: true,
|
||||
// },
|
||||
// },
|
||||
metadata,
|
||||
});
|
||||
}
|
||||
|
||||
async function createStripeAccountLink({ account, refresh_url, return_url }: { account: string; refresh_url: string; return_url: string }) {
|
||||
return await stripe.accountLinks.create({
|
||||
account,
|
||||
refresh_url,
|
||||
return_url,
|
||||
type: "account_onboarding",
|
||||
});
|
||||
}
|
||||
|
||||
async function deleteStripeAccount(id: string) {
|
||||
return await stripe.accounts.del(id);
|
||||
}
|
||||
|
||||
async function getStripeAccountProducts(id: string) {
|
||||
return (
|
||||
await stripe.products.list({
|
||||
stripeAccount: id,
|
||||
})
|
||||
).data;
|
||||
}
|
||||
|
||||
export default {
|
||||
getStripeAccount,
|
||||
createStripeAccount,
|
||||
createStripeAccountLink,
|
||||
deleteStripeAccount,
|
||||
getStripeAccountProducts,
|
||||
};
|
||||
Reference in new issue
Block a user