Fundraiser
This will create a link fundraiser to selected campaign from Ayobantu partner.
Create Fundraiser
POST {base_url}/api/v1/partner/fundraiser
Register the user/customer and make them as a fundraiser from one of the campaign
Headers
Accept
String
application/json
Authorization
String
Bearer <api_token>
Content-Type*
String
application/json
Request Body
name*
String
John Doe (Alpha/Numeric Only)
phone*
Numeric
0812345678 (6-20 digit)
signature_key*
String
Signature code generated every time you make a request. See more, click here.
Formula:
hash("sha512", name + phone + email + campaign_id + partner_code + secret_key);
Output:
a2a1d0baa527318794f77122e8b35eb19c83498fb535897d58bcf0fc6a00b3c0de5a113a1d53caa748a0bdcf0b0d6fd941d1ffa6801f0bb99d370f1c83aa13db
campaign_id*
Numeric
id is obtained from campaign submitted by partners or can be provided by Ayobantu.
{
"status_code": "200",
"message": "Success",
"data": ""
}{
"status_code": "404",
"message": "The requested resource is not found",
"erros": [
"Partner not found"
]
}{
"status_code": "500",
"message": "Internal Server Error",
"erros": [
"Registration failed"
]
}{
"status_code": "422",
"message": "Unprocessable Entity",
"erros": [
"Email is required",
"Phone is required"
]
}{
"status_code": "429",
"message": "Too Many Attempts",
"erros": [
"Please wait 1 minute for next request"
]
}// Example Generate Signature Key
//secret_key = '353656da-1695-434b-9f61-a3c9ff90894f';
hash("sha512", 'John Doe0812345678johndoe@example.com12345AYB12345353656da-1695-434b-9f61-a3c9ff90894f')
//Result
d30afd4aff9ff16ddbd93c147abf9799e9fdb1510d3538b1eca3262b229ec0634e888afb9582cd16a21f3c3b5babbe55c5f98b6c04d30b979bc93946c82cd470
curl -X POST \
{base_url}/api/v1/partner/fundraiser \
-H 'Accept: application/json' \
-H 'Authorization: Bearer A67354CD62E2D7F8B5652483816F2' \
-H 'Content-Type: application/json' \
-H 'cache-control: no-cache' \
-d '{
"name" : "John Doe",
"email" : "[email protected]",
"phone" : "0812345678",
"partner_code": "AYB12345",
"signature_key": "a2a1d0baa527318794f77122e8b35eb19c83498fb535897d58bcf0fc6a00b3c0de5a113a1d53caa748a0bdcf0b0d6fd941d1ffa6801f0bb99d370f1c83aa13db",
"campaign_id": "12345"
}'<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => {base_url}."/api/v1/partner/fundraiser",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\n\t\"name\" : \"John Doe\",\n\t\"email\" : \"[email protected]\",\n\t\"phone\" : \"0812345678\",\n\t\"partner_code\": \"AYB12345\",\n\t\"signature_key\": \"a2a1d0baa527318794f77122e8b35eb19c83498fb535897d58bcf0fc6a00b3c0de5a113a1d53caa748a0bdcf0b0d6fd941d1ffa6801f0bb99d370f1c83aa13db\",\n\t\"campaign_id\": \"12345\"\n}",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: Bearer A67354CD62E2D7F8B5652483816F2",
"Content-Type: application/json",
"cache-control: no-cache"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := {base_url}+"/api/v1/partner/fundraiser"
payload := strings.NewReader("{\n\t\"name\" : \"John Doe\",\n\t\"email\" : \"[email protected]\",\n\t\"phone\" : \"0812345678\",\n\t\"partner_code\": \"AYB12345\",\n\t\"signature_key\": \"a2a1d0baa527318794f77122e8b35eb19c83498fb535897d58bcf0fc6a00b3c0de5a113a1d53caa748a0bdcf0b0d6fd941d1ffa6801f0bb99d370f1c83aa13db\",\n\t\"campaign_id\": \"12345\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer A67354CD62E2D7F8B5652483816F2")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("cache-control", "no-cache")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}Last updated