Language
Tools
Try it out
request_body = {
event_type: "buygoods_transaction_received",
url: "https://myawesomeapplication.com/destination",
scope: "till",
scope_reference: "112233"
}
# Using K2Connect - https://github.com/kopo-kopo/k2-connect-ruby (Recommended)
subscription = K2Subscribe.new(your_access_token)
subscription.webhook_subscribe(request_body, K2_SECRET_KEY)
subscription.location_url # => "https://sandbox.kopokopo.com/webhook-subscriptions/5af4c10a-f6de-4ac8-840d-42cb65454216"
// Using Kopo Kopo Connect - https://github.com/kopokopo/k2-connect-node (Recommended)
const Webhooks = K2.Webhooks
var requestBody = {
eventType: 'buygoods_transaction_received',
url: 'https://myawesomeapplication.com/destination',
scope: 'till',
scopeReference: '555555', // Your till number
accessToken: 'my_access_token'
}
Webhooks
.subscribe(subscribeOptions)
.then(response => { console.log(response) })
.catch(error => { console.log(error) })
// => 'https://sandbox.kopokopo.com/api/v1/webhook_subscriptions/5af4c10a-f6de-4ac8-840d-42cb65454216'
POST https://sandbox.kopokopo.com/webhook-subscriptions
Accept: application/json
Content-Type: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
{
"event_type": "buygoods_transaction_received",
"url": "https://myapplication.com/webhooks",
"scope": "till",
"scope_reference": "112233"
}
#Provide example using K2Connect https://github.com/kopo-kopo/k2-connect-python (Recommended) k2connect.initialize(CLIENT_ID, CLIENT_SECRET, BASE_URL)
webhook_service = k2connect.Webhooks
subscription = webhook_service.create_subscription(BEARER_TOKEN, event_type, callback_url, scope, scope_reference, CLIENT_SECRET) ```
// Using Kopo Kopo Connect - https://github.com/kopokopo/k2-connect-php (Recommended)
$webhooks = $K2->Webhooks();
$response = $webhooks->subscribe([
'eventType' => 'buygoods_transaction_received',
'url' => 'https://myawesomeapplication.com/destination',
'scope' => 'till',
'scopeReference' => '555555', // Your till number
'accessToken' => 'my_access_token'
]);
if($response['status'] == 'success') {
echo "The resource location is:" . json_encode($response['location']);
} // => 'https://sandbox.kopokopo.com/webhook_subscriptions/5af4c10a-f6de-4ac8-840d-42cb65454216'
Status
Production: Operational© 2024 Kopo Kopo, Inc.