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 nameDescriptionRequiredData type
publicKeyYour public key can be found on your dashboard settings.truestring
emailYour customer's email.truestring
amountThe amount you intend to send and must be passed as an integer in kobo (must not be less than 10000).trueinteger
metaThis object should contain additional/optional attributes you would like to have on your transaction response.falseobject

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 nameDescriptionRequiredData type
publicKeyYour public key can be found on your dashboard settings.truestring
amountThe amount you intend to send and must be passed as an integer in kobo (must not be less than 10000).trueinteger
userReferenceThe user reference returned by Thepeer's API when a user has been indexed.truestring
metaThis object should contain additional/optional attributes you would like to have on your transaction response.falseobject

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 nameDescriptionRequiredData type
publicKeyYour public key can be found on your dashboard settings.truestring
amountThe amount you intend to send and must be passed as an integer in kobo (must not be less than 10000).trueinteger
userReferenceThe user reference returned by Thepeer's API when a user has been indexed.truestring
metaThis object should contain additional/optional attributes you would like to have on your transaction response.falseobject

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.