SDK

To use Thepeer SDK you need to add the script in your project like this:

<script type="application/javascript" src="https://cdn.thepeer.co/v1/chain.js"/>

Also, you can make you 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 type="application/javascript">
function checkout() {
const checkout = new ThePeer.checkout({
publicKey: "pspk_one_more_thing",
amount: 6969,
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 settingstruestring
emailYour customer's emailtruestring
amountThe amount you intend to send and must be pass as an integer in kobotrueinteger
metaThis object should contain additional/optional attributes you would like to have on your transaction responsefalseobject

Initiate Send

<button onclick="send()">Send</button>
<script type="application/javascript" src="https://cdn.thepeer.co/v1/chain.js"/>
<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 settingstruestring
amountThe amount you intend to send and must be pass as an integer in kobotrueinteger
userReferenceThe user reference returned by Thepeer API when a user has been indexedtruestring
metaThis object should contain additional/optional attributes you would like to have on your transaction responsefalseobject

Initiate Direct charge

<button onclick="directDebit()">Direct Debit</button>
<script type="application/javascript" src="https://cdn.thepeer.co/v1/chain.js"/>
<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 settingstruestring
amountThe amount you intend to send and must be pass as an integer in kobotrueinteger
userReferenceThe user reference returned by Thepeer API when a user has been indexedtruestring
metaThis object should contain additional/optional attributes you would like to have on your transaction responsefalseobject

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. Click here to learn more.