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. Refunds

Create Refund

Create a refund on a transaction

POST {{ BASE_URL }}/v1/corporate/refund

Body Parameters

Property
Data Type
Description
Example
Required

reference

string

The transaction reference

"VPX014ba225-00914672"

Yes

option

string

The reund option type. This can be instant or request

"instant"

Yes

reason

string

The reason for refund

"Quick refund"

Yes

type

string

The type of refund. This can be full or partial

"full"

Yes

amount

number

amount to be refunded

100

Only if refund type is partial

bank

object

An object that hold bank details if refund type is instant

N/A

Only if refund type is instant

bank.accountNo

string

Bank account number to refund to

"0252872742"

Yes

bank.bankCode

string

Bank sort code to refund to. Get sort code from the List Banks endpoint

"058"

Yes

pin

string

Your 4-digit transaction pin

"0000"

Yes

import Axios from 'axios';

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

// define request data
const data = {
    reference: "VPX65f83c03-c11c4e54",
    option: "instant",
    reason: "Transaction was successful but needs to be refunded",
    type: "full",
    amount: 0,
    bank: {
        accountNo: "0252872742",
        bankCode: "058"
    },
    pin: "3662"
}
// 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": {
        "code": "VPF-19a0a4fc",
        "amount": 1000,
        "option": "instant",
        "reason": "Transaction was successful but needs to be refunded",
        "status": "pending",
        "type": "full",
        "paidAt": {
            "day": "2024-01-14",
            "time": "07:12:13",
            "ISO": "2024-01-14T07:12:13.356Z"
        },
        "bank": {
            "accountNo": "0252872742",
            "accountName": "AGBELEYE OLUWATOBI EMMANUEL",
            "bankCode": "058",
            "legalName": "Guaranty Trust Bank",
            "name": "guaranty"
        },
        "createdAt": "2024-01-14T07:12:12.721Z",
        "updatedAt": "2024-01-14T07:12:13.360Z",
        "transaction": {
            "reference": "VPX0c94e97c-b5534eaf",
            "amount": 1000,
            "fee": 100,
            "feature": "wallet-transfer",
            "createdAt": "2024-01-12T20:23:59.787Z"
        }
    },
    "message": "successful",
    "status": 200
}
PreviousFetch RefundNextBills Payment

Last updated 5 months ago