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. Collections
  3. Charge

Authorize Charge

Authorize already created charge on a debit card

POST {{ BASE_URL }}/v1/corporate/authorize-charge

Body Parameters

Property
Data Type
Description
Example
Required

type

string

"pin"

Yes

reference

string

"23456789876CBD"

No

deviceIp

string

IP address of the customer's device or your device

"192.168.206.32"

Yes

authorize

object

The object that holds authorize properties

{...}

Yes

authorize.pin

string

Debit card pin

"1111"

If type is pin

authorize.otp

string

OTP sent to customer

"037895"

If type is otp

authorize.phone

string

Customer's phone number

"08137031202"

If type is phone

authorize.birthday

string

Customer birthday

"1992-01-12"

If type is birthday

import Axios from 'axios';

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

// define request body
const data = {
    type: "pin",
    reference: "TSX64D469F547F04752",
    deviceIp: "",
    authorize: {
      pin: "1111",
      otp: "",
      phone: "",
      birthday: "",
      address: {
        city: "",
        state: "",
        zipCode: "",
        address: ""
      }
    }
}

// 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: {
    status: "successful",
    type: "credit",
    domain: "test",
    reference: "TSXFD77BA471CD84E82",
    merchantRef: "",
    amount: 20,
    fee: 0.2,
    vat: 0.015,
    feature: "payment-link",
    ipAddress: "",
    currency: "NGN",
    description: "incoming payment of NGN20 to Gnik Digitals Limited via payment link",
    vasData: {
      ref: "",
      type: "",
      network: "",
      phoneNumber: "",
      billerCode: "",
      billerName: "",
      hasToken: false,
      token: ""
    },
    metadata: [
      {
        staffId: "002RTOPG",
        department: "engineering"
      }
    ],
    bank: {
      name: "",
      accountName: "",
      accountNo: "",
      bankCode: ""
    },
    customer: {
      firstName: "Oluwatobi",
      lastName: "Immanuel",
      email: "emmabidem@gmail.com",
      phoneNumber: "08137031202",
      phoneCode: "+234",
      city: "",
      state: "",
      accountNo: "",
      sourceAccount: ""
    },
    createdAt: "2024-06-02T01:09:15.582Z",
    updatedAt: "2024-06-02T01:09:26.876Z",
    card: {
      brand: "visa",
      cardBin: "400758",
      cardLast: "9961",
      expiryMonth: "06",
      expiryYear: "27",
      createdAt: "2024-06-01T23:46:15.036Z",
      updatedAt: "2024-06-01T23:53:21.777Z",
      authCode: "TAUTH_MY5NABBW"
    }
  },
  message: "successful",
  status: 200
}
{
  error: false,
  errors: [],
  data: {
    nextStep: "OTP is required",
    displayText: "enter the otp sent to your phone number and/or email",
    status: "pending",
    reference: "TSXA96227AAAB93491B",
    type: "otp",
    path: "send_otp",
    url: "",
    statusCode: 206,
    metadata: {
      reference: "TSXA96227AAAB93491B",
      type: "send_otp"
    }
  },
  message: "OTP is required",
  status: 206
}

Authorization types

Type
Description

pin

Customer's debit card pin

otp

OTP sent to customer's phone/email

phone

Customer's phone number

birthday

Customer's birthday

PreviousCreate ChargeNextCharge Authorization

Last updated 5 months ago

Type of authorization. Check for list of types

Transaction reference returned in

below
charge api