SDK Documentation
Chamsswitch's official angular package to seamlessly integrate the payment SDK to receive payments.
INSTALLATION
Firstly, you need to create a Chamsswitch Merchant Account account. npm and angular2+ are required
To install the latest version of payment-chamsswitch-sdk
, simply run the command:
USAGE
Parameters
Below is a list of the configuration supported parameters, this parameters are important, so they should be protected.
clientId
string
yes
clientid is one the credentials provided to merchant after registration
clientSecret
string
yes
clientSecret is one the credentials provided to merchant after registration
integrationKey
string
yes
integrationKey is one the credentials provided to merchant after registration
2. Implement the chamsswitch payment sdk in your project
The payment-chamsswitch-sdk component is used. There are two ways to configure the component.
1. The minimum compulsory parameter you can supply to the payment sdk in order to generate a payment checkout button, use the component properties directly like so:
2. You can also supply more optional parameters like so:
Note:
merchantRef is the merchant unique transaction reference to recognize each transaction on our server.
amount Amount to be debited from customer.
The event paymentCallback is raised after a transaction is completed. You can get the result of a transaction from the event handler assigned to it. A sample event handler will be like so:
Parameters
Below is a list of the supported parameters to show up the payment sdk checkout button.
amount
number
yes
Amount to be debited from customer.
currency
string
yes
The currency code eg NGN.
string
yes
The paying customer email address.
merchantRef
string
no
The merchant ref is unique ref the merchant generate for each transaction.
narration
string
no
Reason for the transaction.
callBackUrl
string
no
This is the merchant specified destination link after payment is processed.
customerId
string
no
The paying customer's ID.
lastName
string
no
The paying customer's last name.
firstName
string
no
The paying customer first name.
string
no
The paying customer email address.
paymentCallback
string
yes
The callback function that will inject the transaction details into your function.
After a successful transaction, you will get a sample response like so and this response will be injected into your callback function supplied to the paymentCallback like so:
NOTE: The key type
gives the final status of the transaction.
There are quite a number of response codes that can be returned, the full list can be viewed here
Handling the Response
For integrity purpose, you are advised to make a server side request to get the final status of a transaction before giving value. To do this, make a GET request to the endpoint below with the paymentReference
field from the event you got in your callbackfn:
Test mode:
https://api.pelpay.ng/api/Transaction/bypaymentreference/{paymentReference}
TEST CARDS
Master Card
5200000000000007
12/50
1111
111
1234
Last updated