Skip to content

Transactions

The Transactions API allows you create and manage transactions on your integration.

Bunce creates customers for you from your providers, or you can create and manage them using the Dashboard or API.

Create a transaction

Post
bash
https://api.bunce.so/v1/transactions

Create Transaction.

If successful, your response includes a copy of the new transaction entity in an array.

Request

Body Parameters array required

FieldDescription
customer array<{ customer_id: string required; email: string<email> required; first_name: string; last_name: string; phone_no: string;}> requiredCustomer object
amount numeric requiredTransaction amount
payment_gateway string requiredTransaction payment gateway.
Supported payment providers:
paystack flutterwave korapay monnify mono finca stripe
status string requiredTransaction Status
reference string requiredCustom transaction reference
transaction_id string nullableCustom transaction id
channel string nullableChannel transaction was made
currency string requiredCurrency of the transaction
card_bin string nullableCustomer card bin
card_bank string nullableCustomer card bank
card_expiry_month string nullableCustomer card expiry month
card_expiry_year string nullableCustomer card expiry year
paid_at datetime nullableDate payment was made
created_at datetime nullableDate transaction as created

Customer Field

The Customer field is an required array of the customer object. The customer object should contain the following fields:

  • customer_id (string): The Customer ID of the customer on your Database. This is required.
  • email (string): The email of the customer. This is required.
  • first_name (string): The first name of the customer. This is not required.
  • last_name (string): The last name of the customer. This is not required.
  • phone_no (string): The phone number of the customer. This is not required.

Example:

json
{
    "customer": {
        "customer_id" : "0000",
        "email" : "test@example.com",
        "first_name" : "John",
        "last_name" : "Doe",
        "phone_no" : "08000000000"
    },
    "amount" : 12000,
    "payment_gateway" : "stripe",
    "channel": "bank transfer",
    "status" : "success",
    "paid_at" : "2024-09-06",
    "created_at" : "2024-09-06",
    "transaction_id" : "CA-88545974984",
    "reference" : "88557567774697745",
    "currency" : "usd",
    "card_expiry_month" : "03",
    "card_expiry_year" : "2024"
}
bash
curl --request POST \
  --url https://api.bunce.so/v1/transactions \
  --header 'Content-Type: application/json' \
  --header 'X-Authorization: sk_live_************************' \
  --data ' {
    "customer": {
        "customer_id" : "0000",
        "email" : "test@example.com",
        "first_name" : "John",
        "last_name" : "Doe",
        "phone_no" : "08000000000"
    },
    "amount" : 12000,
    "payment_gateway" : "stripe",
    "channel": "bank transfer",
    "status" : "success",
    "paid_at" : "2024-09-06",
    "created_at" : "2024-09-06",
    "transaction_id" : "CA-88545974984",
    "reference" : "88557567774697745",
    "currency" : "usd",
    "card_expiry_month" : "03",
    "card_expiry_year" : "2024"
}'
go
import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

url := "https://api.bunce.so/v1/transactions"

payload := strings.NewReader("{\n  \"customers\": [\n {\n \"customer_id\": \"0000\",\n \"first_name\": \"John\", \n \"last_name\": \"Doe\",\n \"email\": \"johndoe21@example.com\",\n \"phone_no\": \"+23481999999999\"\n },\n {\n      \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"johndoe22@example.com\",\n \"phone_no\": \"+23481999999999\"\n }\n ]\n}
")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-Authorization", "sk_live_************************")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)

fmt.Println(res)
fmt.Println(string(body))
js
import  from 'node-fetch'

let  = 'https://api.bunce.so/v1/transactions'

let  = {
  : 'POST',
  : {
    'X-Authorization': 'sk_live_************************',
    'Content-Type': 'application/json',
  },
  : '{"customers":[{"customer_id":"0000","first_name":"John","last_name":"Doe","email":"johndoe21@example.com","phone_no":"+23481999999999"},{"customer_id":"1111","first_name":"John","last_name":"Doe","email":"johndoe22@example.com","phone_no":"+23481999999999"}]}',
}

(, )
  .then(() => .json())
  .then(() => .())
  .catch(() => .('error:' + ))
php
<?php

$client = new http\Client;
$request = new http\Client\Request;

$body = new http\Message\Body;
$body->append('{
    "customer": {
        "customer_id": "0000",
        "email" : "test@example.com",
        "first_name" : "John",
        "last_name" : "Doe",
        "phone_no" : "08000000000"
    },
    "amount" : 12000,
    "payment_gateway" : "stripe",
    "channel": "bank transfer",
    "status" : "success",
    "paid_at" : "2024-09-06",
    "created_at" : "2024-09-06",
    "transaction_id" : "CA-88545974984",
    "reference" : "88557567774697745",
    "currency" : "usd",
    "card_expiry_month" : "03",
    "card_expiry_year" : "2024"
}');

$request->setRequestUrl('https://api.bunce.so/v1/transactions');
$request->setRequestMethod('POST');
$request->setBody($body);

$request->setHeaders([
  'X-Authorization' => 'sk_live_************************',
  'Content-Type' => 'application/json'
]);

$client->enqueue($request)->send();
$response = $client->getResponse();

echo $response->getBody();
java
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.bunce.so/v1/transactions"))
    .header("X-Authorization", "sk_live_************************")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString(" {\n  \"customers\": [\n {\n \"customer_id\": \"0000\", \n \"first_name\": \"John\", \n \"last_name\": \"Doe\",\n \"email\": \"johndoe21@example.com\",\n \"phone_no\": \"+23481999999999\"\n },\n {\n \"customer_id\": \"1111\", \n      \"first_name\": \"John\",\n \"last_name\": \"Doe\",\n \"email\": \"johndoe22@example.com\",\n \"phone_no\": \"+23481999999999\"\n }\n ]\n}"))
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Response

json
{
    "success": true,
    "data": {
        "id": "9c81180f-42a8-4306-bfb1-a477dffddc2a",
        "customer": {
            "customer_id": "0000",
            "first_name": null,
            "last_name": null,
            "email": "su.imohita@gmail.com",
            "phone_no": "08062295588",
            "customer_created_at": "2024-07-12T11:11:23.000000Z"
        },
        "card_bank": null,
        "card_bin": null,
        "card_exp_month": "03",
        "card_exp_year": "2024",
        "transaction_gateway": "stripe",
        "status": "success",
        "reference": "88557567774697745",
        "amount": 12000,
        "currency": "usd",
        "channel": "bank transfer",
        "paid_at": "2024-09-06",
        "transaction_created_at": "2024-09-05T23:00:00.000000Z",
        "created_at": "2024-07-12T11:11:23.000000Z"
    },
    "message": "Customer transaction created successfully"
}