SDK
To use Thepeer's SDK, you need to add the script in your project like this:
<script type="application/javascript" src="https://cdn.thepeer.co/v1/chain.js"></script>
Alternatively, you can make use of the available libraries for your language of choice.
Initiate Checkout
<button onclick="checkout()">Checkout</button><script type="application/javascript" src="https://cdn.thepeer.co/v1/chain.js"></script><script type="application/javascript">function checkout() { const checkout = new ThePeer.checkout({ publicKey: "pspk_one_more_thing", amount: 10000, email: "john@example.com", currency: "NGN", meta: { city: "Cupertino", state: "California" }, onSuccess: function (response) { console.log(response) }, onError: function (error) { console.log(error) }, onClose: function (event) { console.log(event) } }); checkout.setup(); checkout.open();}</script>
Parameter name | Description | Required | Data type |
---|---|---|---|
publicKey | Your public key can be found on your dashboard settings. | true | string |
email | Your customer's email. | true | string |
amount | The amount you intend to send and must be passed as an integer in kobo (must not be less than 10000 ). | true | integer |
meta | This object should contain additional/optional attributes you would like to have on your transaction response. | false | object |
Initiate Send
<button onclick="send()">Send</button><script type="application/javascript" src="https://cdn.thepeer.co/v1/chain.js"></script><script type="application/javascript">function send() { const send = new ThePeer.send({ publicKey: "pspk_one_more_thing", amount: 42000, currency: "NGN", userReference: "stay-foolish-stay-hungry-forever", meta: { city: "San Francisco", state: "California" }, onSuccess: function (response) { console.log(response) }, onError: function (error) { console.log(error) }, onClose: function (event) { console.log(event) } }); send.setup(); send.open();}</script>
Parameter name | Description | Required | Data type |
---|---|---|---|
publicKey | Your public key can be found on your dashboard settings. | true | string |
amount | The amount you intend to send and must be passed as an integer in kobo (must not be less than 10000 ). | true | integer |
userReference | The user reference returned by Thepeer's API when a user has been indexed. | true | string |
meta | This object should contain additional/optional attributes you would like to have on your transaction response. | false | object |
Initiate Direct charge
<button onclick="directDebit()">Direct Debit</button><script type="application/javascript" src="https://cdn.thepeer.co/v1/chain.js"></script><script type="application/javascript">function directDebit() { const directCharge = new ThePeer.directCharge({ publicKey: "pspk_one_more_thing", amount: 66666, currency: "NGN", userReference: "stay-foolish-stay-hungry-forever", meta: { city: "Sacramento", state: "California" }, onSuccess: function (response) { console.log(response) }, onError: function (error) { console.log(error) }, onClose: function (event) { console.log(event) } }); directCharge.setup(); directCharge.open();}</script>
Parameter name | Description | Required | Data type |
---|---|---|---|
publicKey | Your public key can be found on your dashboard settings. | true | string |
amount | The amount you intend to send and must be passed as an integer in kobo (must not be less than 10000 ). | true | integer |
userReference | The user reference returned by Thepeer's API when a user has been indexed. | true | string |
meta | This object should contain additional/optional attributes you would like to have on your transaction response. | false | object |
Demo
Sample Users
Cash App
- username:
@trojan
Venmo
- username:
@chike
🔑
To link an account via Direct Charge, the OTP on test
is 449404
💡
NOTE
The API key provided must be your public key — never use your secret key on the client side.
👀
NOTE
When a payment is initiated, an authorization charge is sent to the webhook of the business that needs to approve that transaction. Learn more on the process authorization requests page.