Get Checkout Link

Endpoint:

https://merchant.payervault.com/api/v1/integration-link/:customer_id

Method:

Description:

This API endpoint retrieves the URL for the checkout page associated with the specified customer's cart. It fetches the cart details from the database based on the provided customer ID and returns the URL for the checkout page.

Path Parameter:

customer_id string required

A unique ID of the customer.

Authentication

This endpoint requires authentication using an accessKey and accessSecret. These credentials need to be included in the request headers for authorization.

Request Header:

accessKey :Access key for authentication
accessSecret : Access secret for authentication.

Response:

  • Success Response:
    • Status Code: 200
    • Content Type: JSON
    • Response Body: An object containing the URL for the checkout page.
  • Error Response:
    • Status Code: 404 (Not Found) or 500 (Internal Server Error)
    • Content Type: JSON
    • Response Body: An error message explaining the issue encountered.

Sample Usage:

// Sample Request Headers
accessKey: your-access-key
accessSecret: your-access-secret

// Sample Request
GET /api/v1/integration-link/customer-id-123

// Sample Response (Success)
{
  "url": "<https://<url>/integration/checkout/34lskdfjlkasd34343"
}

// Sample Response (Error)
{
  "message": "No products in cart"
}

Notes:

  • This endpoint requires authentication with an access key and access secret provided in the request headers.
  • The cart details are fetched based on the user's ID, live status, and the provided customer ID.
  • If the cart contains products, the URL for the checkout page is returned.

Here are examples of how you can make requests to the '/api/v1/integration-link/(customer_id)' endpoint using different programming languages:

cURL (Command Line)

curl -X GET \\
  -H "accessKey: your-access-key" \\
  -H "accessSecret: your-access-secret" \\
  <https://merchant.payervault.com/api/v1/integration-link/customer-id-123>

JavaScript (Using fetch)

fetch('<https://merchant.payervault.com/api/v1/integration-link/customer-id-123>', {
  method: 'GET',
  headers: {
    'accessKey': 'your-access-key',
    'accessSecret': 'your-access-secret'
  }
})
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

Python (Using requests)

import requests

url = '<https://merchant.payervault.com/api/v1/integration-link/customer-id-123>'
headers = {
    'accessKey': 'your-access-key',
    'accessSecret': 'your-access-secret'
}

response = requests.get(url, headers=headers)
data = response.json()
print(data)

Node.js (Using axios)

const axios = require('axios');

const url = '<https://merchant.payervault.com/api/v1/integration-link/customer-id-123>';
const headers = {
  'accessKey': 'your-access-key',
  'accessSecret': 'your-access-secret'
};

axios.get(url, { headers })
  .then(response => console.log(response.data))
  .catch(error => console.error('Error:', error));

These examples demonstrate how to make a request to the /api/v1/integration-link/(customer_id) endpoint in various languages, passing the required 'accessKey' and 'accessSecret' headers for authentication.