Overview

Setup

Utility Payment

Utility Payment Overview

The Utility Payment Object

Creating Utility Payments

Creating Utility Payments with scheduled, tags parameters

Listing Utility Payments

Getting a Utility Payment

Canceling Utility Payment

Receiving Utility Payment Webhook

Utility Payment

We provide the convenience of paying utility bills directly from your Stark Bank balance.

In the document below, we will detail the processes related to creating and managing Utility Payments, providing a clear and comprehensive understanding of the operation and how to manage the lifecycle of this resource.

Utility Payments allow you to pay services such as electricity, water, gas, and other utility bills.

NOTE: Read Core Concepts before continuing this guide.

RESOURCE SUMMARY
Pay utility bills using your Stark Bank balance

Setup

For each environment: (Sandbox or Production)

1. Create an account at Stark Bank.

2. Create a webhook with the following subscriptions to receive events in your desired URL:

utility-payment

2.1. Via Internet Banking:

Integrations > Webhook > New Webhook

2.2. Via API:

Use the POST /webhook route to create the webhook

Utility Payment Overview

Utility Payment is a resource that can be used to pay utility bills such as electricity, water, gas and other services.

To create a Utility Payment, you need to provide either the line or the barCode of the bill, along with a description.

Optional parameters include scheduled and tags.

The Utility Payment Status

Each Utility Payment has a status that can change over time according to its life cycle:

utility-payment-status

StatusDescription
CreatedThe Utility Payment was successfully created in Stark Bank.
ProcessingThe Utility Payment is being processed by Stark Bank.
SuccessThe Utility Payment was successfully completed.
FailedThe Utility Payment was unsuccessful.
CanceledThe Utility Payment was canceled before processing.

The Utility Payment Logs

Every time either you or Stark Bank makes a change to a Utility Payment, we create a Log. Logs are pretty useful for understanding the life cycle of each Utility Payment and the changes that happened to it. Here you can see the flow of possible logs:

utility-payment-log

Log typeStatusDescription
CreatedCreatedThe Utility Payment was successfully created in Stark Bank.
ProcessingProcessingThe Utility Payment is being sent to the banking network.
SuccessSuccessThe Utility Payment was successfully completed.
FailedFailedThe Utility Payment was unsuccessful.
CanceledCanceledThe Utility Payment was canceled before processing.

The Utility Payment Object

Attributes

id STRING

Unique id for the utility payment.

amount INTEGER

Amount in cents to be paid. Example: 1234 (R$12.34).

barCode STRING

Bar code number of the utility bill.

created STRING

Creation datetime. Example: "2020-02-06T16:22:24.664148+00:00".

description STRING

Custom description for the utility payment.

fee INTEGER

Fee charged in cents.

line STRING

Digitable line of the utility bill.

scheduled STRING

Scheduled date for the utility payment. Example: "2020-08-14" or "2020-08-14T15:23:26+00:00".

status STRING

Current utility payment status. Options: "created", "processing", "success", "failed", "canceled".

tags LIST OF STRINGS

Tags associated with the utility payment.

transactionIds LIST OF STRINGS

Ledger transaction IDs linked to the utility payment.

type STRING

Payment type. Example: "utility".

updated STRING

Last update datetime. Example: "2020-02-06T16:22:24.664148+00:00".

Creating Utility Payments

To create a Utility Payment, provide either the line or the barCode of the utility bill, along with a description.

The payment will be processed as soon as possible unless a scheduled date is provided.

Python

import starkbank

payments = starkbank.utilitypayment.create([
    starkbank.UtilityPayment(
        line="83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        description="Electricity for the Long Night"
    )
])

for payment in payments:
    print(payment)
    

Javascript

const starkbank = require('starkbank');

(async() => {
    let payments = await starkbank.utilityPayment.create([
        {
            line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
            description: 'Electricity for the Long Night'
        }
    ])

    for (let payment of payments) {
        console.log(payment);
    }
})();
    

PHP

$payments = StarkBank\UtilityPayment::create([
    new StarkBank\UtilityPayment([
        "line" => "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "description" => "Electricity for the Long Night"
    ])
]);

foreach($payments as $payment){
    print_r($payment);
}
    

Java

import com.starkbank.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

List<UtilityPayment> payments = new ArrayList<>();

HashMap<String, Object> data = new HashMap<>();
data.put("line", "83640000001 1 08740138007 0 61053026111 0 08067159411 9");
data.put("description", "Electricity for the Long Night");
payments.add(new UtilityPayment(data));

payments = UtilityPayment.create(payments);

for (UtilityPayment payment : payments){
    System.out.println(payment);
}
    

Ruby

require('starkbank')

payments = StarkBank::UtilityPayment.create(
    [
        StarkBank::UtilityPayment.new(
            line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
            description: 'Electricity for the Long Night'
        )
    ]
)

payments.each do |payment|
    puts payment
end
    

Elixir

payments = StarkBank.UtilityPayment.create!([
    %StarkBank.UtilityPayment{
        line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        description: "Electricity for the Long Night"
    }
])

for payment <- payments do
    payment |> IO.inspect
end
    

C#

using System;
using System.Collections.Generic;

List<StarkBank.UtilityPayment> payments = StarkBank.UtilityPayment.Create(
    new List<StarkBank.UtilityPayment> {
        new StarkBank.UtilityPayment(
            line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            description: "Electricity for the Long Night"
        )
    }
);

foreach(StarkBank.UtilityPayment payment in payments)
{
    Console.WriteLine(payment);
}
    

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/utilitypayment"
)

func main() {

    payments, err := utilitypayment.Create(
        []utilitypayment.UtilityPayment{
            {
                Line:        "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
                Description: "Electricity for the Long Night",
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    for _, payment := range payments {
        fmt.Printf("%+v", payment)
    }
}
    

Clojure

(def payments
  (starkbank.utility-payment/create
    [
      {
        :line "83640000001 1 08740138007 0 61053026111 0 08067159411 9"
        :description "Electricity for the Long Night"
      }
    ]))
(dorun (map println payments))
    

Curl

curl --location --request POST '{{baseUrl}}/v2/utility-payment' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "payments": [
        {
            "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            "description": "Electricity for the Long Night"
        }
    ]
}'
    
RESPONSE

Python

UtilityPayment(
    amount=14390,
    bar_code=83640000001087401380076105302611108067159411,
    created=2020-02-06 16:22:24.664134,
    description=Electricity for the Long Night,
    fee=0,
    id=5412038532661248,
    line=83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled=2020-02-07 10:00:00,
    status=created,
    tags=[],
    transaction_ids=[],
    type=utility,
    updated=2020-02-06 16:22:24.664148
)
    

Javascript

UtilityPayment {
    id: '5412038532661248',
    amount: 14390,
    barCode: '83640000001087401380076105302611108067159411',
    created: '2020-02-06T16:22:24.664148+00:00',
    description: 'Electricity for the Long Night',
    fee: 0,
    line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
    scheduled: '2020-02-07T10:00:00+00:00',
    status: 'created',
    tags: [ ],
    transactionIds: [],
    type: 'utility',
    updated: '2020-02-06T16:22:24.664148+00:00'
}
    

PHP

StarkBank\UtilityPayment Object
(
    [id] => 5412038532661248
    [amount] => 14390
    [barCode] => 83640000001087401380076105302611108067159411
    [created] => DateTime Object
        (
            [date] => 2020-02-06 16:22:24.664148
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [description] => Electricity for the Long Night
    [fee] => 0
    [line] => 83640000001 1 08740138007 0 61053026111 0 08067159411 9
    [scheduled] => DateTime Object
        (
            [date] => 2020-02-07 10:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [status] => created
    [tags] => Array
        (
        )

    [transactionIds] => Array
        (
        )

    [type] => utility
    [updated] => DateTime Object
        (
            [date] => 2020-02-06 16:22:24.664148
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
    

Java

UtilityPayment({
    "amount": 14390,
    "barCode": "83640000001087401380076105302611108067159411",
    "created": "2020-02-06T16:22:24.664148+00:00",
    "description": "Electricity for the Long Night",
    "fee": 0,
    "id": "5412038532661248",
    "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    "scheduled": "2020-02-07T10:00:00+00:00",
    "status": "created",
    "tags": [],
    "transactionIds": [],
    "type": "utility",
    "updated": "2020-02-06T16:22:24.664148+00:00"
})
    

Ruby

utilitypayment(
    id: 5412038532661248,
    amount: 14390,
    bar_code: 83640000001087401380076105302611108067159411,
    created: 2020-02-06T16:22:24+00:00,
    description: Electricity for the Long Night,
    fee: 0,
    line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled: 2020-02-07T10:00:00+00:00,
    status: created,
    tags: [],
    transaction_ids: [],
    type: utility,
    updated: 2020-02-06T16:22:24+00:00
)
    

Elixir

%StarkBank.UtilityPayment {
    amount: 14390,
    bar_code: "83640000001087401380076105302611108067159411",
    created: ~U[2020-02-06 16:22:24.664148Z],
    description: "Electricity for the Long Night",
    fee: 0,
    id: "5412038532661248",
    line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    scheduled: ~U[2020-02-07 10:00:00Z],
    status: "created",
    tags: [],
    transaction_ids: [],
    type: "utility",
    updated: ~U[2020-02-06 16:22:24.664148Z]
}
    

C#

UtilityPayment(
    Amount: 14390,
    BarCode: 83640000001087401380076105302611108067159411,
    Created: 06/02/2020 16:22:24,
    Description: Electricity for the Long Night,
    Fee: 0,
    Line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    Scheduled: 07/02/2020 10:00:00,
    Status: created,
    Tags: {},
    TransactionIds: {  },
    Type: utility,
    Updated: 06/02/2020 16:22:24,
    ID: 5412038532661248
)
    

Go

{
    Id:5412038532661248
    Amount:14390
    BarCode:83640000001087401380076105302611108067159411
    Created:2020-02-06 16:22:24.664148 +0000 +0000
    Description:Electricity for the Long Night
    Fee:0
    Line:83640000001 1 08740138007 0 61053026111 0 08067159411 9
    Scheduled:2020-02-07 10:00:00 +0000 +0000
    Status:created
    Tags:[]
    TransactionIds:[]
    Type:utility
    Updated:2020-02-06 16:22:24.664148 +0000 +0000
}
    

Clojure

{:amount 14390,
 :fee 0,
 :tags [],
 :updated "2020-02-06T16:22:24.664148+00:00",
 :description "Electricity for the Long Night",
 :created "2020-02-06T16:22:24.664148+00:00",
 :status "created",
 :id "5412038532661248",
 :transaction-ids [],
 :line "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
 :bar-code "83640000001087401380076105302611108067159411",
 :scheduled "2020-02-07T10:00:00+00:00",
 :type "utility"}
    

Curl

{
    "message": "Utility Payment(s) successfully created",
    "payments": [
        {
            "amount": 14390,
            "barCode": "83640000001087401380076105302611108067159411",
            "created": "2020-02-06T16:22:24.387022+00:00",
            "description": "Electricity for the Long Night",
            "fee": 0,
            "id": "5412038532661248",
            "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            "scheduled": "2020-02-07T10:00:00+00:00",
            "status": "created",
            "tags": [],
            "transactionIds": [],
            "type": "utility",
            "updated": "2020-02-06T16:22:24.664148+00:00"
        }
    ]
}
    

Creating Utility Payments with scheduled, tags parameters

Scheduled: Schedule the utility payment for a specific date.

Today is the default.

Example: "2020-08-14T15:23:26+00:00" or "2020-08-14"

Tags: Array of strings to tag the entity for future queries. All tags will be converted to lowercase. Example: ["electricity", "invoice/1234"]

Python

import starkbank

payments = starkbank.utilitypayment.create([
    starkbank.UtilityPayment(
        line="83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        description="Electricity for the Long Night",
        scheduled="2020-08-14",
        tags=["electricity", "invoice/1234"]
    )
])

for payment in payments:
    print(payment)
    

Javascript

const starkbank = require('starkbank');

(async() => {
    let payments = await starkbank.utilityPayment.create([
        {
            line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
            description: 'Electricity for the Long Night',
            scheduled: '2020-08-14',
            tags: ['electricity', 'invoice/1234']
        }
    ])

    for (let payment of payments) {
        console.log(payment);
    }
})();
    

PHP

$payments = StarkBank\UtilityPayment::create([
    new StarkBank\UtilityPayment([
        "line" => "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "description" => "Electricity for the Long Night",
        "scheduled" => "2020-08-14",
        "tags" => ["electricity", "invoice/1234"]
    ])
]);

foreach($payments as $payment){
    print_r($payment);
}
    

Java

import com.starkbank.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

List<UtilityPayment> payments = new ArrayList<>();

HashMap<String, Object> data = new HashMap<>();
data.put("line", "83640000001 1 08740138007 0 61053026111 0 08067159411 9");
data.put("description", "Electricity for the Long Night");
data.put("scheduled", "2020-08-14");
data.put("tags", new String[]{"electricity", "invoice/1234"});
payments.add(new UtilityPayment(data));

payments = UtilityPayment.create(payments);

for (UtilityPayment payment : payments){
    System.out.println(payment);
}
    

Ruby

require('starkbank')

payments = StarkBank::UtilityPayment.create(
    [
        StarkBank::UtilityPayment.new(
            line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
            description: 'Electricity for the Long Night',
            scheduled: '2020-08-14',
            tags: ['electricity', 'invoice/1234']
        )
    ]
)

payments.each do |payment|
    puts payment
end
    

Elixir

payments = StarkBank.UtilityPayment.create!([
    %StarkBank.UtilityPayment{
        line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        description: "Electricity for the Long Night",
        scheduled: "2020-08-14",
        tags: ["electricity", "invoice/1234"]
    }
])

for payment <- payments do
    payment |> IO.inspect
end
    

C#

using System;
using System.Collections.Generic;

List<StarkBank.UtilityPayment> payments = StarkBank.UtilityPayment.Create(
    new List<StarkBank.UtilityPayment> {
        new StarkBank.UtilityPayment(
            line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            description: "Electricity for the Long Night",
            scheduled: new DateTime(2020, 8, 14),
            tags: new List<string> { "electricity", "invoice/1234" }
        )
    }
);

foreach(StarkBank.UtilityPayment payment in payments)
{
    Console.WriteLine(payment);
}
    

Go

package main

import (
    "fmt"
    "time"
    "github.com/starkbank/sdk-go/starkbank/utilitypayment"
)

func main() {

    scheduled := time.Date(2020, 8, 14, 0, 0, 0, 0, time.UTC)

    payments, err := utilitypayment.Create(
        []utilitypayment.UtilityPayment{
            {
                Line:        "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
                Description: "Electricity for the Long Night",
                Scheduled:   &scheduled,
                Tags:        []string{"electricity", "invoice/1234"},
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    for _, payment := range payments {
        fmt.Printf("%+v", payment)
    }
}
    

Clojure

(def payments
  (starkbank.utility-payment/create
    [
      {
        :line "83640000001 1 08740138007 0 61053026111 0 08067159411 9"
        :description "Electricity for the Long Night"
        :scheduled "2020-08-14"
        :tags ["electricity" "invoice/1234"]
      }
    ]))
(dorun (map println payments))
    

Curl

curl --location --request POST '{{baseUrl}}/v2/utility-payment' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "payments": [
        {
            "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            "description": "Electricity for the Long Night",
            "scheduled": "2020-08-14",
            "tags": ["electricity", "invoice/1234"]
        }
    ]
}'
    
RESPONSE

Python

UtilityPayment(
    amount=14390,
    bar_code=83640000001087401380076105302611108067159411,
    created=2020-02-06 16:22:24.664134,
    description=Electricity for the Long Night,
    fee=0,
    id=5412038532661248,
    line=83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled=2020-08-14 10:00:00,
    status=created,
    tags=['electricity', 'invoice/1234'],
    transaction_ids=[],
    type=utility,
    updated=2020-02-06 16:22:24.664148
)
    

Javascript

UtilityPayment {
    id: '5412038532661248',
    amount: 14390,
    barCode: '83640000001087401380076105302611108067159411',
    created: '2020-02-06T16:22:24.664148+00:00',
    description: 'Electricity for the Long Night',
    fee: 0,
    line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
    scheduled: '2020-08-14T10:00:00+00:00',
    status: 'created',
    tags: [ 'electricity', 'invoice/1234' ],
    transactionIds: [],
    type: 'utility',
    updated: '2020-02-06T16:22:24.664148+00:00'
}
    

PHP

StarkBank\UtilityPayment Object
(
    [id] => 5412038532661248
    [amount] => 14390
    [barCode] => 83640000001087401380076105302611108067159411
    [created] => DateTime Object
        (
            [date] => 2020-02-06 16:22:24.664148
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [description] => Electricity for the Long Night
    [fee] => 0
    [line] => 83640000001 1 08740138007 0 61053026111 0 08067159411 9
    [scheduled] => DateTime Object
        (
            [date] => 2020-08-14 10:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [status] => created
    [tags] => Array
        (
            [0] => electricity
            [1] => invoice/1234
        )

    [transactionIds] => Array
        (
        )

    [type] => utility
    [updated] => DateTime Object
        (
            [date] => 2020-02-06 16:22:24.664148
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
    

Java

UtilityPayment({
    "amount": 14390,
    "barCode": "83640000001087401380076105302611108067159411",
    "created": "2020-02-06T16:22:24.664148+00:00",
    "description": "Electricity for the Long Night",
    "fee": 0,
    "id": "5412038532661248",
    "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    "scheduled": "2020-08-14T10:00:00+00:00",
    "status": "created",
    "tags": ["electricity", "invoice/1234"],
    "transactionIds": [],
    "type": "utility",
    "updated": "2020-02-06T16:22:24.664148+00:00"
})
    

Ruby

utilitypayment(
    id: 5412038532661248,
    amount: 14390,
    bar_code: 83640000001087401380076105302611108067159411,
    created: 2020-02-06T16:22:24+00:00,
    description: Electricity for the Long Night,
    fee: 0,
    line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled: 2020-08-14T10:00:00+00:00,
    status: created,
    tags: ["electricity", "invoice/1234"],
    transaction_ids: [],
    type: utility,
    updated: 2020-02-06T16:22:24+00:00
)
    

Elixir

%StarkBank.UtilityPayment {
    amount: 14390,
    bar_code: "83640000001087401380076105302611108067159411",
    created: ~U[2020-02-06 16:22:24.664148Z],
    description: "Electricity for the Long Night",
    fee: 0,
    id: "5412038532661248",
    line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    scheduled: ~U[2020-08-14 10:00:00Z],
    status: "created",
    tags: ["electricity", "invoice/1234"],
    transaction_ids: [],
    type: "utility",
    updated: ~U[2020-02-06 16:22:24.664148Z]
}
    

C#

UtilityPayment(
    Amount: 14390,
    BarCode: 83640000001087401380076105302611108067159411,
    Created: 06/02/2020 16:22:24,
    Description: Electricity for the Long Night,
    Fee: 0,
    Line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    Scheduled: 08/14/2020 10:00:00,
    Status: created,
    Tags: { electricity, invoice/1234 },
    TransactionIds: {  },
    Type: utility,
    Updated: 06/02/2020 16:22:24,
    ID: 5412038532661248
)
    

Go

{
    Id:5412038532661248
    Amount:14390
    BarCode:83640000001087401380076105302611108067159411
    Created:2020-02-06 16:22:24.664148 +0000 +0000
    Description:Electricity for the Long Night
    Fee:0
    Line:83640000001 1 08740138007 0 61053026111 0 08067159411 9
    Scheduled:2020-08-14 10:00:00 +0000 +0000
    Status:created
    Tags:[electricity invoice/1234]
    TransactionIds:[]
    Type:utility
    Updated:2020-02-06 16:22:24.664148 +0000 +0000
}
    

Clojure

{:amount 14390,
 :fee 0,
 :tags ["electricity" "invoice/1234"],
 :updated "2020-02-06T16:22:24.664148+00:00",
 :description "Electricity for the Long Night",
 :created "2020-02-06T16:22:24.664148+00:00",
 :status "created",
 :id "5412038532661248",
 :transaction-ids [],
 :line "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
 :bar-code "83640000001087401380076105302611108067159411",
 :scheduled "2020-08-14T10:00:00+00:00",
 :type "utility"}
    

Curl

{
    "message": "Utility Payment(s) successfully created",
    "payments": [
        {
            "amount": 14390,
            "barCode": "83640000001087401380076105302611108067159411",
            "created": "2020-02-06T16:22:24.387022+00:00",
            "description": "Electricity for the Long Night",
            "fee": 0,
            "id": "5412038532661248",
            "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            "scheduled": "2020-08-14T10:00:00+00:00",
            "status": "created",
            "tags": ["electricity", "invoice/1234"],
            "transactionIds": [],
            "type": "utility",
            "updated": "2020-02-06T16:22:24.664148+00:00"
        }
    ]
}
    

Listing Utility Payments

Get a list of Utility Payments using filters such as after, before, status and tags to narrow the results.

Python

import starkbank

payments = starkbank.utilitypayment.query(
    after="2020-04-01",
    before="2020-04-30",
)

for payment in payments:
    print(payment)
    

Javascript

const starkbank = require('starkbank');

(async() => {
    let payments = await starkbank.utilityPayment.query({
        after: '2020-04-01',
        before: '2020-04-30',
    });

    for await (let payment of payments) {
        console.log(payment);
    }
})();
    

PHP

$payments = StarkBank\UtilityPayment::query([
    "after" => "2020-04-01",
    "before" => "2020-04-30"
]);

foreach($payments as $payment){
    print_r($payment);
}
    

Java

import com.starkbank.*;
import com.starkbank.utils.Generator;
import java.util.HashMap;

HashMap<String, Object> params = new HashMap<>();
params.put("after", "2020-04-01");
params.put("before", "2020-04-30");
Generator<UtilityPayment> payments = UtilityPayment.query(params);

for (UtilityPayment payment : payments){
    System.out.println(payment);
}
    

Ruby

require('starkbank')

payments = StarkBank::UtilityPayment.query(
    after: '2020-04-01',
    before: '2020-04-30'
)

payments.each do |payment|
    puts payment
end
    

Elixir

payments = StarkBank.UtilityPayment.query!(
    after: "2020-04-01",
    before: "2020-04-30"
)

for payment <- payments do
    payment |> IO.inspect
end
    

C#

using System;
using System.Collections.Generic;

IEnumerable<StarkBank.UtilityPayment> payments = StarkBank.UtilityPayment.Query(
    after: new DateTime(2020, 4, 1),
    before: new DateTime(2020, 4, 30)
);

foreach(StarkBank.UtilityPayment payment in payments)
{
    Console.WriteLine(payment);
}
    

Go

package main

import (
    "fmt"
    "time"
    "github.com/starkbank/sdk-go/starkbank/utilitypayment"
)

func main() {

    var params = map[string]interface{}{}
    params["after"] = time.Date(2020, 4, 1, 0, 0, 0, 0, time.UTC)
    params["before"] = time.Date(2020, 4, 30, 0, 0, 0, 0, time.UTC)

    payments, errorChannel := utilitypayment.Query(params, nil)

    loop:
    for {
        select {
        case err := <-errorChannel:
            if err.Errors != nil {
                for _, e := range err.Errors {
                    fmt.Printf("code: %s, message: %s", e.Code, e.Message)
                }
            }
        case payment, ok := <-payments:
            if !ok {
                break loop
            }
            fmt.Printf("%+v", payment)
        }
    }
}
    

Clojure

(def payments
    (starkbank.utility-payment/query
    {
        :after "2020-04-01"
        :before "2020-04-30"
    }))

(dorun (map println payments))
    

Curl

curl --location --request GET '{{baseUrl}}/v2/utility-payment?after=2020-04-01&before=2020-04-30' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
    
RESPONSE

Python

UtilityPayment(
    amount=14390,
    bar_code=83640000001087401380076105302611108067159411,
    created=2020-04-24 17:49:10.225810,
    description=Electricity for the Long Night,
    fee=200,
    id=5950134772826112,
    line=83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled=2020-08-14 10:00:00,
    status=processing,
    tags=['electricity', 'invoice/1234'],
    transaction_ids=['5991715760504832'],
    type=utility,
    updated=2020-04-24 17:49:10.225810
)
    

Javascript

UtilityPayment {
    id: '5950134772826112',
    amount: 14390,
    barCode: '83640000001087401380076105302611108067159411',
    created: '2020-04-24T17:49:10.225810+00:00',
    description: 'Electricity for the Long Night',
    fee: 200,
    line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
    scheduled: '2020-08-14T10:00:00+00:00',
    status: 'processing',
    tags: [ 'electricity', 'invoice/1234' ],
    transactionIds: [ '5991715760504832' ],
    type: 'utility',
    updated: '2020-04-24T17:49:10.225810+00:00'
}
    

PHP

StarkBank\UtilityPayment Object
(
    [id] => 5950134772826112
    [amount] => 14390
    [barCode] => 83640000001087401380076105302611108067159411
    [created] => DateTime Object
        (
            [date] => 2020-04-24 17:49:10.225810
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [description] => Electricity for the Long Night
    [fee] => 200
    [line] => 83640000001 1 08740138007 0 61053026111 0 08067159411 9
    [scheduled] => DateTime Object
        (
            [date] => 2020-08-14 10:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [status] => processing
    [tags] => Array
        (
            [0] => electricity
            [1] => invoice/1234
        )

    [transactionIds] => Array
        (
            [0] => 5991715760504832
        )

    [type] => utility
    [updated] => DateTime Object
        (
            [date] => 2020-04-24 17:49:10.225810
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
    

Java

UtilityPayment({
    "id": "5950134772826112",
    "amount": 14390,
    "barCode": "83640000001087401380076105302611108067159411",
    "created": "2020-04-24T17:49:10.225810+00:00",
    "description": "Electricity for the Long Night",
    "fee": 200,
    "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    "scheduled": "2020-08-14T10:00:00+00:00",
    "status": "processing",
    "tags": ["electricity", "invoice/1234"],
    "transactionIds": ["5991715760504832"],
    "type": "utility",
    "updated": "2020-04-24T17:49:10.225810+00:00"
})
    

Ruby

utilitypayment(
    id: 5950134772826112,
    amount: 14390,
    bar_code: 83640000001087401380076105302611108067159411,
    created: 2020-04-24T17:49:10+00:00,
    description: Electricity for the Long Night,
    fee: 200,
    line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled: 2020-08-14T10:00:00+00:00,
    status: processing,
    tags: ["electricity", "invoice/1234"],
    transaction_ids: ["5991715760504832"],
    type: utility,
    updated: 2020-04-24T17:49:10+00:00
)
    

Elixir

%StarkBank.UtilityPayment {
    amount: 14390,
    bar_code: "83640000001087401380076105302611108067159411",
    created: ~U[2020-04-24 17:49:10.225810Z],
    description: "Electricity for the Long Night",
    fee: 200,
    id: "5950134772826112",
    line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    scheduled: ~U[2020-08-14 10:00:00Z],
    status: "processing",
    tags: ["electricity", "invoice/1234"],
    transaction_ids: ["5991715760504832"],
    type: "utility",
    updated: ~U[2020-04-24 17:49:10.225810Z]
}
    

C#

UtilityPayment(
    Amount: 14390,
    BarCode: 83640000001087401380076105302611108067159411,
    Created: 04/24/2020 17:49:10,
    Description: Electricity for the Long Night,
    Fee: 200,
    Line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    Scheduled: 08/14/2020 10:00:00,
    Status: processing,
    Tags: { electricity, invoice/1234 },
    TransactionIds: { 5991715760504832 },
    Type: utility,
    Updated: 04/24/2020 17:49:10,
    ID: 5950134772826112
)
    

Go

{
    Id:5950134772826112
    Amount:14390
    BarCode:83640000001087401380076105302611108067159411
    Created:2020-04-24 17:49:10.225810 +0000 +0000
    Description:Electricity for the Long Night
    Fee:200
    Line:83640000001 1 08740138007 0 61053026111 0 08067159411 9
    Scheduled:2020-08-14 10:00:00 +0000 +0000
    Status:processing
    Tags:[electricity invoice/1234]
    TransactionIds:[5991715760504832]
    Type:utility
    Updated:2020-04-24 17:49:10.225810 +0000 +0000
}
    

Clojure

{:amount 14390,
 :fee 200,
 :tags ["electricity" "invoice/1234"],
 :updated "2020-04-24T17:49:10.225810+00:00",
 :description "Electricity for the Long Night",
 :created "2020-04-24T17:49:10.225810+00:00",
 :status "processing",
 :id "5950134772826112",
 :transaction-ids ["5991715760504832"],
 :line "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
 :bar-code "83640000001087401380076105302611108067159411",
 :scheduled "2020-08-14T10:00:00+00:00",
 :type "utility"}
    

Curl

{
    "cursor": null,
    "payments": [
        {
            "id": "5950134772826112",
            "amount": 14390,
            "barCode": "83640000001087401380076105302611108067159411",
            "created": "2020-04-24T17:49:10.225810+00:00",
            "description": "Electricity for the Long Night",
            "fee": 200,
            "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            "scheduled": "2020-08-14T10:00:00+00:00",
            "status": "processing",
            "tags": ["electricity", "invoice/1234"],
            "transactionIds": ["5991715760504832"],
            "type": "utility",
            "updated": "2020-04-24T17:49:10.225810+00:00"
        }
    ]
}
    

Getting a Utility Payment

Get a single Utility Payment by its id.

You can use it to check the current status of a Utility Payment.

Python

import starkbank

payment = starkbank.utilitypayment.get("5950134772826112")

print(payment)
    

Javascript

const starkbank = require('starkbank');

(async() => {
    let payment = await starkbank.utilityPayment.get('5950134772826112');
    console.log(payment);
})();
    

PHP

$payment = StarkBank\UtilityPayment::get("5950134772826112");

print_r($payment);
    

Java

import com.starkbank.*;

UtilityPayment payment = UtilityPayment.get("5950134772826112");

System.out.println(payment);
    

Ruby

require('starkbank')

payment = StarkBank::UtilityPayment.get('5950134772826112')

puts payment
    

Elixir

payment = StarkBank.UtilityPayment.get!("5950134772826112")

payment |> IO.inspect
    

C#

using System;

StarkBank.UtilityPayment payment = StarkBank.UtilityPayment.Get("5950134772826112");

Console.WriteLine(payment);
    

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/utilitypayment"
)

func main() {

    payment, err := utilitypayment.Get("5950134772826112", nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    fmt.Println(payment)
}
    

Clojure

(def payment (starkbank.utility-payment/get "5950134772826112"))

(println payment)
    

Curl

curl --location --request GET '{{baseUrl}}/v2/utility-payment/5950134772826112' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
    
RESPONSE

Python

UtilityPayment(
    amount=14390,
    bar_code=83640000001087401380076105302611108067159411,
    created=2020-04-24 17:49:10.225810,
    description=Electricity for the Long Night,
    fee=200,
    id=5950134772826112,
    line=83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled=2020-08-14 10:00:00,
    status=processing,
    tags=['electricity', 'invoice/1234'],
    transaction_ids=['5991715760504832'],
    type=utility,
    updated=2020-04-24 17:49:10.225810
)
    

Javascript

UtilityPayment {
    id: '5950134772826112',
    amount: 14390,
    barCode: '83640000001087401380076105302611108067159411',
    created: '2020-04-24T17:49:10.225810+00:00',
    description: 'Electricity for the Long Night',
    fee: 200,
    line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
    scheduled: '2020-08-14T10:00:00+00:00',
    status: 'processing',
    tags: [ 'electricity', 'invoice/1234' ],
    transactionIds: [ '5991715760504832' ],
    type: 'utility',
    updated: '2020-04-24T17:49:10.225810+00:00'
}
    

PHP

StarkBank\UtilityPayment Object
(
    [id] => 5950134772826112
    [amount] => 14390
    [barCode] => 83640000001087401380076105302611108067159411
    [created] => DateTime Object
        (
            [date] => 2020-04-24 17:49:10.225810
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [description] => Electricity for the Long Night
    [fee] => 200
    [line] => 83640000001 1 08740138007 0 61053026111 0 08067159411 9
    [scheduled] => DateTime Object
        (
            [date] => 2020-08-14 10:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [status] => processing
    [tags] => Array
        (
            [0] => electricity
            [1] => invoice/1234
        )

    [transactionIds] => Array
        (
            [0] => 5991715760504832
        )

    [type] => utility
    [updated] => DateTime Object
        (
            [date] => 2020-04-24 17:49:10.225810
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
    

Java

UtilityPayment({
    "id": "5950134772826112",
    "amount": 14390,
    "barCode": "83640000001087401380076105302611108067159411",
    "created": "2020-04-24T17:49:10.225810+00:00",
    "description": "Electricity for the Long Night",
    "fee": 200,
    "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    "scheduled": "2020-08-14T10:00:00+00:00",
    "status": "processing",
    "tags": ["electricity", "invoice/1234"],
    "transactionIds": ["5991715760504832"],
    "type": "utility",
    "updated": "2020-04-24T17:49:10.225810+00:00"
})
    

Ruby

utilitypayment(
    id: 5950134772826112,
    amount: 14390,
    bar_code: 83640000001087401380076105302611108067159411,
    created: 2020-04-24T17:49:10+00:00,
    description: Electricity for the Long Night,
    fee: 200,
    line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled: 2020-08-14T10:00:00+00:00,
    status: processing,
    tags: ["electricity", "invoice/1234"],
    transaction_ids: ["5991715760504832"],
    type: utility,
    updated: 2020-04-24T17:49:10+00:00
)
    

Elixir

%StarkBank.UtilityPayment {
    amount: 14390,
    bar_code: "83640000001087401380076105302611108067159411",
    created: ~U[2020-04-24 17:49:10.225810Z],
    description: "Electricity for the Long Night",
    fee: 200,
    id: "5950134772826112",
    line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    scheduled: ~U[2020-08-14 10:00:00Z],
    status: "processing",
    tags: ["electricity", "invoice/1234"],
    transaction_ids: ["5991715760504832"],
    type: "utility",
    updated: ~U[2020-04-24 17:49:10.225810Z]
}
    

C#

UtilityPayment(
    Amount: 14390,
    BarCode: 83640000001087401380076105302611108067159411,
    Created: 04/24/2020 17:49:10,
    Description: Electricity for the Long Night,
    Fee: 200,
    Line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    Scheduled: 08/14/2020 10:00:00,
    Status: processing,
    Tags: { electricity, invoice/1234 },
    TransactionIds: { 5991715760504832 },
    Type: utility,
    Updated: 04/24/2020 17:49:10,
    ID: 5950134772826112
)
    

Go

{
    Id:5950134772826112
    Amount:14390
    BarCode:83640000001087401380076105302611108067159411
    Created:2020-04-24 17:49:10.225810 +0000 +0000
    Description:Electricity for the Long Night
    Fee:200
    Line:83640000001 1 08740138007 0 61053026111 0 08067159411 9
    Scheduled:2020-08-14 10:00:00 +0000 +0000
    Status:processing
    Tags:[electricity invoice/1234]
    TransactionIds:[5991715760504832]
    Type:utility
    Updated:2020-04-24 17:49:10.225810 +0000 +0000
}
    

Clojure

{:amount 14390,
 :fee 200,
 :tags ["electricity" "invoice/1234"],
 :updated "2020-04-24T17:49:10.225810+00:00",
 :description "Electricity for the Long Night",
 :created "2020-04-24T17:49:10.225810+00:00",
 :status "processing",
 :id "5950134772826112",
 :transaction-ids ["5991715760504832"],
 :line "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
 :bar-code "83640000001087401380076105302611108067159411",
 :scheduled "2020-08-14T10:00:00+00:00",
 :type "utility"}
    

Curl

{
    "payment": {
        "id": "5950134772826112",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2020-04-24T17:49:10.225810+00:00",
        "description": "Electricity for the Long Night",
        "fee": 200,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2020-08-14T10:00:00+00:00",
        "status": "processing",
        "tags": ["electricity", "invoice/1234"],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2020-04-24T17:49:10.225810+00:00"
    }
}
    

Canceling Utility Payment

This method will allow the cancellation of a utility payment.

It's important to note that it's only possible to cancel utility payments before the start of processing.

Python

import starkbank

payment = starkbank.utilitypayment.delete("6693962735681536")

print(payment)
    

Javascript

const starkbank = require('starkbank');

(async() => {
    let payment = await starkbank.utilityPayment.delete('6693962735681536');
    console.log(payment);
})();
    

PHP

$payment = StarkBank\UtilityPayment::delete("6693962735681536");

print_r($payment);
    

Java

import com.starkbank.*;

UtilityPayment payment = UtilityPayment.delete("6693962735681536");

System.out.println(payment);
    

Ruby

require('starkbank')

payment = StarkBank::UtilityPayment.delete('6693962735681536')

puts payment
    

Elixir

payment = StarkBank.UtilityPayment.delete!("6693962735681536")

payment |> IO.inspect
    

C#

using System;

StarkBank.UtilityPayment payment = StarkBank.UtilityPayment.Delete("6693962735681536");

Console.WriteLine(payment);
    

Go

package main

import (
    "fmt"
    "github.com/starkbank/sdk-go/starkbank/utilitypayment"
)

func main() {

    payment, err := utilitypayment.Delete("6693962735681536", nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

    fmt.Println(payment)
}
    

Clojure

(def payment (starkbank.utility-payment/delete "6693962735681536"))

(println payment)
    

Curl

curl --location --request DELETE '{{baseUrl}}/v2/utility-payment/6693962735681536' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
    
RESPONSE

Python

UtilityPayment(
    amount=14390,
    bar_code=83640000001087401380076105302611108067159411,
    created=2020-04-24 17:49:10.225810,
    description=Electricity for the Long Night,
    fee=0,
    id=6693962735681536,
    line=83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled=2020-08-14 10:00:00,
    status=canceled,
    tags=['electricity', 'invoice/1234'],
    transaction_ids=[],
    type=utility,
    updated=2020-04-24 17:49:10.225810
)
    

Javascript

UtilityPayment {
    id: '6693962735681536',
    amount: 14390,
    barCode: '83640000001087401380076105302611108067159411',
    created: '2020-04-24T17:49:10.225810+00:00',
    description: 'Electricity for the Long Night',
    fee: 0,
    line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
    scheduled: '2020-08-14T10:00:00+00:00',
    status: 'canceled',
    tags: [ 'electricity', 'invoice/1234' ],
    transactionIds: [],
    type: 'utility',
    updated: '2020-04-24T17:49:10.225810+00:00'
}
    

PHP

StarkBank\UtilityPayment Object
(
    [id] => 6693962735681536
    [amount] => 14390
    [barCode] => 83640000001087401380076105302611108067159411
    [created] => DateTime Object
        (
            [date] => 2020-04-24 17:49:10.225810
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [description] => Electricity for the Long Night
    [fee] => 0
    [line] => 83640000001 1 08740138007 0 61053026111 0 08067159411 9
    [scheduled] => DateTime Object
        (
            [date] => 2020-08-14 10:00:00.000000
            [timezone_type] => 1
            [timezone] => +00:00
        )

    [status] => canceled
    [tags] => Array
        (
            [0] => electricity
            [1] => invoice/1234
        )

    [transactionIds] => Array
        (
        )

    [type] => utility
    [updated] => DateTime Object
        (
            [date] => 2020-04-24 17:49:10.225810
            [timezone_type] => 1
            [timezone] => +00:00
        )

)
    

Java

UtilityPayment({
    "amount": 14390,
    "barCode": "83640000001087401380076105302611108067159411",
    "created": "2020-04-24T17:49:10.225810+00:00",
    "description": "Electricity for the Long Night",
    "fee": 0,
    "id": "6693962735681536",
    "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    "scheduled": "2020-08-14T10:00:00+00:00",
    "status": "canceled",
    "tags": ["electricity", "invoice/1234"],
    "transactionIds": [],
    "type": "utility",
    "updated": "2020-04-24T17:49:10.225810+00:00"
})
    

Ruby

utilitypayment(
    id: 6693962735681536,
    amount: 14390,
    bar_code: 83640000001087401380076105302611108067159411,
    created: 2020-04-24T17:49:10+00:00,
    description: Electricity for the Long Night,
    fee: 0,
    line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    scheduled: 2020-08-14T10:00:00+00:00,
    status: canceled,
    tags: ["electricity", "invoice/1234"],
    transaction_ids: [],
    type: utility,
    updated: 2020-04-24T17:49:10+00:00
)
    

Elixir

%StarkBank.UtilityPayment {
    amount: 14390,
    bar_code: "83640000001087401380076105302611108067159411",
    created: ~U[2020-04-24 17:49:10.225810Z],
    description: "Electricity for the Long Night",
    fee: 0,
    id: "6693962735681536",
    line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
    scheduled: ~U[2020-08-14 10:00:00Z],
    status: "canceled",
    tags: ["electricity", "invoice/1234"],
    transaction_ids: [],
    type: "utility",
    updated: ~U[2020-04-24 17:49:10.225810Z]
}
    

C#

UtilityPayment(
    Amount: 14390,
    BarCode: 83640000001087401380076105302611108067159411,
    Created: 04/24/2020 17:49:10,
    Description: Electricity for the Long Night,
    Fee: 0,
    Line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
    Scheduled: 08/14/2020 10:00:00,
    Status: canceled,
    Tags: { electricity, invoice/1234 },
    TransactionIds: {  },
    Type: utility,
    Updated: 04/24/2020 17:49:10,
    ID: 6693962735681536
)
    

Go

{
    Id:6693962735681536
    Amount:14390
    BarCode:83640000001087401380076105302611108067159411
    Created:2020-04-24 17:49:10.225810 +0000 +0000
    Description:Electricity for the Long Night
    Fee:0
    Line:83640000001 1 08740138007 0 61053026111 0 08067159411 9
    Scheduled:2020-08-14 10:00:00 +0000 +0000
    Status:canceled
    Tags:[electricity invoice/1234]
    TransactionIds:[]
    Type:utility
    Updated:2020-04-24 17:49:10.225810 +0000 +0000
}
    

Clojure

{:amount 14390,
 :fee 0,
 :tags ["electricity" "invoice/1234"],
 :updated "2020-04-24T17:49:10.225810+00:00",
 :description "Electricity for the Long Night",
 :created "2020-04-24T17:49:10.225810+00:00",
 :status "canceled",
 :id "6693962735681536",
 :transaction-ids [],
 :line "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
 :bar-code "83640000001087401380076105302611108067159411",
 :scheduled "2020-08-14T10:00:00+00:00",
 :type "utility"}
    

Curl

{
    "payment": {
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2020-04-24T17:49:10.225810+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "id": "6693962735681536",
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2020-08-14T10:00:00+00:00",
        "status": "canceled",
        "tags": ["electricity", "invoice/1234"],
        "transactionIds": [],
        "type": "utility",
        "updated": "2020-04-24T17:49:10.225810+00:00"
    }
}
    

Receiving Utility Payment Webhook

After creation, you can use asynchronous Webhooks to monitor status changes of the entity. The Utility Payment will follow the following life cycle:

Every time we change a Utility Payment, we create a Log. Logs are pretty useful for understanding the life cycle of each Utility Payment. Whenever a new Log is created, we will fire a Webhook to your registered URL.

NOTE: Check the Webhook Get Started for more details on how to receive and process Webhook events.

NOTE: A utility-payment subscription is required to receive this event.

RESPONSE

Python

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

Javascript

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

PHP

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

Java

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

Ruby

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

Elixir

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

C#

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

Go

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

Clojure

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}
        

Curl

{
  "event": {
    "id": "5258020443389952",
    "subscription": "utility-payment",
    "workspaceId": "6341320293482496",
    "created": "2024-02-01T02:06:27.872660+00:00",
    "log": {
      "id": "4638457385189376",
      "type": "success",
      "created": "2024-02-01T02:06:26.317809+00:00",
      "errors": [],
      "payment": {
        "id": "6679150966341632",
        "amount": 14390,
        "barCode": "83640000001087401380076105302611108067159411",
        "created": "2024-02-01T02:06:26.294998+00:00",
        "description": "Electricity for the Long Night",
        "fee": 0,
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "scheduled": "2024-02-02T10:00:00+00:00",
        "status": "success",
        "tags": [
          "electricity",
          "order/123",
          "customer/456"
        ],
        "transactionIds": ["5991715760504832"],
        "type": "utility",
        "updated": "2024-02-01T02:06:26.317865+00:00"
      }
    }
  }
}