@vmbcarabbacan/telr
v1.0.1
Published
Integrate Telr Hosted Payment and Service API
Downloads
5
Readme
telr-hosted-payment
Integrate Telr Hosted Payment and Service API
Get Started - Telr Documentation
import the file const telr = require('@vmbcarabbacan/telr')
setup the telr store and authkey by
telr.setup({
store: '12345', // Store ID
authkey: 'asjdh12942241', // Authentication Key,
return_auth: 'http://localhost:8081/success', //redirect to this link once payment is successful
return_decl: 'http://localhost:8081/declined', //redirect to this link once payment is declined
return_can: 'http://localhost:8081/cancelled', //redirect to this link once payment is cancelled
currency: 'AED', // optional - default value is AED
test: 1 // optional value set 0 to have live transaction
})
Note. Before going to live make sure to Authorised your server IP address from telr merchant Integration To create order - you can use this below sample parameters to generate link
const response = await telr.create({
ivp_amount: '300.00',
ivp_cart: 'abcde1234' // if not set - will get the current date in miliseconds as default value
ivp_desc: 'Purchase Order' // if not set - will have default value of Purchase Order
return_auth: 'http://localhost:8081/success', // optional if not set in setup
return_decl: 'http://localhost:8081/declined', // optional if not set in setup
return_can: 'http://localhost:8081/cancelled' // optional if not set in setup
})
Reponse:
{
"method":"create",
"order":{
"ref":"OrderRef",
"url":"https://secure.telr.com/gateway/process.html?o={OrderRef}"
}
}
extra fields will be - Telr Supplying Details | Field | Description | Notes | | ----- | ----------- | ----- | | bill_fname | Forenames | The customer’s forename, plus any other middle names or initials they may have | | bill_sname | Surname | Customer surname (also known as family name) | | bill_addr1 | Address line 1 | | | bill_phone | Customer Mobile number | | | bill_city | City | | | bill_country | Country | Must be supplied as a 2 character ISO 3166 country code. | | bill_email | Email address | |
#Status to check the status of the payment you will be needing the order ref from create response
const response = await telr.status({
ref: 'F7007901131C10366C6D1A451907C6F579C00DE6243AE5A80FA518EFF6205DA8'
})
#Transactions and Reports API Configuration Before starting you have to enable the Service API to get Merchant ID and API Key Transactions
const response = await telr.transactions({
merchant_id: '5123',
api_key: '8123981had2j',
transaction_ref: '01128729512398', // optional
type: 'linked' // optional
})
| type | transaction_ref | | ---- | --------------- | | linked | transRef | | cart | ref | | email | customer email address | | card | The card number can be provided in two ways, as either an 8 digit value (containing the first 4 and last 4 digits of the card number) or as a 12 digit transaction reference. |
Reports
const response = await telr.reports({
merchant_id: '5123',
api_key: '8123981had2j'
})
Agreements - Repeat Billing
const response = await telr.agreements({
merchant_id: '9102',
api_key: '1606faecM3GMcq6q4hpKwps6',
agreement_id: '1adi1u2390213', // optional
method: 'get', // optional - values | *get* or *cancel*
type: 'history' // optional
})