Terraswitch
  • Terraswitch - Get Started
  • Test & Live Environments
  • Onboarding as a Business
  • GUIDES
    • 🎾Authentication
    • 🧀Webhooks
    • 🫓Status & Responses
    • 🏉API Rate Limits
    • 🚀Transactions & Destinations
    • 🍊Testing Credentials
    • 🚐Crafting Metadata
  • API ENDPOINTS
    • Account
      • Get Account Details
      • Get Banks
      • Get Beneficiaries
      • Add Bank
      • Change Settlement Bank
    • Wallet
      • Get Wallet Details
      • Get Wallet Transactions
    • Collections
      • Checkout
        • Initialize Transaction
      • Transfer
        • Generate Account
      • Charge
        • Create Charge
        • Authorize Charge
        • Charge Authorization
      • Bank
        • Pay with Opay
    • Payout
      • Bank Transfer
      • Withdraw Money
    • Products
      • List Products
      • Search Products
      • Filter Products
      • Fetch Product
      • Create Product
      • Update Product
    • Subaccounts
      • List Subaccounts
      • Search Subaccounts
      • Filter Subaccounts
      • Fetch Subaccount
      • Create Subaccount
      • Update Subaccount
    • Payment Links
      • List Payment Links
      • List Payment Link Transactions
      • Search Payment Links
      • Filter Payment Links
      • Fetch Payment Link
      • Create Payment Link
      • Update Payment Link
      • Attach Payment Resource
      • Remove Subaccount
      • Enable Payment Link
      • Disable Payment Link
    • Invoices
      • List Invoices
      • Search Invoices
      • Filter Invoices
      • Fetch Invoice
      • Create Invoice
      • Update Invoice
      • Remove Invoice Item
    • Transactions
      • List Transactions
      • Search Transactions
      • Filter Transactions
      • Verify Transaction
    • Refunds
      • List Refunds
      • Fetch Refund
      • Create Refund
    • Bills Payment
      • List Mobile Networks
      • List Bill Categories
      • List Bill Sub-Categories
      • List Mobile Data Plans
      • Validate Biller
      • Validate Bill Status
      • Validate Top-Up Status
      • Buy Airtime
      • Buy Data
      • Pay Bill
    • Resources
      • List Banks
      • List Countries
      • Resolve Bank Account
Powered by GitBook
On this page
  1. API ENDPOINTS
  2. Payment Links

Attach Payment Resource

Update an existing payment link on your Terraswitch account.

PUT {{ BASE_URL }}/v1/corporate/payment-resource/{{slug}}

You can only attach a resource ( i.e. product or invoice ) to a payment link if the feature of the payment link is product or invoice

Body Parameters

Property
Data Type
Description
Example
Required

type

string

The type of resource to attach. This can be product or invoice

"product"

Yes

code

string

The code of the resource to attach. This can be the product code or the invoice code

"TSDLASTXD"

Yes

import Axios from 'axios';

// set the api url
const API_URL = `${BASE_URL}/v1/corporate/payment-resource/${slug}`;

// define request body
const data = {
  type: "product",
  code: "VPDLASTXD"
}

// make request using axios
Axios({
    method: "POST",
    url: `${API_URL}`,
    headers: {
        lg: 'en',
        ch: 'web'
        Authorization: `Bearer ${API_KEY}`,
        'Content-Type': 'application/json',
    },
    data: data
}).then((resp) => {
    console.log(resp)
}).catch((err) => {
    console.log(err)
})
{
    "error": false,
    "errors": [],
    "data": {
        "name": "Donation Request",
        "slug": "donation-request",
        "link": "https://staging-web.terraswitch.com/link/donation-request",
        "qrcode": "https://storage.googleapis.com/concreap-buckets/qrcode-fb85107d",
        "redirectUrl": "",
        "feature": "product",
        "type": "fixed",
        "isEnabled": false,
        "message": "Thank you for your payment",
        "description": "Request link for church donation",
        "amount": 3500.99,
        "totalAmount": 0,
        "createdAt": "2024-01-20T08:39:25.842Z",
        "updatedAt": "2024-01-20T08:57:32.676Z",
        "options": {
            "card": true,
            "transfer": true,
            "bank": false,
            "ussd": false,
            "bankQR": false
        }
    },
    "message": "successful",
    "status": 200
}

Please note that the amount of the resource ( Product or Invoice ) you attach to a payment link overrides the default amount ( if already set ) of the payment link.

PreviousUpdate Payment LinkNextRemove Subaccount

Last updated 5 months ago