Let’s test out running Waivr locally by following the step-by-step integration process. You’ll need API keys, which you can request here. You'll have two different API keys, and there are two different Waivr environments. We'll start in the Stage environment.
Once you have your API keys, you can try out our product. The instructions below will guide you through the process.
For all examples below there are two pre-requirements:
Start by adding the customer information.
curl --location --request POST 'https://stage.waivr.co/api/waivr-app/v1/customers' \
--header 'Authorization: BT-EX-67f14ac8-74c3-428c-b577-bd999bc4a599 fz05JGPc1NHgR24fxqHZCBDhDLFHjVlUs6YvwwVFmLYyhiTFPL' \
--header 'Content-Type: application/json' \
--data-raw '{
"merchantUid": "67f14ac8-74c3-428c-b577-bd999bc4a599",
"email": "john.snow@northwall.com",
"firstName": "John",
"lastName": "Snow",
"phoneNumber": "4541239955",
"address": {
"line1": "5th Tower",
"line2": null,
"city": "North Wall",
"state": "Winterfell",
"country": "Westeros",
"zipCode": "012345"
}
}'
Waivr uses Plaid to collect bank account information from your customer.
curl --location --request POST
'https://stage.waivr.co/api/waivr-app/v1/connectaccounts/render' \
--header 'Authorization: BT-EX-67f14ac8-74c3-428c-b577-bd999bc4a599 fz05JGPc1NHgR24fxqHZCBDhDLFHjVlUs6YvwwVFmLYyhiTFPL' \
--header 'Content-Type: application/json' \
--data-raw '{
"merchantUid": "67f14ac8-74c3-428c-b577-bd999bc4a599"
}'
Waivr uses Plaid to collect bank account information from your customer. Here is an example of the integration to render Plaid.
<html>
<!--=================================================
STYLES AND PAGE INSTRUCTIONS. IGNORE THIS STUFF
=================================================-->
<head>
<style>
.outer { justify-self: center; margin: 20% auto 120px auto; width: 60%; ; font-family: 'Roboto', sans-serif;} a { text-decoration: underline; } li { padding-left: 1rem;}
</style>
</head>
<!--=================================================
PLAID SCRIPTS. HERE'S THE STUFF YOU'LL EDIT!
=================================================-->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script
src="https://cdn.plaid.com/link/v2/stable/link-initialize.js"></script>
<script type="text/javascript">
(function($) {
var handler = Plaid.create({
token: 'link-sandbox-613f419b-f7a0-4410-9a4a-e5c44212f7a1
',
onSuccess: function(public_token, metadata) {
console.log('public token is:', public_token, metadata);
},
onExit: function(err, metadata) {
console.log('onexit invoked');
},
onEvent: function(eventName, metadata) {
console.log('event name is:', eventName);
}
});
$('#link-button').on('click', function(e) { handler.open() });
})(jQuery);
</script>
</body>
</html>
For more details about Plaid, please visit their documentation.
In order to create a bank account connection, your customer will need to complete the Plaid user flow.
At the end of the flow, you will need to collect the following information to pass to Waivr:
Pass the information collected in the previous step to finalize the bank connection.
curl --location --request POST
'https://stage.waivr.co/api/waivr-app/v1/connectaccounts/connect' \
--header 'Authorization: BT-EX-67f14ac8-74c3-428c-b577-bd999bc4a599 fz05JGPc1NHgR24fxqHZCBDhDLFHjVlUs6YvwwVFmLYyhiTFPL' \
--header 'Content-Type: application/json' \
--data-raw '{
"merchantUid": "67f14ac8-74c3-428c-b577-bd999bc4a599",
"customerUid": "7aee19e1-b1ac-40e5-91e1-14eaefe73138",
"institution": {
"identifier": "ins_4",
"accountIdentifier": "goadzaX3gAseb6eJGnGDTXAkka31rAi43rg38"
},
"publicToken": "public-sandbox-4aa91553-561e-4bd6-ac59-d9d8f643fdce"
}'
A payment instruction contains the details of the payment request.
curl --location --request POST
'https://stage.waivr.co/api/waivr-app/v1/paymentinstructions' \
--header 'Authorization: BT-EX-67f14ac8-74c3-428c-b577-bd999bc4a599 fz05JGPc1NHgR24fxqHZCBDhDLFHjVlUs6YvwwVFmLYyhiTFPL' \
--header 'Content-Type: application/json' \
--data-raw '{
"externalReferenceIdentifier" : "ancestry.com",
"customerUid" : "7aee19e1-b1ac-40e5-91e1-14eaefe73138",
"merchantUid": "67f14ac8-74c3-428c-b577-bd999bc4a599",
"amount" : 19.99,
"frequency" : {
"recurrence" : 1,
"cycle" : "MONTHLY"
}
}'
A summary of payment instruction and the customer information can be pulled in this endpoint.
curl --location --request GET
'https://stage.waivr.co/api/waivr-app/v1/paymentinstructions/fbc9f65d-a73e-444a-9e2a-850754674299/summary' \
--header 'Authorization: BT-EX-67f14ac8-74c3-428c-b577-bd999bc4a599 fz05JGPc1NHgR24fxqHZCBDhDLFHjVlUs6YvwwVFmLYyhiTFPL' \
--data-raw ''
Begin processing payments.
curl --location --request POST 'https://stage.waivr.co/api/waivr-app/v1/payments' \
--header 'Authorization: BT-EX-67f14ac8-74c3-428c-b577-bd999bc4a599 fz05JGPc1NHgR24fxqHZCBDhDLFHjVlUs6YvwwVFmLYyhiTFPL' \
--header 'Content-Type: application/json' \
--data-raw '{
"paymentInstructionUid": "fbc9f65d-a73e-444a-9e2a-850754674299",
"methodType": "ACH"
}'
Want to learn more about our API? Visit our API Reference.
Find sample code on our public Github.