You can use the APIs below to interface with Xendit's PaymentMethod
API.
To start using the API, you need to destruct instantiated Xendit client or directly import the module and set the secret key.
import { Xendit , PaymentMethod as PaymentMethodClient } from 'xendit-node' ;
const xenditClient = new Xendit ( { secretKey : YOUR_SECRET_KEY } )
const { PaymentMethod } = xenditClient
const xenditPaymentMethodClient = new PaymentMethodClient ( { secretKey : YOUR_SECRET_KEY } )
// At this point, `PaymentMethod` and `xenditPaymentMethodClient` will have no usage difference, for example:
// PaymentMethod.
// or
// xenditPaymentMethodClient.
Validate a payment method's linking OTP
Request Parameters — AuthPaymentMethodRequest
import { PaymentMethod } from 'xendit-node/payment_method/models'
const response : PaymentMethod = await xenditPaymentMethodClient . authPaymentMethod ( {
paymentMethodId : "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" ,
} )
Request Parameters — CreatePaymentMethodRequest
Account linking for E-Wallet
import { PaymentMethodParameters , PaymentMethod } from 'xendit-node/payment_method/models'
const data : PaymentMethodParameters = {
"ewallet" : {
"channelProperties" : {
"failureReturnUrl" : "https://redirect.me/failure" ,
"successReturnUrl" : "https://redirect.me/success" ,
"cancelReturnUrl" : "https://redirect.me/cancel"
} ,
"channelCode" : "OVO"
} ,
"metadata" : {
"sku" : "example-1234"
} ,
"reusability" : "MULTIPLE_USE" ,
"type" : "EWALLET" ,
"customer" : {
"type" : "INDIVIDUAL" ,
"referenceId" : "customer-123" ,
"individualDetail" : {
"surname" : "Doe" ,
"givenNames" : "John"
}
}
}
const response : PaymentMethod = await xenditPaymentMethodClient . createPaymentMethod ( {
data
} )
Account linking for PH Direct Debit
import { PaymentMethodParameters , PaymentMethod } from 'xendit-node/payment_method/models'
const data : PaymentMethodParameters = {
"mobileNumber" : 628774494404 ,
"reusability" : "MULTIPLE_USE" ,
"type" : "DIRECT_DEBIT" ,
"directDebit" : {
"channelProperties" : {
"failureReturnUrl" : "https://redirect.me/failure" ,
"successReturnUrl" : "https://redirect.me/success"
} ,
"channelCode" : "BPI"
} ,
"email" : "[email protected] " ,
"customer" : {
"type" : "INDIVIDUAL" ,
"referenceId" : "customer-123" ,
"individualDetail" : {
"surname" : "Doe" ,
"givenNames" : "John"
}
}
}
const response : PaymentMethod = await xenditPaymentMethodClient . createPaymentMethod ( {
data
} )
Request Parameters — ExpirePaymentMethodRequest
import { PaymentMethod } from 'xendit-node/payment_method/models'
const response : PaymentMethod = await xenditPaymentMethodClient . expirePaymentMethod ( {
paymentMethodId : "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" ,
} )
Get all payment methods by filters
Request Parameters — GetAllPaymentMethodsRequest
import { PaymentMethodList } from 'xendit-node/payment_method/models'
const response : PaymentMethodList = await xenditPaymentMethodClient . getAllPaymentMethods ( { } )
Request Parameters — GetPaymentMethodByIDRequest
Field Name
Required
Type
paymentMethodId
✅
string
idempotencyKey
string
import { PaymentMethod } from 'xendit-node/payment_method/models'
const response : PaymentMethod = await xenditPaymentMethodClient . getPaymentMethodByID ( {
paymentMethodId : "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" ,
} )
Returns payments with matching PaymentMethodID.
Request Parameters — GetPaymentsByPaymentMethodIdRequest
Field Name
Required
Type
paymentMethodId
✅
string
paymentRequestId
[]string
paymentMethodId2
[]string
referenceId
[]string
paymentMethodType
[]PaymentMethodType
channelCode
[]string
status
[]string
currency
[]string
createdGte
Date
createdLte
Date
updatedGte
Date
updatedLte
Date
limit
number
idempotencyKey
string
import { } from 'xendit-node/payment_method/models'
const response : object = await xenditPaymentMethodClient . getPaymentsByPaymentMethodId ( {
paymentMethodId : "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" ,
} )
Request Parameters — PatchPaymentMethodRequest
import { PaymentMethod } from 'xendit-node/payment_method/models'
const response : PaymentMethod = await xenditPaymentMethodClient . patchPaymentMethod ( {
paymentMethodId : "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" ,
} )
Makes payment with matching PaymentMethodID.
Request Parameters — SimulatePaymentOperationRequest
import { } from 'xendit-node/payment_method/models'
const response : = await xenditPaymentMethodClient . simulatePayment ( {
paymentMethodId : "pm-1fdaf346-dd2e-4b6c-b938-124c7167a822" ,
} )