Function
createCustomerPortalUrl
({
customerExternalId,
requestUrl,
}: CreateCheckoutUrlParams)
Source from the content-addressed store, hash-verified
| 69 | }; |
| 70 | |
| 71 | export async function createCustomerPortalUrl({ |
| 72 | customerExternalId, |
| 73 | requestUrl, |
| 74 | }: CreateCheckoutUrlParams) { |
| 75 | const result = await polar.customerSessions.create({ |
| 76 | externalCustomerId: customerExternalId, |
| 77 | returnUrl: new URL("/billing/success", requestUrl).toString(), |
| 78 | }); |
| 79 | |
| 80 | return result.customerPortalUrl; |
| 81 | }; |
| 82 | |
| 83 | export async function getAvailableCreditsBalance(customerExternalId: string) { |
| 84 | try { |
Tested by
no test coverage detected