Skip to main content
All CollectionsProduct
How to Integrate Payment Link in My Checkout Flow
How to Integrate Payment Link in My Checkout Flow
Rey avatar
Written by Rey
Updated over a month ago

Integrating Payment Links into your checkout flow provides a seamless, no-code payment solution that allows businesses to accept payments effortlessly. A Payment Link is a shareable URL that directs customers to a secure checkout page, enabling them to complete their purchase without requiring custom-built payment infrastructure.

For a more detailed guide on Payment Links, visit our support article:
πŸ”— Payment Link Guide


Key Components for Integrating Payment Links

To generate a Payment Link within your checkout flow, you need to work with three essential components:

1. Creating a Product Object

A Product in SpherePay represents an item or service that you are selling. You first need to create a product in SpherePay before associating it with a price.

πŸ“Œ API Reference: SpherePay Product API

Example Request to Create a Product:

POST https://api.spherepay.co/v2/product
{
"name": "Premium Subscription",
"description": "Access to exclusive content",
"metadata": {
"category": "Subscription"
}
}

2. Creating a Price Object

A Price determines how much a product costs and in what currency. It is directly linked to a Product and can support various pricing models, including one-time payments and subscriptions.

πŸ“Œ API Reference: SpherePay Price API

Example Request to Create a Price:

POST https://api.spherepay.co/v2/price
{
"product": "product_id",
"currency": "USD",
"amount": 1000,
"billingScheme": "per_unit"
}

Note: Replace "product_id" with the actual ID of the product you created.


3. Creating a Payment Link

Once you have the Product and Price set up, you can use the Price ID to generate a Payment Link. This link will take customers to a checkout page where they can complete their payment.

πŸ“Œ API Reference: SpherePay Payment Link API

Example Request to Create a Payment Link:

POST https://api.spherepay.co/v2/paymentLink
{
"priceId": "price_id",
"successUrl": "https://yourwebsite.com/success",
"cancelUrl": "https://yourwebsite.com/cancel"
}

After making the request, the API response will return a URL. You can then redirect the customer to this Payment Link to complete their purchase.


How Product and Price Works

The Product and Price structure in SpherePay is designed to give businesses flexibility in how they sell goods and services. A Product serves as the foundational object, while a Price determines the associated cost.

For a deeper understanding, refer to [How Product and Price Works]


Final Thoughts

Integrating Payment Links in your checkout flow simplifies the payment process, making it easier for businesses to accept payments without complex development work. By leveraging SpherePay’s API, you can create a smooth and secure payment experience for your customers.

πŸš€ Start integrating today and streamline your checkout flow with SpherePay Payment Links!

Did this answer your question?