docs
How to Integrate

Integration

Create a Customer

First thing to do with out API, is when a new user comes in, or is about to choose a plan that he want to pay in your software, you need to create a customer in our API, so you can create a subscription for him.

In this example we are using axios, however, you just need to make a POST request to our API with the following body:

{
    "email": "customer_email@customer_domain",
    "product": "{your_product_identifier}",
    "successUrl": "https://yourwebsite.com/success",
    "cancelUrl": "https://yourwebsite.com/cancel",
}

Your front-end code would look like

service.js
const baseUrl = "https://www.subscriptionplan.dev/api/v1/project/{projectId}";
const paymentLink = axios.post(baseUrl, body);
💡

Remember to replace the {projectId} with your public project id and {your_product_identifier} with your product identifier.

You should expect a response like this:

{
    "paymentLink": "https://checkout.stripe/pay/..."
}

After receiving the response you can open the link in a new tab, or just navigate the user to the link, so he can finish the payment.

Retrieve a Customer

If you want to retrieve a customer, you can make a GET request to our API with the following URL:

service.js
const customer = await axios
.get("https://www.subscriptionplan.dev/api/v1/project/{projectId}/customers/{customerEmail}");
💡

Remember to replace the {projectId} with your public project id and {customerEmail} with the customer email.

You should expect a response like this:

{
    "email": "customer_email@customer_domain",
    "product": "{your_product_identifier}",
    "status": "ACTIVE" // INCOMPLETE, INCOMPLETE_EXPIRED, TRIALING, ACTIVE, PAST_DUE, CANCELED, UNPAID
}

You are ready to go!