Add/Edit Template

This endpoint is used to add/edit template details for invoice plugin

Method

POST https://api.ninjapay.me/webextension/api/v1/fiat/invoice/user/template/create

Parameters

  • id (number): If need to update template add value here from get template api response

  • template (object): Contains the following properties:

    • business_logo (string): URL of the business logo NOTE: use upload Attachment API response for value

    • business_name (string, required): Name of the business

    • phone (string, required): Contact phone number (without country code)

    • phone_code (string, required): Country code for the phone number

    • email (string, required): Contact email address

    • billing_address (string): Billing address

    • city (string): City of the business

    • state (string): State of the business

    • zipcode (string): Zipcode of the business

    • country (string): Country of the business

    • documents (object): Contains document details:

      • doc_1 (object): First document:

        • title (string): Title of the document

        • value (string): Value of the document

      • doc_2 (object): Second document:

        • title (string): Title of the document

        • value (string): Value of the document

    • default_currency (string): Default currency for transactions

    • enable_qr (boolean): Enable or disable QR code generation

    • redirect_url (string): URL to redirect after payment

    • include_invoice_id (boolean): Include invoice ID in the documentation

    • webhook_url (string): URL for webhook callbacks

    • terms_condition_url (string): URL for terms and conditions

    • custom_thanks_message (string): Custom thank you message

    • custom_button_text (string): Custom text for the payment button

    • green_donation_link (string): URL for green donation link

    • donation_percentage (number): Percentage of donation

    • donation_message (string): Message regarding donations

    • tax_details (object): Contains tax details:

      • tax_title (string): Title for tax

      • tax_percentage (number): Tax percentage

      • tax_country (string): Country where the tax is applicable

      • is_all_states (boolean): If tax is applicable to all states

      • tax_states (array): List of states where tax is applicable (empty if all states)

Request Body

Body (application/json)
{
    "id": "",  // if need to update template add value here from get template api response
    "template": {
        "business_logo": "https://awesomecompany.com",  // URL of the business logo
        "business_name": "Awesome Company",  // Name of the business
        "phone": "234567890",  // Contact phone number (without country code)
        "phone_code": "+1",  // Country code for the phone number
        "email": "sample@gmail.com",  // Contact email address
        "billing_address": "123 Main Street",  // Billing address
        "city": "Hyderabad",  // City of the business
        "state": "Telangana",  // State of the business
        "zipcode": "12345",  // Zipcode of the business
        "country": "USA",  // Country of the business
        "documents": {
            "doc_1": {
                "title": "PAN",  // Title of the document
                "value": "HG297323"  // Value of the document
            },
            "doc_2": {
                "title": "GST",  // Title of the document
                "value": "76YHGF67656"  // Value of the document
            }
        },
        "default_currency": "USD",  // Default currency for transactions
        "enable_qr": true,  // Enable or disable QR code generation
        "redirect_url": "",  // URL to redirect after payment
        "include_invoice_id": true,  // Include invoice ID in the documentation
        "webhook_url": "",  // URL for webhook callbacks
        "terms_condition_url": "https://google.com",  // URL for terms and conditions
        "custom_thanks_message": "Thank you for your payment!",  // Custom thank you message
        "custom_button_text": "",  // Custom text for the payment button
        "green_donation_link": "",  // URL for green donation link
        "donation_percentage": 0.0,  // Percentage of donation
        "donation_message": "",  // Message regarding donations
        "tax_details": {
            "tax_title": "GST",  // Title for tax
            "tax_percentage": 18,  // Tax percentage
            "tax_country": "India",  // Country where the tax is applicable
            "is_all_states": true,  // If tax is applicable to all states
            "tax_states": []  // List of states where tax is applicable (empty if all states)
        }
    }
}

Response

{
    "status": true,
    "data": {},
    "message": "Template changes added successfully"
}

Code Example


const options = {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'API_KEY' //Invoice key required
  },
  body: {
    "id": "",  // if need to update template add value here from get template api response 
    "template": {
        "business_logo": "https://awesomecompany.com",  // URL of the business logo
        "business_name": "Awesome Company",  // Name of the business
        "phone": "234567890",  // Contact phone number (without country code)
        "phone_code": "+1",  // Country code for the phone number
        "email": "sample@gmail.com",  // Contact email address
        "billing_address": "123 Main Street",  // Billing address
        "city": "Hyderabad",  // City of the business
        "state": "Telangana",  // State of the business
        "zipcode": "12345",  // Zipcode of the business
        "country": "USA",  // Country of the business
        "documents": {
            "doc_1": {
                "title": "PAN",  // Title of the document
                "value": "HG297323"  // Value of the document
            },
            "doc_2": {
                "title": "GST",  // Title of the document
                "value": "76YHGF67656"  // Value of the document
            }
        },
        "default_currency": "USD",  // Default currency for transactions
        "enable_qr": true,  // Enable or disable QR code generation
        "redirect_url": "",  // URL to redirect after payment
        "include_invoice_id": true,  // Include invoice ID in the documentation
        "webhook_url": "",  // URL for webhook callbacks
        "terms_condition_url": "https://google.com",  // URL for terms and conditions
        "custom_thanks_message": "Thank you for your payment!",  // Custom thank you message
        "custom_button_text": "",  // Custom text for the payment button
        "green_donation_link": "",  // URL for green donation link
        "donation_percentage": 0.0,  // Percentage of donation
        "donation_message": "",  // Message regarding donations
        "tax_details": {
            "tax_title": "GST",  // Title for tax
            "tax_percentage": 18,  // Tax percentage
            "tax_country": "India",  // Country where the tax is applicable
            "is_all_states": true,  // If tax is applicable to all states
            "tax_states": []  // List of states where tax is applicable (empty if all states)
        }
    }
}
};

fetch('https://api.ninjapay.me/webextension/api/v1/fiat/invoice/user/template/create', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
  

Last updated