Create Payment Link

Create a new payment link on your Terraswitch account.

POST {{ BASE_URL }}/v1/corporate/payment

Body Parameters

Property
Data Type
Description
Example
Required

name

string

The name of the payment link

"Donation Request"

Yes

feature

string

The feature type of the payment link. This can either be request, product or invoice

"request"

Yes

type

string

Specifies the amount type of the payment link. Can be fixed or dynamic

"fixed"

Yes

amount

number

Amount of required for the payment link. This should be set if type is fixed

1000.99

Only if type is fixed

redirectUrl

string

Preferred payment link redirect url. Customers will be redirected to this link on payment success or failure.

""

No

message

string

Success message after a successful payment.

"Thank you for your payment"

No

slug

string

Customize your payment link url with the payment link slug. This should be unique and does not accept spaces or special characters

"donation-request"

Yes

description

string

Describe the payment link and its purpose.

"For donation"

No

splits

array

An array of strings that holds subaccount codes if you plan to split the payment.

[ "VSA_6yhyzzkcHc" ]

No

import Axios from 'axios';

// set the api url
const API_URL = `${BASE_URL}/v1/corporate/subaccount`;

// define request body
const data = {
  name: "Donation Request",
  feature: "product",
  type: "fixed",
  amount: 1000,
  redirectUrl: "",
  message: "Thank you for your payment",
  slug: "donation-request",
  description: "Request link for church donation",
  splits: ["SUB6789", "8GH37"]
}

// 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)
})

Last updated