Overview

Setup

Payment Request

Payment Request Overview

The Payment Request Object

Creating a Transfer Payment Request

Creating a Brcode Payment Request

Creating a Boleto Payment Request

Creating a Utility Payment Request

Creating a Tax Payment Request

Creating a Darf Payment Request

Listing Payment Requests

Payment Request

Payment Requests allow you to submit payment orders to be approved via the Web Banking approval flow. Each request is bound to a cost center, and controllers of that cost center can approve, deny, or schedule the payment.

You can request any type of payment supported by Stark Bank, including Transfers, Brcode Payments, Boleto Payments, Utility Payments, Tax Payments, and Darf Payments.

NOTE: Read Core Concepts before continuing this guide.

RESOURCE SUMMARY
Request a Pix or Ted transfer to another bank account
Request a Pix QR code payment
Request a boleto payment
Request a utility bill payment
Request a tax payment with bar code
Request a federal tax payment without bar code (DARF)

Setup

For each environment: (Sandbox or Production)

1. Create an account at Stark Bank.

2. Create a cost center with at least one controller in your Web Banking:

Settings > Cost Centers > New Cost Center

3. Create a webhook with the following subscription to receive events in your desired URL:

payment-request

3.1. Via Internet Banking:

Integrations > Webhook > New Webhook

3.2. Via API:

Use the POST /webhook route to create the webhook

Payment Request Overview

Payment Request is a resource that represents a request to execute a payment through the Web Banking approval flow. Each request is bound to a cost center, and controllers of that center can approve, deny, or schedule the payment.

The payment parameter accepts any of the following types: Transfer, BrcodePayment, BoletoPayment, UtilityPayment, TaxPayment, and DarfPayment.

To create a Payment Request, you need to provide the mandatory parameters: centerId and payment. Optional parameters include due and tags.

The Payment Request Status

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

payment-request-status

StatusDescription
PendingThe Payment Request was created and is waiting for approval.
ApprovedThe Payment Request was approved and the payment is being processed.
ScheduledThe Payment Request was approved and scheduled for the due date.
SuccessThe payment was successfully completed.
CanceledThe Payment Request was canceled before processing.
DeniedThe Payment Request was denied by a cost center controller.
FailedThe payment execution failed.

The Payment Request Object

Attributes

id STRING

Unique id for the payment request.

amount INTEGER

Amount in cents to be paid.

centerId STRING

ID of the targeted cost center.

description STRING

Description of the payment request.

due STRING

Suggested payment date. Example: "2020-04-23".

payment OBJECT

Payment object (Transfer, BrcodePayment, BoletoPayment, UtilityPayment, TaxPayment, or DarfPayment).

type STRING

Payment type. Options: "transfer", "brcode-payment", "boleto-payment", "utility-payment", "tax-payment", "darf-payment".

actions LIST OF OBJECTS

List of actions that have been taken on this payment request (approvals, denials, etc.).

status STRING

Current payment request status. Options: "pending", "approved", "scheduled", "success", "canceled", "denied", "failed".

tags LIST OF STRINGS

Tags associated with the payment request.

created STRING

Creation datetime. Example: "2020-04-23T23:00:00.000000+00:00".

updated STRING

Last update datetime. Example: "2020-04-23T23:00:00.000000+00:00".

Creating a Transfer Payment Request

To request a Transfer payment, pass a Transfer object as the payment parameter.

The Transfer object follows the same structure as a regular Transfer creation. The only exception is that the "scheduled" parameter should not be sent, as the PaymentRequest "due" parameter serves this purpose.

Python

import starkbank

requests = starkbank.paymentrequest.create([
    starkbank.PaymentRequest(
        center_id="4762954029334528",
        payment=starkbank.Transfer(
            amount=100000000,
            bank_code="665",
            branch_code="2201",
            account_number="76543-8",
            tax_id="594.739.480-42",
            name="Daenerys Targaryen Stormborn",
        ),
        tags=["daenerys", "request/1234"]
    ),
])

for request in requests:
    print(request)
  

Javascript

const starkbank = require('starkbank');

let transfer = new starkbank.Transfer({
    amount: 100000000,
    taxId: "594.739.480-42",
    name: "Daenerys Targaryen Stormborn",
    bankCode: "665",
    branchCode: "2201",
    accountNumber: "76543-8"
});

let requests = [
    new starkbank.PaymentRequest({
        centerId: '4762954029334528',
        payment: transfer,
        tags: ["daenerys", "request/1234"],
    })
];

(async() => {
    requests = await starkbank.paymentRequest.create(requests);

    for await (let request of requests){
        console.log(request);
    }
})();
  

PHP

$requests = PaymentRequest::create([
    new PaymentRequest([
        "centerId" => "4762954029334528",
        "payment" => new Transfer([
            "amount" => 100000000,
            "bankCode" => "665",
            "branchCode" => "2201",
            "accountNumber" => "76543-8",
            "taxId" => "594.739.480-42",
            "name" => "Daenerys Targaryen Stormborn",
        ]),
        "tags" => ["daenerys", "request/1234"],
    ])
]);

foreach($requests as $request){
    print_r($request);
}
  

Java

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

HashMap<String, Object> paymentData = new HashMap<>();
paymentData.put("amount", 100000000);
paymentData.put("bankCode", "665");
paymentData.put("branchCode", "2201");
paymentData.put("accountNumber", "76543-8");
paymentData.put("taxId", "594.739.480-42");
paymentData.put("name", "Daenerys Targaryen Stormborn");
Transfer payment = new Transfer(paymentData);

List<PaymentRequest> requests = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("centerId", "4762954029334528");
data.put("payment", payment);
data.put("tags", new String[]{"daenerys", "request/1234"});
requests.add(new PaymentRequest(data));

requests = PaymentRequest.create(requests);

for (PaymentRequest request : requests){
    System.out.println(request);
}
  

Ruby

require('starkbank')

requests = StarkBank::PaymentRequest.create(
  [
    StarkBank::PaymentRequest.new(
      center_id: '4762954029334528',
      payment: StarkBank::Transfer.new(
        amount: 100000000,
        tax_id: '594.739.480-42',
        name: 'Daenerys Targaryen Stormborn',
        bank_code: '665',
        branch_code: '2201',
        account_number: '76543-8'
      ),
      tags: %w[daenerys request/1234]
    )
  ]
)

requests.each do |request|
  puts request
end
  

Elixir

requests = StarkBank.PaymentRequest.create!(
    [
        %StarkBank.PaymentRequest{
            center_id: "4762954029334528",
            payment: %StarkBank.Transfer{
                amount: 100000000,
                bank_code: "665",
                branch_code: "2201",
                account_number: "76543-8",
                tax_id: "594.739.480-42",
                name: "Daenerys Targaryen Stormborn",
            },
            tags: ["daenerys", "request/1234"],
        }
    ]
    ) |> IO.inspect

for request <- requests do
    request |> IO.inspect
end
  

C#

List<StarkBank.PaymentRequest> requests = StarkBank.PaymentRequest.Create(
    new List<StarkBank.PaymentRequest> {
        new StarkBank.PaymentRequest(
            centerID: "4762954029334528",
            payment: new StarkBank.Transfer(
                amount: 100000000,
                bankCode: "665",
                branchCode: "2201",
                accountNumber: "76543-8",
                taxID: "594.739.480-42",
                name: "Daenerys Targaryen Stormborn"
            ),
            tags: new List<string> { "daenerys", "request/1234" }
        )
    }
);

foreach(StarkBank.PaymentRequest request in requests) {
    Console.WriteLine(request);
}
  

Go

package main

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

func main() {

    requests, err := paymentrequest.Create(
        []paymentrequest.PaymentRequest{
            {
                CenterId: "4762954029334528",
                Payment:  transfer.Transfer{
                    Amount:        100000000,
                    BankCode:      "665",
                    BranchCode:    "2201",
                    AccountNumber: "76543-8",
                    TaxId:         "594.739.480-42",
                    Name:          "Daenerys Targaryen Stormborn",
                },
                Tags:     []string{"daenerys", "request/1234"},
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def payment {
    :amount 100000000
    :bank-code "665"
    :branch-code "2201"
    :account-number "76543-8"
    :tax-id "594.739.480-42"
    :name "Daenerys Targaryen Stormborn"
})

(def payment-requests (starkbank.payment-request/create
[{
    :type "transfer"
    :payment payment
    :center-id "4762954029334528"
    :tags ["daenerys" "request/1234"]
}]))

(doseq [request payment-requests]
    (println request))
  

Curl

curl --location --request POST '{{baseUrl}}/v2/payment-request' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "requests": [
        {
            "centerId": "4762954029334528",
            "type": "transfer",
            "payment": {
                "amount": 100000000,
                "taxId": "594.739.480-42",
                "name": "Daenerys Targaryen Stormborn",
                "bankCode": "665",
                "branchCode": "2201",
                "accountNumber": "76543-8"
            },
            "tags": ["daenerys", "request/1234"]
        }
    ]
}'
  
RESPONSE

Python

PaymentRequest(
    actions=[
        {
            'name': 'SDK Python',
            'action': 'requested',
            'type': 'project',
            'id': '5414728075575296'
        },
        {
            'name': 'Rhaegar Targaryen',
            'action': 'required',
            'type': 'member',
            'id': '6025356662276096'
        }
    ],
    amount=100000000,
    center_id=4762954029334528,
    created=2020-10-23T19:36:59.345753,
    due=2020-10-24T03:00:00+00:00,
    id=5756591424929792,
    payment=Transfer(
        account_number=76543-8,
        amount=100000000,
        bank_code=665,
        branch_code=2201,
        name=Daenerys Targaryen Stormborn,
        tax_id=594.739.480-42
    ),
    status=pending,
    tags=['daenerys', 'request/1234'],
    type=transfer,
    description=Daenerys Targaryen Stormborn (594.739.480-42),
    updated=2020-10-23T19:36:59.345760+00:00
)
  

Javascript

PaymentRequest {
    id: '5756591424929792',
    centerId: '4762954029334528',
    due: '2020-10-24T03:00:00.000000+00:00',
    tags: [ 'daenerys', 'request/1234' ],
    amount: 100000000,
    status: 'pending',
    actions: [
        {
            name: 'SDK Node',
            action: 'requested',
            type: 'project',
            id: '5414728075575296'
        },
        {
            name: 'Rhaegar Targaryen',
            action: 'required',
            type: 'member',
            id: '6025356662276096'
        }
    ],
    updated: '2020-10-23T19:36:59.345753+00:00',
    created: '2020-10-23T19:36:59.345753+00:00',
    payment: {
        name: 'Daenerys Targaryen Stormborn',
        accountNumber: '76543-8',
        taxId: '594.739.480-42',
        amount: 100000000,
        bankCode: '665',
        branchCode: '2201'
    },
    type: 'transfer',
    description: 'Daenerys Targaryen Stormborn (594.739.480-42)'
}
  

PHP

StarkBank\PaymentRequest Object
(
    [id] => 5756591424929792
    [centerId] => 4762954029334528
    [due] => 2020-10-24T03:00:00.000000+00:00
    [description] => Daenerys Targaryen Stormborn (594.739.480-42)
    [tags] => Array
        (
            [0] => daenerys
            [1] => request/1234
        )
    [amount] => 100000000
    [status] => pending
    [type] => transfer
    [payment] => StarkBank\Transfer Object
        (
            [amount] => 100000000
            [name] => Daenerys Targaryen Stormborn
            [taxId] => 594.739.480-42
            [bankCode] => 665
            [branchCode] => 2201
            [accountNumber] => 76543-8
        )
    [created] => DateTime Object
        (
            [date] => 2020-10-23 19:36:59.988289
        )
    [updated] => DateTime Object
        (
            [date] => 2020-10-23 19:36:59.988295
        )
)
  

Java

PaymentRequest({
    "centerId": "4762954029334528",
    "payment": {
        "amount": 100000000,
        "name": "Daenerys Targaryen Stormborn",
        "taxId": "594.739.480-42",
        "bankCode": "665",
        "branchCode": "2201",
        "accountNumber": "76543-8"
    },
    "type": "transfer",
    "due": "2020-10-24T03:00:00+00:00",
    "tags": ["daenerys", "request/1234"],
    "amount": 100000000,
    "status": "pending",
    "description": "Daenerys Targaryen Stormborn (594.739.480-42)",
    "id": "5756591424929792"
})
  

Ruby

paymentrequest(
    payment: transfer(
        amount: 100000000,
        name: Daenerys Targaryen Stormborn,
        tax_id: 594.739.480-42,
        bank_code: 665,
        branch_code: 2201,
        account_number: 76543-8
    ),
    type: transfer,
    id: 5756591424929792,
    center_id: 4762954029334528,
    due: 2020-10-24T03:00:00.000000+00:00,
    tags: %[daenerys request/1234],
    amount: 100000000,
    status: pending,
    description: Daenerys Targaryen Stormborn (594.739.480-42)
)
  

Elixir

%StarkBank.PaymentRequest{
    amount: 100000000,
    center_id: "4762954029334528",
    created: ~U[2020-10-23 19:36:59.858275Z],
    description: "Daenerys Targaryen Stormborn (594.739.480-42)",
    due: ~U[2020-10-24 03:00:00.000000Z],
    id: "5756591424929792",
    payment: %StarkBank.Transfer{
        account_number: "76543-8",
        amount: 100000000,
        bank_code: "665",
        branch_code: "2201",
        name: "Daenerys Targaryen Stormborn",
        tax_id: "594.739.480-42"
    },
    status: "pending",
    tags: ["daenerys", "request/1234"],
    type: "transfer",
    updated: ~U[2020-10-23 19:36:59.858283Z]
}
  

C#

PaymentRequest(
    CenterID: 4762954029334528,
    Payment: Transfer(
        Amount: 100000000,
        Name: Daenerys Targaryen Stormborn,
        TaxID: 594.739.480-42,
        BankCode: 665,
        BranchCode: 2201,
        AccountNumber: 76543-8
    ),
    Type: transfer,
    Description: Daenerys Targaryen Stormborn (594.739.480-42),
    Due: 24/10/2020 03:00:00,
    Tags: { daenerys request/1234 },
    Amount: 100000000,
    Status: pending,
    ID: 5756591424929792
)
  

Go

{
    CenterId:4762954029334528
    Payment:{
        Name:Daenerys Targaryen Stormborn
        AccountNumber:76543-8
        TaxId:594.739.480-42
        Amount:100000000
        BankCode:665
        BranchCode:2201
    }
    Type:transfer
    Due:2020-10-24 03:00:00.000000 +0000 +0000
    Tags:[daenerys request/1234]
    Amount:100000000
    Status:pending
    Description:Daenerys Targaryen Stormborn (594.739.480-42)
    Id:5756591424929792
}
  

Clojure

{
    :amount 100000000,
    :tags [daenerys request/1234],
    :center-id 4762954029334528,
    :payment {
        :amount 100000000,
        :name Daenerys Targaryen Stormborn,
        :account-number 76543-8,
        :tax-id 594.739.480-42,
        :bank-code 665,
        :branch-code 2201
    },
    :type transfer,
    :description Daenerys Targaryen Stormborn (594.739.480-42),
    :due 2020-10-24T03:00:00.000000+00:00,
    :status pending,
    :id 5756591424929792
}
  

Curl

{
    "message": "Payment Request(s) successfully created",
    "requests": [
        {
            "id": "5756591424929792",
            "centerId": "4762954029334528",
            "type": "transfer",
            "payment": {
                "amount": 100000000,
                "taxId": "594.739.480-42",
                "name": "Daenerys Targaryen Stormborn",
                "bankCode": "665",
                "branchCode": "2201",
                "accountNumber": "76543-8"
            },
            "due": "2020-10-24T03:00:00.000000+00:00",
            "tags": ["daenerys", "request/1234"],
            "amount": 100000000,
            "status": "pending",
            "description": "Daenerys Targaryen Stormborn (594.739.480-42)",
            "created": "2020-10-23T19:36:59.799815+00:00",
            "updated": "2020-10-23T19:36:59.799815+00:00"
        }
    ]
}
  

Creating a Brcode Payment Request

To request a Brcode (Pix QR code) payment, pass a BrcodePayment object as the payment parameter.

The BrcodePayment object follows the same structure as a regular Brcode Payment creation.

Python

import starkbank

requests = starkbank.paymentrequest.create([
    starkbank.PaymentRequest(
        center_id="4762954029334528",
        payment=starkbank.BrcodePayment(
            brcode="00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF",
            tax_id="012.345.678-90",
            description="this will be fast",
        ),
        tags=["brcode", "request/5678"]
    ),
])

for request in requests:
    print(request)
  

Javascript

const starkbank = require('starkbank');

let brcodePayment = new starkbank.BrcodePayment({
    brcode: '00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF',
    taxId: '012.345.678-90',
    description: 'this will be fast'
});

let requests = [
    new starkbank.PaymentRequest({
        centerId: '4762954029334528',
        payment: brcodePayment,
        tags: ["brcode", "request/5678"],
    })
];

(async() => {
    requests = await starkbank.paymentRequest.create(requests);

    for await (let request of requests){
        console.log(request);
    }
})();
  

PHP

$requests = PaymentRequest::create([
    new PaymentRequest([
        "centerId" => "4762954029334528",
        "payment" => new BrcodePayment([
            "brcode" => "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF",
            "taxId" => "012.345.678-90",
            "description" => "this will be fast",
        ]),
        "tags" => ["brcode", "request/5678"],
    ])
]);

foreach($requests as $request){
    print_r($request);
}
  

Java

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

HashMap<String, Object> paymentData = new HashMap<>();
paymentData.put("brcode", "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF");
paymentData.put("taxId", "012.345.678-90");
paymentData.put("description", "this will be fast");
BrcodePayment payment = new BrcodePayment(paymentData);

List<PaymentRequest> requests = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("centerId", "4762954029334528");
data.put("payment", payment);
data.put("tags", new String[]{"brcode", "request/5678"});
requests.add(new PaymentRequest(data));

requests = PaymentRequest.create(requests);

for (PaymentRequest request : requests){
    System.out.println(request);
}
  

Ruby

require('starkbank')

requests = StarkBank::PaymentRequest.create(
  [
    StarkBank::PaymentRequest.new(
      center_id: '4762954029334528',
      payment: StarkBank::BrcodePayment.new(
        brcode: '00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF',
        tax_id: '012.345.678-90',
        description: 'this will be fast'
      ),
      tags: %w[brcode request/5678]
    )
  ]
)

requests.each do |request|
  puts request
end
  

Elixir

requests = StarkBank.PaymentRequest.create!(
    [
        %StarkBank.PaymentRequest{
            center_id: "4762954029334528",
            payment: %StarkBank.BrcodePayment{
                brcode: "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF",
                tax_id: "012.345.678-90",
                description: "this will be fast",
            },
            tags: ["brcode", "request/5678"],
        }
    ]
    ) |> IO.inspect

for request <- requests do
    request |> IO.inspect
end
  

C#

List<StarkBank.PaymentRequest> requests = StarkBank.PaymentRequest.Create(
    new List<StarkBank.PaymentRequest> {
        new StarkBank.PaymentRequest(
            centerID: "4762954029334528",
            payment: new StarkBank.BrcodePayment(
                brcode: "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF",
                taxID: "012.345.678-90",
                description: "this will be fast"
            ),
            tags: new List<string> { "brcode", "request/5678" }
        )
    }
);

foreach(StarkBank.PaymentRequest request in requests) {
    Console.WriteLine(request);
}
  

Go

package main

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

func main() {

    requests, err := paymentrequest.Create(
        []paymentrequest.PaymentRequest{
            {
                CenterId: "4762954029334528",
                Payment:  brcodepayment.BrcodePayment{
                    Brcode:      "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF",
                    TaxId:       "012.345.678-90",
                    Description: "this will be fast",
                },
                Tags:     []string{"brcode", "request/5678"},
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def payment {
    :brcode "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF"
    :tax-id "012.345.678-90"
    :description "this will be fast"
})

(def payment-requests (starkbank.payment-request/create
[{
    :type "brcode-payment"
    :payment payment
    :center-id "4762954029334528"
    :tags ["brcode" "request/5678"]
}]))

(doseq [request payment-requests]
    (println request))
  

Curl

curl --location --request POST '{{baseUrl}}/v2/payment-request' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "requests": [
        {
            "centerId": "4762954029334528",
            "type": "brcode-payment",
            "payment": {
                "brcode": "00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec525855204000053039865802BR5925Stark Bank S.A. - Institu6009Sao Paulo62070503***63044DDF",
                "taxId": "012.345.678-90",
                "description": "this will be fast"
            },
            "tags": ["brcode", "request/5678"]
        }
    ]
}'
  
RESPONSE

Python

PaymentRequest(
    actions=[
        {
            'name': 'SDK Python',
            'action': 'requested',
            'type': 'project',
            'id': '5414728075575296'
        },
        {
            'name': 'Rhaegar Targaryen',
            'action': 'required',
            'type': 'member',
            'id': '6025356662276096'
        }
    ],
    amount=123456,
    center_id=4762954029334528,
    created=2020-10-23T19:36:59.345753,
    due=2020-10-24T03:00:00+00:00,
    id=5756591424929792,
    payment=BrcodePayment(
        brcode=00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec52585,
        tax_id=012.345.678-90,
        description=this will be fast
    ),
    status=pending,
    tags=['brcode', 'request/5678'],
    type=brcode-payment,
    updated=2020-10-23T19:36:59.345760+00:00
)
  

Javascript

PaymentRequest {
    id: '5756591424929792',
    centerId: '4762954029334528',
    due: '2020-10-24T03:00:00.000000+00:00',
    tags: [ 'brcode', 'request/5678' ],
    amount: 123456,
    status: 'pending',
    actions: [
        {
            name: 'SDK Node',
            action: 'requested',
            type: 'project',
            id: '5414728075575296'
        },
        {
            name: 'Rhaegar Targaryen',
            action: 'required',
            type: 'member',
            id: '6025356662276096'
        }
    ],
    payment: {
        brcode: '00020101021226890014br.gov.bcb.pix2567brcode-h.sandbox.starkinfra.com/v2/ace289aac1ce453b9ca64fb12ec52585',
        taxId: '012.345.678-90',
        description: 'this will be fast'
    },
    type: 'brcode-payment'
}
  

PHP

StarkBank\PaymentRequest Object
(
    [id] => 5756591424929792
    [centerId] => 4762954029334528
    [amount] => 123456
    [status] => pending
    [type] => brcode-payment
    [tags] => Array
        (
            [0] => brcode
            [1] => request/5678
        )
    [actions] => Array
        (
            [0] => Array
                (
                    [name] => SDK PHP
                    [action] => requested
                    [type] => project
                    [id] => 5414728075575296
                )
            [1] => Array
                (
                    [name] => Rhaegar Targaryen
                    [action] => required
                    [type] => member
                    [id] => 6025356662276096
                )
        )
    [payment] => StarkBank\BrcodePayment Object
        (
            [brcode] => 00020101021226890014br.gov.bcb.pix...
            [taxId] => 012.345.678-90
            [description] => this will be fast
        )
)
  

Java

PaymentRequest({
    "centerId": "4762954029334528",
    "payment": {
        "brcode": "00020101021226890014br.gov.bcb.pix...",
        "taxId": "012.345.678-90",
        "description": "this will be fast"
    },
    "type": "brcode-payment",
    "tags": ["brcode", "request/5678"],
    "amount": 123456,
    "status": "pending",
    "actions": [
        {
            "name": "SDK Java",
            "action": "requested",
            "type": "project",
            "id": "5414728075575296"
        },
        {
            "name": "Rhaegar Targaryen",
            "action": "required",
            "type": "member",
            "id": "6025356662276096"
        }
    ],
    "id": "5756591424929792"
})
  

Ruby

paymentrequest(
    actions: [
    {
        "name"=>"SDK Ruby",
        "action"=>"requested",
        "type"=>"project",
        "id"=>"5414728075575296"
    },
    {
        "name"=>"Rhaegar Targaryen",
        "action"=>"required",
        "type"=>"member",
        "id"=>"6025356662276096"
    }],
    payment: brcodepayment(
        brcode: 00020101021226890014br.gov.bcb.pix...,
        tax_id: 012.345.678-90,
        description: this will be fast
    ),
    type: brcode-payment,
    id: 5756591424929792,
    center_id: 4762954029334528,
    tags: %[brcode request/5678],
    amount: 123456,
    status: pending
)
  

Elixir

%StarkBank.PaymentRequest{
    actions: [
        %{
            "action" => "requested",
            "id" => "5414728075575296",
            "name" => "SDK Elixir",
            "type" => "project"
        },
        %{
            "action" => "required",
            "id" => "6025356662276096",
            "name" => "Rhaegar Targaryen",
            "type" => "member"
        }
    ],
    amount: 123456,
    center_id: "4762954029334528",
    id: "5756591424929792",
    payment: %StarkBank.BrcodePayment{
        brcode: "00020101021226890014br.gov.bcb.pix...",
        tax_id: "012.345.678-90",
        description: "this will be fast"
    },
    status: "pending",
    tags: ["brcode", "request/5678"],
    type: "brcode-payment"
}
  

C#

PaymentRequest(
    CenterID: 4762954029334528,
    Payment: BrcodePayment(
        Brcode: 00020101021226890014br.gov.bcb.pix...,
        TaxID: 012.345.678-90,
        Description: this will be fast
    ),
    Type: brcode-payment,
    Tags: { brcode request/5678 },
    Amount: 123456,
    Status: pending,
    Actions: {
    {
        { name, SDK C# },
        { action, requested },
        { type, project },
        { id, 5414728075575296 }
    },
    {
        { name, Rhaegar Targaryen },
        { action, required },
        { type, member },
        { id, 6025356662276096 }
    } },
    ID: 5756591424929792
)
  

Go

{
    CenterId:4762954029334528
    Payment:{
        Brcode:00020101021226890014br.gov.bcb.pix...
        TaxId:012.345.678-90
        Description:this will be fast
    }
    Type:brcode-payment
    Tags:[brcode request/5678]
    Amount:123456
    Status:pending
    Actions:[
        map[
            action:requested
            id:5414728075575296
            name:SDK Go
            type:project
        ]
        map[
            action:required
            id:6025356662276096
            name:Rhaegar Targaryen
            type:member
        ]
    ]
    Id:5756591424929792
}
  

Clojure

{
    :amount 123456,
    :tags [brcode request/5678],
    :center-id 4762954029334528,
    :actions [
        {
            :name SDK Clojure,
            :action requested,
            :type project,
            :id 5414728075575296
        },
        {
            :name Rhaegar Targaryen,
            :action required,
            :type member,
            :id 6025356662276096
        }
    ],
    :payment {
        :brcode 00020101021226890014br.gov.bcb.pix...,
        :tax-id 012.345.678-90,
        :description this will be fast
    },
    :type brcode-payment,
    :status pending,
    :id 5756591424929792
}
  

Curl

{
    "message": "Payment Request(s) successfully created",
    "requests": [
        {
            "id": "5756591424929792",
            "centerId": "4762954029334528",
            "type": "brcode-payment",
            "payment": {
                "brcode": "00020101021226890014br.gov.bcb.pix...",
                "taxId": "012.345.678-90",
                "description": "this will be fast"
            },
            "tags": ["brcode", "request/5678"],
            "amount": 123456,
            "actions": [
                {
                    "action": "requested",
                    "type": "project",
                    "id": "5414728075575296",
                    "name": "Curl"
                },
                {
                    "action": "required",
                    "type": "member",
                    "id": "6025356662276096",
                    "name": "Rhaegar Targaryen"
                }
            ],
            "status": "pending",
            "created": "2020-10-23T19:36:59.799815+00:00",
            "updated": "2020-10-23T19:36:59.799815+00:00"
        }
    ]
}
  

Creating a Boleto Payment Request

To request a Boleto payment, pass a BoletoPayment object as the payment parameter.

The BoletoPayment object follows the same structure as a regular Boleto Payment creation.

Python

import starkbank

requests = starkbank.paymentrequest.create([
    starkbank.PaymentRequest(
        center_id="4762954029334528",
        payment=starkbank.BoletoPayment(
            line="34191.09107 05447.947309 71544.640008 8 84660000011631",
            tax_id="38.435.677/0001-25",
            description="Payment for killing white walkers",
        ),
        tags=["boleto", "request/9012"]
    ),
])

for request in requests:
    print(request)
  

Javascript

const starkbank = require('starkbank');

let boletoPayment = new starkbank.BoletoPayment({
    line: '34191.09107 05447.947309 71544.640008 8 84660000011631',
    taxId: '38.435.677/0001-25',
    description: 'Payment for killing white walkers'
});

let requests = [
    new starkbank.PaymentRequest({
        centerId: '4762954029334528',
        payment: boletoPayment,
        tags: ["boleto", "request/9012"],
    })
];

(async() => {
    requests = await starkbank.paymentRequest.create(requests);

    for await (let request of requests){
        console.log(request);
    }
})();
  

PHP

$requests = PaymentRequest::create([
    new PaymentRequest([
        "centerId" => "4762954029334528",
        "payment" => new BoletoPayment([
            "line" => "34191.09107 05447.947309 71544.640008 8 84660000011631",
            "taxId" => "38.435.677/0001-25",
            "description" => "Payment for killing white walkers",
        ]),
        "tags" => ["boleto", "request/9012"],
    ])
]);

foreach($requests as $request){
    print_r($request);
}
  

Java

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

HashMap<String, Object> paymentData = new HashMap<>();
paymentData.put("line", "34191.09107 05447.947309 71544.640008 8 84660000011631");
paymentData.put("taxId", "38.435.677/0001-25");
paymentData.put("description", "Payment for killing white walkers");
BoletoPayment payment = new BoletoPayment(paymentData);

List<PaymentRequest> requests = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("centerId", "4762954029334528");
data.put("payment", payment);
data.put("tags", new String[]{"boleto", "request/9012"});
requests.add(new PaymentRequest(data));

requests = PaymentRequest.create(requests);

for (PaymentRequest request : requests){
    System.out.println(request);
}
  

Ruby

require('starkbank')

requests = StarkBank::PaymentRequest.create(
  [
    StarkBank::PaymentRequest.new(
      center_id: '4762954029334528',
      payment: StarkBank::BoletoPayment.new(
        line: '34191.09107 05447.947309 71544.640008 8 84660000011631',
        tax_id: '38.435.677/0001-25',
        description: 'Payment for killing white walkers'
      ),
      tags: %w[boleto request/9012]
    )
  ]
)

requests.each do |request|
  puts request
end
  

Elixir

requests = StarkBank.PaymentRequest.create!(
    [
        %StarkBank.PaymentRequest{
            center_id: "4762954029334528",
            payment: %StarkBank.BoletoPayment{
                line: "34191.09107 05447.947309 71544.640008 8 84660000011631",
                tax_id: "38.435.677/0001-25",
                description: "Payment for killing white walkers",
            },
            tags: ["boleto", "request/9012"],
        }
    ]
    ) |> IO.inspect

for request <- requests do
    request |> IO.inspect
end
  

C#

List<StarkBank.PaymentRequest> requests = StarkBank.PaymentRequest.Create(
    new List<StarkBank.PaymentRequest> {
        new StarkBank.PaymentRequest(
            centerID: "4762954029334528",
            payment: new StarkBank.BoletoPayment(
                line: "34191.09107 05447.947309 71544.640008 8 84660000011631",
                taxID: "38.435.677/0001-25",
                description: "Payment for killing white walkers"
            ),
            tags: new List<string> { "boleto", "request/9012" }
        )
    }
);

foreach(StarkBank.PaymentRequest request in requests) {
    Console.WriteLine(request);
}
  

Go

package main

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

func main() {

    requests, err := paymentrequest.Create(
        []paymentrequest.PaymentRequest{
            {
                CenterId: "4762954029334528",
                Payment:  boletopayment.BoletoPayment{
                    Line:        "34191.09107 05447.947309 71544.640008 8 84660000011631",
                    TaxId:       "38.435.677/0001-25",
                    Description: "Payment for killing white walkers",
                },
                Tags:     []string{"boleto", "request/9012"},
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def payment {
    :line "34191.09107 05447.947309 71544.640008 8 84660000011631"
    :tax-id "38.435.677/0001-25"
    :description "Payment for killing white walkers"
})

(def payment-requests (starkbank.payment-request/create
[{
    :type "boleto-payment"
    :payment payment
    :center-id "4762954029334528"
    :tags ["boleto" "request/9012"]
}]))

(doseq [request payment-requests]
    (println request))
  

Curl

curl --location --request POST '{{baseUrl}}/v2/payment-request' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "requests": [
        {
            "centerId": "4762954029334528",
            "type": "boleto-payment",
            "payment": {
                "line": "34191.09107 05447.947309 71544.640008 8 84660000011631",
                "taxId": "38.435.677/0001-25",
                "description": "Payment for killing white walkers"
            },
            "tags": ["boleto", "request/9012"]
        }
    ]
}'
  
RESPONSE

Python

PaymentRequest(
    actions=[
        {
            'name': 'SDK Python',
            'action': 'requested',
            'type': 'project',
            'id': '5414728075575296'
        },
        {
            'name': 'Rhaegar Targaryen',
            'action': 'required',
            'type': 'member',
            'id': '6025356662276096'
        }
    ],
    amount=11631,
    center_id=4762954029334528,
    created=2020-10-23T19:36:59.345753,
    due=2020-10-24T03:00:00+00:00,
    id=5756591424929792,
    payment=BoletoPayment(
        line=34191.09107 05447.947309 71544.640008 8 84660000011631,
        tax_id=38.435.677/0001-25,
        description=Payment for killing white walkers
    ),
    status=pending,
    tags=['boleto', 'request/9012'],
    type=boleto-payment,
    updated=2020-10-23T19:36:59.345760+00:00
)
  

Javascript

PaymentRequest {
    id: '5756591424929792',
    centerId: '4762954029334528',
    tags: [ 'boleto', 'request/9012' ],
    amount: 11631,
    status: 'pending',
    actions: [
        {
            name: 'SDK Node',
            action: 'requested',
            type: 'project',
            id: '5414728075575296'
        },
        {
            name: 'Rhaegar Targaryen',
            action: 'required',
            type: 'member',
            id: '6025356662276096'
        }
    ],
    payment: {
        line: '34191.09107 05447.947309 71544.640008 8 84660000011631',
        taxId: '38.435.677/0001-25',
        description: 'Payment for killing white walkers'
    },
    type: 'boleto-payment'
}
  

PHP

StarkBank\PaymentRequest Object
(
    [id] => 5756591424929792
    [centerId] => 4762954029334528
    [amount] => 11631
    [status] => pending
    [type] => boleto-payment
    [tags] => Array
        (
            [0] => boleto
            [1] => request/9012
        )
    [actions] => Array
        (
            [0] => Array
                (
                    [name] => SDK PHP
                    [action] => requested
                    [type] => project
                    [id] => 5414728075575296
                )
            [1] => Array
                (
                    [name] => Rhaegar Targaryen
                    [action] => required
                    [type] => member
                    [id] => 6025356662276096
                )
        )
    [payment] => StarkBank\BoletoPayment Object
        (
            [line] => 34191.09107 05447.947309 71544.640008 8 84660000011631
            [taxId] => 38.435.677/0001-25
            [description] => Payment for killing white walkers
        )
)
  

Java

PaymentRequest({
    "centerId": "4762954029334528",
    "payment": {
        "line": "34191.09107 05447.947309 71544.640008 8 84660000011631",
        "taxId": "38.435.677/0001-25",
        "description": "Payment for killing white walkers"
    },
    "type": "boleto-payment",
    "tags": ["boleto", "request/9012"],
    "amount": 11631,
    "status": "pending",
    "actions": [
        {
            "name": "SDK Java",
            "action": "requested",
            "type": "project",
            "id": "5414728075575296"
        },
        {
            "name": "Rhaegar Targaryen",
            "action": "required",
            "type": "member",
            "id": "6025356662276096"
        }
    ],
    "id": "5756591424929792"
})
  

Ruby

paymentrequest(
    actions: [
    {
        "name"=>"SDK Ruby",
        "action"=>"requested",
        "type"=>"project",
        "id"=>"5414728075575296"
    },
    {
        "name"=>"Rhaegar Targaryen",
        "action"=>"required",
        "type"=>"member",
        "id"=>"6025356662276096"
    }],
    payment: boletopayment(
        line: 34191.09107 05447.947309 71544.640008 8 84660000011631,
        tax_id: 38.435.677/0001-25,
        description: Payment for killing white walkers
    ),
    type: boleto-payment,
    id: 5756591424929792,
    center_id: 4762954029334528,
    tags: %[boleto request/9012],
    amount: 11631,
    status: pending
)
  

Elixir

%StarkBank.PaymentRequest{
    actions: [
        %{
            "action" => "requested",
            "id" => "5414728075575296",
            "name" => "SDK Elixir",
            "type" => "project"
        },
        %{
            "action" => "required",
            "id" => "6025356662276096",
            "name" => "Rhaegar Targaryen",
            "type" => "member"
        }
    ],
    amount: 11631,
    center_id: "4762954029334528",
    id: "5756591424929792",
    payment: %StarkBank.BoletoPayment{
        line: "34191.09107 05447.947309 71544.640008 8 84660000011631",
        tax_id: "38.435.677/0001-25",
        description: "Payment for killing white walkers"
    },
    status: "pending",
    tags: ["boleto", "request/9012"],
    type: "boleto-payment"
}
  

C#

PaymentRequest(
    CenterID: 4762954029334528,
    Payment: BoletoPayment(
        Line: 34191.09107 05447.947309 71544.640008 8 84660000011631,
        TaxID: 38.435.677/0001-25,
        Description: Payment for killing white walkers
    ),
    Type: boleto-payment,
    Tags: { boleto request/9012 },
    Amount: 11631,
    Status: pending,
    Actions: {
    {
        { name, SDK C# },
        { action, requested },
        { type, project },
        { id, 5414728075575296 }
    },
    {
        { name, Rhaegar Targaryen },
        { action, required },
        { type, member },
        { id, 6025356662276096 }
    } },
    ID: 5756591424929792
)
  

Go

{
    CenterId:4762954029334528
    Payment:{
        Line:34191.09107 05447.947309 71544.640008 8 84660000011631
        TaxId:38.435.677/0001-25
        Description:Payment for killing white walkers
    }
    Type:boleto-payment
    Tags:[boleto request/9012]
    Amount:11631
    Status:pending
    Actions:[
        map[
            action:requested
            id:5414728075575296
            name:SDK Go
            type:project
        ]
        map[
            action:required
            id:6025356662276096
            name:Rhaegar Targaryen
            type:member
        ]
    ]
    Id:5756591424929792
}
  

Clojure

{
    :amount 11631,
    :tags [boleto request/9012],
    :center-id 4762954029334528,
    :actions [
        {
            :name SDK Clojure,
            :action requested,
            :type project,
            :id 5414728075575296
        },
        {
            :name Rhaegar Targaryen,
            :action required,
            :type member,
            :id 6025356662276096
        }
    ],
    :payment {
        :line 34191.09107 05447.947309 71544.640008 8 84660000011631,
        :tax-id 38.435.677/0001-25,
        :description Payment for killing white walkers
    },
    :type boleto-payment,
    :status pending,
    :id 5756591424929792
}
  

Curl

{
    "message": "Payment Request(s) successfully created",
    "requests": [
        {
            "id": "5756591424929792",
            "centerId": "4762954029334528",
            "type": "boleto-payment",
            "payment": {
                "line": "34191.09107 05447.947309 71544.640008 8 84660000011631",
                "taxId": "38.435.677/0001-25",
                "description": "Payment for killing white walkers"
            },
            "tags": ["boleto", "request/9012"],
            "amount": 11631,
            "actions": [
                {
                    "action": "requested",
                    "type": "project",
                    "id": "5414728075575296",
                    "name": "Curl"
                },
                {
                    "action": "required",
                    "type": "member",
                    "id": "6025356662276096",
                    "name": "Rhaegar Targaryen"
                }
            ],
            "status": "pending",
            "created": "2020-10-23T19:36:59.799815+00:00",
            "updated": "2020-10-23T19:36:59.799815+00:00"
        }
    ]
}
  

Creating a Utility Payment Request

To request a Utility payment, pass a UtilityPayment object as the payment parameter.

The UtilityPayment object follows the same structure as a regular Utility Payment creation.

Python

import starkbank

requests = starkbank.paymentrequest.create([
    starkbank.PaymentRequest(
        center_id="4762954029334528",
        payment=starkbank.UtilityPayment(
            line="83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            description="Electricity for the Long Night",
        ),
        tags=["utility", "request/3456"]
    ),
])

for request in requests:
    print(request)
  

Javascript

const starkbank = require('starkbank');

let utilityPayment = new starkbank.UtilityPayment({
    line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
    description: 'Electricity for the Long Night'
});

let requests = [
    new starkbank.PaymentRequest({
        centerId: '4762954029334528',
        payment: utilityPayment,
        tags: ["utility", "request/3456"],
    })
];

(async() => {
    requests = await starkbank.paymentRequest.create(requests);

    for await (let request of requests){
        console.log(request);
    }
})();
  

PHP

$requests = PaymentRequest::create([
    new PaymentRequest([
        "centerId" => "4762954029334528",
        "payment" => new UtilityPayment([
            "line" => "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
            "description" => "Electricity for the Long Night",
        ]),
        "tags" => ["utility", "request/3456"],
    ])
]);

foreach($requests as $request){
    print_r($request);
}
  

Java

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

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

List<PaymentRequest> requests = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("centerId", "4762954029334528");
data.put("payment", payment);
data.put("tags", new String[]{"utility", "request/3456"});
requests.add(new PaymentRequest(data));

requests = PaymentRequest.create(requests);

for (PaymentRequest request : requests){
    System.out.println(request);
}
  

Ruby

require('starkbank')

requests = StarkBank::PaymentRequest.create(
  [
    StarkBank::PaymentRequest.new(
      center_id: '4762954029334528',
      payment: StarkBank::UtilityPayment.new(
        line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
        description: 'Electricity for the Long Night'
      ),
      tags: %w[utility request/3456]
    )
  ]
)

requests.each do |request|
  puts request
end
  

Elixir

requests = StarkBank.PaymentRequest.create!(
    [
        %StarkBank.PaymentRequest{
            center_id: "4762954029334528",
            payment: %StarkBank.UtilityPayment{
                line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
                description: "Electricity for the Long Night",
            },
            tags: ["utility", "request/3456"],
        }
    ]
    ) |> IO.inspect

for request <- requests do
    request |> IO.inspect
end
  

C#

List<StarkBank.PaymentRequest> requests = StarkBank.PaymentRequest.Create(
    new List<StarkBank.PaymentRequest> {
        new StarkBank.PaymentRequest(
            centerID: "4762954029334528",
            payment: new StarkBank.UtilityPayment(
                line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
                description: "Electricity for the Long Night"
            ),
            tags: new List<string> { "utility", "request/3456" }
        )
    }
);

foreach(StarkBank.PaymentRequest request in requests) {
    Console.WriteLine(request);
}
  

Go

package main

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

func main() {

    requests, err := paymentrequest.Create(
        []paymentrequest.PaymentRequest{
            {
                CenterId: "4762954029334528",
                Payment:  utilitypayment.UtilityPayment{
                    Line:        "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
                    Description: "Electricity for the Long Night",
                },
                Tags:     []string{"utility", "request/3456"},
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def payment {
    :line "83640000001 1 08740138007 0 61053026111 0 08067159411 9"
    :description "Electricity for the Long Night"
})

(def payment-requests (starkbank.payment-request/create
[{
    :type "utility-payment"
    :payment payment
    :center-id "4762954029334528"
    :tags ["utility" "request/3456"]
}]))

(doseq [request payment-requests]
    (println request))
  

Curl

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

Python

PaymentRequest(
    actions=[
        {
            'name': 'SDK Python',
            'action': 'requested',
            'type': 'project',
            'id': '5414728075575296'
        },
        {
            'name': 'Rhaegar Targaryen',
            'action': 'required',
            'type': 'member',
            'id': '6025356662276096'
        }
    ],
    amount=100,
    center_id=4762954029334528,
    created=2020-10-23T19:36:59.345753,
    due=2020-10-24T03:00:00+00:00,
    id=5756591424929792,
    payment=UtilityPayment(
        line=83640000001 1 08740138007 0 61053026111 0 08067159411 9,
        description=Electricity for the Long Night
    ),
    status=pending,
    tags=['utility', 'request/3456'],
    type=utility-payment,
    updated=2020-10-23T19:36:59.345760+00:00
)
  

Javascript

PaymentRequest {
    id: '5756591424929792',
    centerId: '4762954029334528',
    tags: [ 'utility', 'request/3456' ],
    amount: 100,
    status: 'pending',
    actions: [
        {
            name: 'SDK Node',
            action: 'requested',
            type: 'project',
            id: '5414728075575296'
        },
        {
            name: 'Rhaegar Targaryen',
            action: 'required',
            type: 'member',
            id: '6025356662276096'
        }
    ],
    payment: {
        line: '83640000001 1 08740138007 0 61053026111 0 08067159411 9',
        description: 'Electricity for the Long Night'
    },
    type: 'utility-payment'
}
  

PHP

StarkBank\PaymentRequest Object
(
    [id] => 5756591424929792
    [centerId] => 4762954029334528
    [amount] => 100
    [status] => pending
    [type] => utility-payment
    [tags] => Array
        (
            [0] => utility
            [1] => request/3456
        )
    [actions] => Array
        (
            [0] => Array
                (
                    [name] => SDK PHP
                    [action] => requested
                    [type] => project
                    [id] => 5414728075575296
                )
            [1] => Array
                (
                    [name] => Rhaegar Targaryen
                    [action] => required
                    [type] => member
                    [id] => 6025356662276096
                )
        )
    [payment] => StarkBank\UtilityPayment Object
        (
            [line] => 83640000001 1 08740138007 0 61053026111 0 08067159411 9
            [description] => Electricity for the Long Night
        )
)
  

Java

PaymentRequest({
    "centerId": "4762954029334528",
    "payment": {
        "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        "description": "Electricity for the Long Night"
    },
    "type": "utility-payment",
    "tags": ["utility", "request/3456"],
    "amount": 100,
    "status": "pending",
    "actions": [
        {
            "name": "SDK Java",
            "action": "requested",
            "type": "project",
            "id": "5414728075575296"
        },
        {
            "name": "Rhaegar Targaryen",
            "action": "required",
            "type": "member",
            "id": "6025356662276096"
        }
    ],
    "id": "5756591424929792"
})
  

Ruby

paymentrequest(
    actions: [
    {
        "name"=>"SDK Ruby",
        "action"=>"requested",
        "type"=>"project",
        "id"=>"5414728075575296"
    },
    {
        "name"=>"Rhaegar Targaryen",
        "action"=>"required",
        "type"=>"member",
        "id"=>"6025356662276096"
    }],
    payment: utilitypayment(
        line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
        description: Electricity for the Long Night
    ),
    type: utility-payment,
    id: 5756591424929792,
    center_id: 4762954029334528,
    tags: %[utility request/3456],
    amount: 100,
    status: pending
)
  

Elixir

%StarkBank.PaymentRequest{
    actions: [
        %{
            "action" => "requested",
            "id" => "5414728075575296",
            "name" => "SDK Elixir",
            "type" => "project"
        },
        %{
            "action" => "required",
            "id" => "6025356662276096",
            "name" => "Rhaegar Targaryen",
            "type" => "member"
        }
    ],
    amount: 100,
    center_id: "4762954029334528",
    id: "5756591424929792",
    payment: %StarkBank.UtilityPayment{
        line: "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
        description: "Electricity for the Long Night"
    },
    status: "pending",
    tags: ["utility", "request/3456"],
    type: "utility-payment"
}
  

C#

PaymentRequest(
    CenterID: 4762954029334528,
    Payment: UtilityPayment(
        Line: 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
        Description: Electricity for the Long Night
    ),
    Type: utility-payment,
    Tags: { utility request/3456 },
    Amount: 100,
    Status: pending,
    Actions: {
    {
        { name, SDK C# },
        { action, requested },
        { type, project },
        { id, 5414728075575296 }
    },
    {
        { name, Rhaegar Targaryen },
        { action, required },
        { type, member },
        { id, 6025356662276096 }
    } },
    ID: 5756591424929792
)
  

Go

{
    CenterId:4762954029334528
    Payment:{
        Line:83640000001 1 08740138007 0 61053026111 0 08067159411 9
        Description:Electricity for the Long Night
    }
    Type:utility-payment
    Tags:[utility request/3456]
    Amount:100
    Status:pending
    Actions:[
        map[
            action:requested
            id:5414728075575296
            name:SDK Go
            type:project
        ]
        map[
            action:required
            id:6025356662276096
            name:Rhaegar Targaryen
            type:member
        ]
    ]
    Id:5756591424929792
}
  

Clojure

{
    :amount 100,
    :tags [utility request/3456],
    :center-id 4762954029334528,
    :actions [
        {
            :name SDK Clojure,
            :action requested,
            :type project,
            :id 5414728075575296
        },
        {
            :name Rhaegar Targaryen,
            :action required,
            :type member,
            :id 6025356662276096
        }
    ],
    :payment {
        :line 83640000001 1 08740138007 0 61053026111 0 08067159411 9,
        :description Electricity for the Long Night
    },
    :type utility-payment,
    :status pending,
    :id 5756591424929792
}
  

Curl

{
    "message": "Payment Request(s) successfully created",
    "requests": [
        {
            "id": "5756591424929792",
            "centerId": "4762954029334528",
            "type": "utility-payment",
            "payment": {
                "line": "83640000001 1 08740138007 0 61053026111 0 08067159411 9",
                "description": "Electricity for the Long Night"
            },
            "tags": ["utility", "request/3456"],
            "amount": 100,
            "actions": [
                {
                    "action": "requested",
                    "type": "project",
                    "id": "5414728075575296",
                    "name": "Curl"
                },
                {
                    "action": "required",
                    "type": "member",
                    "id": "6025356662276096",
                    "name": "Rhaegar Targaryen"
                }
            ],
            "status": "pending",
            "created": "2020-10-23T19:36:59.799815+00:00",
            "updated": "2020-10-23T19:36:59.799815+00:00"
        }
    ]
}
  

Creating a Tax Payment Request

To request a Tax payment, pass a TaxPayment object as the payment parameter.

The TaxPayment object follows the same structure as a regular Tax Payment creation.

Python

import starkbank

requests = starkbank.paymentrequest.create([
    starkbank.PaymentRequest(
        center_id="4762954029334528",
        payment=starkbank.TaxPayment(
            bar_code="81660000005003657010074119002551100010601813",
            description="fix the road",
        ),
        tags=["tax", "request/7890"]
    ),
])

for request in requests:
    print(request)
  

Javascript

const starkbank = require('starkbank');

let taxPayment = new starkbank.TaxPayment({
    barCode: '81660000005003657010074119002551100010601813',
    description: 'fix the road'
});

let requests = [
    new starkbank.PaymentRequest({
        centerId: '4762954029334528',
        payment: taxPayment,
        tags: ["tax", "request/7890"],
    })
];

(async() => {
    requests = await starkbank.paymentRequest.create(requests);

    for await (let request of requests){
        console.log(request);
    }
})();
  

PHP

$requests = PaymentRequest::create([
    new PaymentRequest([
        "centerId" => "4762954029334528",
        "payment" => new TaxPayment([
            "barCode" => "81660000005003657010074119002551100010601813",
            "description" => "fix the road",
        ]),
        "tags" => ["tax", "request/7890"],
    ])
]);

foreach($requests as $request){
    print_r($request);
}
  

Java

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

HashMap<String, Object> paymentData = new HashMap<>();
paymentData.put("barCode", "81660000005003657010074119002551100010601813");
paymentData.put("description", "fix the road");
TaxPayment payment = new TaxPayment(paymentData);

List<PaymentRequest> requests = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("centerId", "4762954029334528");
data.put("payment", payment);
data.put("tags", new String[]{"tax", "request/7890"});
requests.add(new PaymentRequest(data));

requests = PaymentRequest.create(requests);

for (PaymentRequest request : requests){
    System.out.println(request);
}
  

Ruby

require('starkbank')

requests = StarkBank::PaymentRequest.create(
  [
    StarkBank::PaymentRequest.new(
      center_id: '4762954029334528',
      payment: StarkBank::TaxPayment.new(
        bar_code: '81660000005003657010074119002551100010601813',
        description: 'fix the road'
      ),
      tags: %w[tax request/7890]
    )
  ]
)

requests.each do |request|
  puts request
end
  

Elixir

requests = StarkBank.PaymentRequest.create!(
    [
        %StarkBank.PaymentRequest{
            center_id: "4762954029334528",
            payment: %StarkBank.TaxPayment{
                bar_code: "81660000005003657010074119002551100010601813",
                description: "fix the road",
            },
            tags: ["tax", "request/7890"],
        }
    ]
    ) |> IO.inspect

for request <- requests do
    request |> IO.inspect
end
  

C#

List<StarkBank.PaymentRequest> requests = StarkBank.PaymentRequest.Create(
    new List<StarkBank.PaymentRequest> {
        new StarkBank.PaymentRequest(
            centerID: "4762954029334528",
            payment: new StarkBank.TaxPayment(
                barCode: "81660000005003657010074119002551100010601813",
                description: "fix the road"
            ),
            tags: new List<string> { "tax", "request/7890" }
        )
    }
);

foreach(StarkBank.PaymentRequest request in requests) {
    Console.WriteLine(request);
}
  

Go

package main

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

func main() {

    requests, err := paymentrequest.Create(
        []paymentrequest.PaymentRequest{
            {
                CenterId: "4762954029334528",
                Payment:  taxpayment.TaxPayment{
                    BarCode:     "81660000005003657010074119002551100010601813",
                    Description: "fix the road",
                },
                Tags:     []string{"tax", "request/7890"},
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def payment {
    :bar-code "81660000005003657010074119002551100010601813"
    :description "fix the road"
})

(def payment-requests (starkbank.payment-request/create
[{
    :type "tax-payment"
    :payment payment
    :center-id "4762954029334528"
    :tags ["tax" "request/7890"]
}]))

(doseq [request payment-requests]
    (println request))
  

Curl

curl --location --request POST '{{baseUrl}}/v2/payment-request' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "requests": [
        {
            "centerId": "4762954029334528",
            "type": "tax-payment",
            "payment": {
                "barCode": "81660000005003657010074119002551100010601813",
                "description": "fix the road"
            },
            "tags": ["tax", "request/7890"]
        }
    ]
}'
  
RESPONSE

Python

PaymentRequest(
    actions=[
        {
            'name': 'SDK Python',
            'action': 'requested',
            'type': 'project',
            'id': '5414728075575296'
        },
        {
            'name': 'Rhaegar Targaryen',
            'action': 'required',
            'type': 'member',
            'id': '6025356662276096'
        }
    ],
    amount=500365,
    center_id=4762954029334528,
    created=2020-10-23T19:36:59.345753,
    due=2020-10-24T03:00:00+00:00,
    id=5756591424929792,
    payment=TaxPayment(
        bar_code=81660000005003657010074119002551100010601813,
        description=fix the road
    ),
    status=pending,
    tags=['tax', 'request/7890'],
    type=tax-payment,
    updated=2020-10-23T19:36:59.345760+00:00
)
  

Javascript

PaymentRequest {
    id: '5756591424929792',
    centerId: '4762954029334528',
    tags: [ 'tax', 'request/7890' ],
    amount: 500365,
    status: 'pending',
    actions: [
        {
            name: 'SDK Node',
            action: 'requested',
            type: 'project',
            id: '5414728075575296'
        },
        {
            name: 'Rhaegar Targaryen',
            action: 'required',
            type: 'member',
            id: '6025356662276096'
        }
    ],
    payment: {
        barCode: '81660000005003657010074119002551100010601813',
        description: 'fix the road'
    },
    type: 'tax-payment'
}
  

PHP

StarkBank\PaymentRequest Object
(
    [id] => 5756591424929792
    [centerId] => 4762954029334528
    [amount] => 500365
    [status] => pending
    [type] => tax-payment
    [tags] => Array
        (
            [0] => tax
            [1] => request/7890
        )
    [actions] => Array
        (
            [0] => Array
                (
                    [name] => SDK PHP
                    [action] => requested
                    [type] => project
                    [id] => 5414728075575296
                )
            [1] => Array
                (
                    [name] => Rhaegar Targaryen
                    [action] => required
                    [type] => member
                    [id] => 6025356662276096
                )
        )
    [payment] => StarkBank\TaxPayment Object
        (
            [barCode] => 81660000005003657010074119002551100010601813
            [description] => fix the road
        )
)
  

Java

PaymentRequest({
    "centerId": "4762954029334528",
    "payment": {
        "barCode": "81660000005003657010074119002551100010601813",
        "description": "fix the road"
    },
    "type": "tax-payment",
    "tags": ["tax", "request/7890"],
    "amount": 500365,
    "status": "pending",
    "actions": [
        {
            "name": "SDK Java",
            "action": "requested",
            "type": "project",
            "id": "5414728075575296"
        },
        {
            "name": "Rhaegar Targaryen",
            "action": "required",
            "type": "member",
            "id": "6025356662276096"
        }
    ],
    "id": "5756591424929792"
})
  

Ruby

paymentrequest(
    actions: [
    {
        "name"=>"SDK Ruby",
        "action"=>"requested",
        "type"=>"project",
        "id"=>"5414728075575296"
    },
    {
        "name"=>"Rhaegar Targaryen",
        "action"=>"required",
        "type"=>"member",
        "id"=>"6025356662276096"
    }],
    payment: taxpayment(
        bar_code: 81660000005003657010074119002551100010601813,
        description: fix the road
    ),
    type: tax-payment,
    id: 5756591424929792,
    center_id: 4762954029334528,
    tags: %[tax request/7890],
    amount: 500365,
    status: pending
)
  

Elixir

%StarkBank.PaymentRequest{
    actions: [
        %{
            "action" => "requested",
            "id" => "5414728075575296",
            "name" => "SDK Elixir",
            "type" => "project"
        },
        %{
            "action" => "required",
            "id" => "6025356662276096",
            "name" => "Rhaegar Targaryen",
            "type" => "member"
        }
    ],
    amount: 500365,
    center_id: "4762954029334528",
    id: "5756591424929792",
    payment: %StarkBank.TaxPayment{
        bar_code: "81660000005003657010074119002551100010601813",
        description: "fix the road"
    },
    status: "pending",
    tags: ["tax", "request/7890"],
    type: "tax-payment"
}
  

C#

PaymentRequest(
    CenterID: 4762954029334528,
    Payment: TaxPayment(
        BarCode: 81660000005003657010074119002551100010601813,
        Description: fix the road
    ),
    Type: tax-payment,
    Tags: { tax request/7890 },
    Amount: 500365,
    Status: pending,
    Actions: {
    {
        { name, SDK C# },
        { action, requested },
        { type, project },
        { id, 5414728075575296 }
    },
    {
        { name, Rhaegar Targaryen },
        { action, required },
        { type, member },
        { id, 6025356662276096 }
    } },
    ID: 5756591424929792
)
  

Go

{
    CenterId:4762954029334528
    Payment:{
        BarCode:81660000005003657010074119002551100010601813
        Description:fix the road
    }
    Type:tax-payment
    Tags:[tax request/7890]
    Amount:500365
    Status:pending
    Actions:[
        map[
            action:requested
            id:5414728075575296
            name:SDK Go
            type:project
        ]
        map[
            action:required
            id:6025356662276096
            name:Rhaegar Targaryen
            type:member
        ]
    ]
    Id:5756591424929792
}
  

Clojure

{
    :amount 500365,
    :tags [tax request/7890],
    :center-id 4762954029334528,
    :actions [
        {
            :name SDK Clojure,
            :action requested,
            :type project,
            :id 5414728075575296
        },
        {
            :name Rhaegar Targaryen,
            :action required,
            :type member,
            :id 6025356662276096
        }
    ],
    :payment {
        :bar-code 81660000005003657010074119002551100010601813,
        :description fix the road
    },
    :type tax-payment,
    :status pending,
    :id 5756591424929792
}
  

Curl

{
    "message": "Payment Request(s) successfully created",
    "requests": [
        {
            "id": "5756591424929792",
            "centerId": "4762954029334528",
            "type": "tax-payment",
            "payment": {
                "barCode": "81660000005003657010074119002551100010601813",
                "description": "fix the road"
            },
            "tags": ["tax", "request/7890"],
            "amount": 500365,
            "actions": [
                {
                    "action": "requested",
                    "type": "project",
                    "id": "5414728075575296",
                    "name": "Curl"
                },
                {
                    "action": "required",
                    "type": "member",
                    "id": "6025356662276096",
                    "name": "Rhaegar Targaryen"
                }
            ],
            "status": "pending",
            "created": "2020-10-23T19:36:59.799815+00:00",
            "updated": "2020-10-23T19:36:59.799815+00:00"
        }
    ]
}
  

Creating a Darf Payment Request

To request a Darf (federal tax) payment, pass a DarfPayment object as the payment parameter.

The DarfPayment object follows the same structure as a regular Darf Payment creation.

Python

import starkbank

requests = starkbank.paymentrequest.create([
    starkbank.PaymentRequest(
        center_id="4762954029334528",
        payment=starkbank.DarfPayment(
            revenue_code="1240",
            tax_id="012.345.678-90",
            competence="2023-09-01",
            nominal_amount=1234,
            fine_amount=12,
            interest_amount=34,
            due="2023-10-01",
            description="DARF Payment for revenue code 1240",
        ),
        tags=["darf", "request/4321"]
    ),
])

for request in requests:
    print(request)
  

Javascript

const starkbank = require('starkbank');

let darfPayment = new starkbank.DarfPayment({
    revenueCode: '1240',
    taxId: '012.345.678-90',
    competence: '2023-09-01',
    nominalAmount: 1234,
    fineAmount: 12,
    interestAmount: 34,
    due: '2023-10-01',
    description: 'DARF Payment for revenue code 1240'
});

let requests = [
    new starkbank.PaymentRequest({
        centerId: '4762954029334528',
        payment: darfPayment,
        tags: ["darf", "request/4321"],
    })
];

(async() => {
    requests = await starkbank.paymentRequest.create(requests);

    for await (let request of requests){
        console.log(request);
    }
})();
  

PHP

$requests = PaymentRequest::create([
    new PaymentRequest([
        "centerId" => "4762954029334528",
        "payment" => new DarfPayment([
            "revenueCode" => "1240",
            "taxId" => "012.345.678-90",
            "competence" => "2023-09-01",
            "nominalAmount" => 1234,
            "fineAmount" => 12,
            "interestAmount" => 34,
            "due" => "2023-10-01",
            "description" => "DARF Payment for revenue code 1240",
        ]),
        "tags" => ["darf", "request/4321"],
    ])
]);

foreach($requests as $request){
    print_r($request);
}
  

Java

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

HashMap<String, Object> paymentData = new HashMap<>();
paymentData.put("revenueCode", "1240");
paymentData.put("taxId", "012.345.678-90");
paymentData.put("competence", "2023-09-01");
paymentData.put("nominalAmount", 1234);
paymentData.put("fineAmount", 12);
paymentData.put("interestAmount", 34);
paymentData.put("due", "2023-10-01");
paymentData.put("description", "DARF Payment for revenue code 1240");
DarfPayment payment = new DarfPayment(paymentData);

List<PaymentRequest> requests = new ArrayList<>();
HashMap<String, Object> data = new HashMap<>();
data.put("centerId", "4762954029334528");
data.put("payment", payment);
data.put("tags", new String[]{"darf", "request/4321"});
requests.add(new PaymentRequest(data));

requests = PaymentRequest.create(requests);

for (PaymentRequest request : requests){
    System.out.println(request);
}
  

Ruby

require('starkbank')

requests = StarkBank::PaymentRequest.create(
  [
    StarkBank::PaymentRequest.new(
      center_id: '4762954029334528',
      payment: StarkBank::DarfPayment.new(
        revenue_code: '1240',
        tax_id: '012.345.678-90',
        competence: '2023-09-01',
        nominal_amount: 1234,
        fine_amount: 12,
        interest_amount: 34,
        due: '2023-10-01',
        description: 'DARF Payment for revenue code 1240'
      ),
      tags: %w[darf request/4321]
    )
  ]
)

requests.each do |request|
  puts request
end
  

Elixir

requests = StarkBank.PaymentRequest.create!(
    [
        %StarkBank.PaymentRequest{
            center_id: "4762954029334528",
            payment: %StarkBank.DarfPayment{
                revenue_code: "1240",
                tax_id: "012.345.678-90",
                competence: "2023-09-01",
                nominal_amount: 1234,
                fine_amount: 12,
                interest_amount: 34,
                due: "2023-10-01",
                description: "DARF Payment for revenue code 1240",
            },
            tags: ["darf", "request/4321"],
        }
    ]
    ) |> IO.inspect

for request <- requests do
    request |> IO.inspect
end
  

C#

List<StarkBank.PaymentRequest> requests = StarkBank.PaymentRequest.Create(
    new List<StarkBank.PaymentRequest> {
        new StarkBank.PaymentRequest(
            centerID: "4762954029334528",
            payment: new StarkBank.DarfPayment(
                revenueCode: "1240",
                taxID: "012.345.678-90",
                competence: "2023-09-01",
                nominalAmount: 1234,
                fineAmount: 12,
                interestAmount: 34,
                due: "2023-10-01",
                description: "DARF Payment for revenue code 1240"
            ),
            tags: new List<string> { "darf", "request/4321" }
        )
    }
);

foreach(StarkBank.PaymentRequest request in requests) {
    Console.WriteLine(request);
}
  

Go

package main

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

func main() {

    requests, err := paymentrequest.Create(
        []paymentrequest.PaymentRequest{
            {
                CenterId: "4762954029334528",
                Payment:  darfpayment.DarfPayment{
                    RevenueCode:    "1240",
                    TaxId:          "012.345.678-90",
                    Competence:     "2023-09-01",
                    NominalAmount:  1234,
                    FineAmount:     12,
                    InterestAmount: 34,
                    Due:            "2023-10-01",
                    Description:    "DARF Payment for revenue code 1240",
                },
                Tags:     []string{"darf", "request/4321"},
            },
        }, nil)
    if err.Errors != nil {
        for _, e := range err.Errors {
            fmt.Printf("code: %s, message: %s", e.Code, e.Message)
        }
    }

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

Clojure

(def payment {
    :revenue-code "1240"
    :tax-id "012.345.678-90"
    :competence "2023-09-01"
    :nominal-amount 1234
    :fine-amount 12
    :interest-amount 34
    :due "2023-10-01"
    :description "DARF Payment for revenue code 1240"
})

(def payment-requests (starkbank.payment-request/create
[{
    :type "darf-payment"
    :payment payment
    :center-id "4762954029334528"
    :tags ["darf" "request/4321"]
}]))

(doseq [request payment-requests]
    (println request))
  

Curl

curl --location --request POST '{{baseUrl}}/v2/payment-request' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}' 
--header 'Content-Type: application/json' 
--data-raw '{
    "requests": [
        {
            "centerId": "4762954029334528",
            "type": "darf-payment",
            "payment": {
                "revenueCode": "1240",
                "taxId": "012.345.678-90",
                "competence": "2023-09-01",
                "nominalAmount": 1234,
                "fineAmount": 12,
                "interestAmount": 34,
                "due": "2023-10-01",
                "description": "DARF Payment for revenue code 1240"
            },
            "tags": ["darf", "request/4321"]
        }
    ]
}'
  
RESPONSE

Python

PaymentRequest(
    actions=[
        {
            'name': 'SDK Python',
            'action': 'requested',
            'type': 'project',
            'id': '5414728075575296'
        },
        {
            'name': 'Rhaegar Targaryen',
            'action': 'required',
            'type': 'member',
            'id': '6025356662276096'
        }
    ],
    amount=1280,
    center_id=4762954029334528,
    created=2023-10-01T19:36:59.345753,
    due=2023-10-01T03:00:00+00:00,
    id=5756591424929792,
    payment=DarfPayment(
        revenue_code=1240,
        tax_id=012.345.678-90,
        competence=2023-09-01,
        nominal_amount=1234,
        fine_amount=12,
        interest_amount=34,
        due=2023-10-01,
        description=DARF Payment for revenue code 1240
    ),
    status=pending,
    tags=['darf', 'request/4321'],
    type=darf-payment,
    updated=2023-10-01T19:36:59.345760+00:00
)
  

Javascript

PaymentRequest {
    id: '5756591424929792',
    centerId: '4762954029334528',
    tags: [ 'darf', 'request/4321' ],
    amount: 1280,
    status: 'pending',
    actions: [
        {
            name: 'SDK Node',
            action: 'requested',
            type: 'project',
            id: '5414728075575296'
        },
        {
            name: 'Rhaegar Targaryen',
            action: 'required',
            type: 'member',
            id: '6025356662276096'
        }
    ],
    payment: {
        revenueCode: '1240',
        taxId: '012.345.678-90',
        competence: '2023-09-01',
        nominalAmount: 1234,
        fineAmount: 12,
        interestAmount: 34,
        due: '2023-10-01',
        description: 'DARF Payment for revenue code 1240'
    },
    type: 'darf-payment'
}
  

PHP

StarkBank\PaymentRequest Object
(
    [id] => 5756591424929792
    [centerId] => 4762954029334528
    [amount] => 1280
    [status] => pending
    [type] => darf-payment
    [tags] => Array
        (
            [0] => darf
            [1] => request/4321
        )
    [actions] => Array
        (
            [0] => Array
                (
                    [name] => SDK PHP
                    [action] => requested
                    [type] => project
                    [id] => 5414728075575296
                )
            [1] => Array
                (
                    [name] => Rhaegar Targaryen
                    [action] => required
                    [type] => member
                    [id] => 6025356662276096
                )
        )
    [payment] => StarkBank\DarfPayment Object
        (
            [revenueCode] => 1240
            [taxId] => 012.345.678-90
            [competence] => 2023-09-01
            [nominalAmount] => 1234
            [fineAmount] => 12
            [interestAmount] => 34
            [due] => 2023-10-01
            [description] => DARF Payment for revenue code 1240
        )
)
  

Java

PaymentRequest({
    "centerId": "4762954029334528",
    "payment": {
        "revenueCode": "1240",
        "taxId": "012.345.678-90",
        "competence": "2023-09-01",
        "nominalAmount": 1234,
        "fineAmount": 12,
        "interestAmount": 34,
        "due": "2023-10-01",
        "description": "DARF Payment for revenue code 1240"
    },
    "type": "darf-payment",
    "tags": ["darf", "request/4321"],
    "amount": 1280,
    "status": "pending",
    "actions": [
        {
            "name": "SDK Java",
            "action": "requested",
            "type": "project",
            "id": "5414728075575296"
        },
        {
            "name": "Rhaegar Targaryen",
            "action": "required",
            "type": "member",
            "id": "6025356662276096"
        }
    ],
    "id": "5756591424929792"
})
  

Ruby

paymentrequest(
    actions: [
    {
        "name"=>"SDK Ruby",
        "action"=>"requested",
        "type"=>"project",
        "id"=>"5414728075575296"
    },
    {
        "name"=>"Rhaegar Targaryen",
        "action"=>"required",
        "type"=>"member",
        "id"=>"6025356662276096"
    }],
    payment: darfpayment(
        revenue_code: 1240,
        tax_id: 012.345.678-90,
        competence: 2023-09-01,
        nominal_amount: 1234,
        fine_amount: 12,
        interest_amount: 34,
        due: 2023-10-01,
        description: DARF Payment for revenue code 1240
    ),
    type: darf-payment,
    id: 5756591424929792,
    center_id: 4762954029334528,
    tags: %[darf request/4321],
    amount: 1280,
    status: pending
)
  

Elixir

%StarkBank.PaymentRequest{
    actions: [
        %{
            "action" => "requested",
            "id" => "5414728075575296",
            "name" => "SDK Elixir",
            "type" => "project"
        },
        %{
            "action" => "required",
            "id" => "6025356662276096",
            "name" => "Rhaegar Targaryen",
            "type" => "member"
        }
    ],
    amount: 1280,
    center_id: "4762954029334528",
    id: "5756591424929792",
    payment: %StarkBank.DarfPayment{
        revenue_code: "1240",
        tax_id: "012.345.678-90",
        competence: "2023-09-01",
        nominal_amount: 1234,
        fine_amount: 12,
        interest_amount: 34,
        due: "2023-10-01",
        description: "DARF Payment for revenue code 1240"
    },
    status: "pending",
    tags: ["darf", "request/4321"],
    type: "darf-payment"
}
  

C#

PaymentRequest(
    CenterID: 4762954029334528,
    Payment: DarfPayment(
        RevenueCode: 1240,
        TaxID: 012.345.678-90,
        Competence: 2023-09-01,
        NominalAmount: 1234,
        FineAmount: 12,
        InterestAmount: 34,
        Due: 2023-10-01,
        Description: DARF Payment for revenue code 1240
    ),
    Type: darf-payment,
    Tags: { darf request/4321 },
    Amount: 1280,
    Status: pending,
    Actions: {
    {
        { name, SDK C# },
        { action, requested },
        { type, project },
        { id, 5414728075575296 }
    },
    {
        { name, Rhaegar Targaryen },
        { action, required },
        { type, member },
        { id, 6025356662276096 }
    } },
    ID: 5756591424929792
)
  

Go

{
    CenterId:4762954029334528
    Payment:{
        RevenueCode:1240
        TaxId:012.345.678-90
        Competence:2023-09-01
        NominalAmount:1234
        FineAmount:12
        InterestAmount:34
        Due:2023-10-01
        Description:DARF Payment for revenue code 1240
    }
    Type:darf-payment
    Tags:[darf request/4321]
    Amount:1280
    Status:pending
    Actions:[
        map[
            action:requested
            id:5414728075575296
            name:SDK Go
            type:project
        ]
        map[
            action:required
            id:6025356662276096
            name:Rhaegar Targaryen
            type:member
        ]
    ]
    Id:5756591424929792
}
  

Clojure

{
    :amount 1280,
    :tags [darf request/4321],
    :center-id 4762954029334528,
    :actions [
        {
            :name SDK Clojure,
            :action requested,
            :type project,
            :id 5414728075575296
        },
        {
            :name Rhaegar Targaryen,
            :action required,
            :type member,
            :id 6025356662276096
        }
    ],
    :payment {
        :revenue-code 1240,
        :tax-id 012.345.678-90,
        :competence 2023-09-01,
        :nominal-amount 1234,
        :fine-amount 12,
        :interest-amount 34,
        :due 2023-10-01,
        :description DARF Payment for revenue code 1240
    },
    :type darf-payment,
    :status pending,
    :id 5756591424929792
}
  

Curl

{
    "message": "Payment Request(s) successfully created",
    "requests": [
        {
            "id": "5756591424929792",
            "centerId": "4762954029334528",
            "type": "darf-payment",
            "payment": {
                "revenueCode": "1240",
                "taxId": "012.345.678-90",
                "competence": "2023-09-01",
                "nominalAmount": 1234,
                "fineAmount": 12,
                "interestAmount": 34,
                "due": "2023-10-01",
                "description": "DARF Payment for revenue code 1240"
            },
            "tags": ["darf", "request/4321"],
            "amount": 1280,
            "actions": [
                {
                    "action": "requested",
                    "type": "project",
                    "id": "5414728075575296",
                    "name": "Curl"
                },
                {
                    "action": "required",
                    "type": "member",
                    "id": "6025356662276096",
                    "name": "Rhaegar Targaryen"
                }
            ],
            "status": "pending",
            "created": "2023-10-01T19:36:59.799815+00:00",
            "updated": "2023-10-01T19:36:59.799815+00:00"
        }
    ]
}
  

Listing Payment Requests

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

The centerId parameter is required for listing.

Python

import starkbank

requests = starkbank.paymentrequest.query(center_id="4762954029334528", limit=10)

for request in requests:
    print(request)
  

Javascript

const starkbank = require('starkbank');

(async() => {
    let requests = await starkbank.paymentRequest.query({centerId: '4762954029334528', limit: 10});

    for await (let request of requests){
        console.log(request);
    }
})();
  

PHP

use StarkBank\PaymentRequest;

$requests = PaymentRequest::query(["centerId" => "4762954029334528", "limit" => 10]);

foreach($requests as $request){
    print_r($request);
}
  

Java

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

HashMap<String, Object> params = new HashMap<>();
params.put("centerId", "4762954029334528");
params.put("limit", 10);
Generator<PaymentRequest> requests = PaymentRequest.query(params);

for (PaymentRequest request : requests){
    System.out.println(request);
}
  

Ruby

require('starkbank')

requests = StarkBank::PaymentRequest.query(
    center_id: '4762954029334528',
    limit: 10
)

requests.each do |request|
    puts request
end
  

Elixir

requests = StarkBank.PaymentRequest.query!(
    center_id: "4762954029334528",
    limit: 10
) |> Enum.take(10) |> IO.inspect
  

C#

using System;
using System.Collections.Generic;

IEnumerable<StarkBank.PaymentRequest> requests = StarkBank.PaymentRequest.Query(
    centerID: "4762954029334528",
    limit: 10
);

foreach(StarkBank.PaymentRequest request in requests) {
    Console.WriteLine(request);
}
  

Go

package main

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

func main() {

    var params = map[string]interface{}{}
    params["limit"] = 10

    requests, errorChannel := paymentrequest.Query("4762954029334528", 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 request, ok := <-requests:
            if !ok {
                break loop
            }
            fmt.Printf("%+v", request)
        }
    }
}
  

Clojure

(def payment-requests (starkbank.payment-request/query {
    :limit 10
    :center-id "4762954029334528"}))

(doseq [request payment-requests]
    (println request))
  

Curl

curl --location --request GET '{{baseUrl}}/v2/payment-request?centerId=4762954029334528&limit=10' 
--header 'Access-Id: {{accessId}}' 
--header 'Access-Time: {{accessTime}}' 
--header 'Access-Signature: {{accessSignature}}'
  
RESPONSE

Python

PaymentRequest(
    actions=[
        {
            'name': 'SDK Python',
            'action': 'requested',
            'type': 'project',
            'id': '5414728075575296'
        },
        {
            'name': 'Rhaegar Targaryen',
            'action': 'required',
            'type': 'member',
            'id': '6025356662276096'
        }
    ],
    amount=100000000,
    center_id=4762954029334528,
    created=2020-10-23T19:36:59.345753,
    due=2020-10-24T03:00:00+00:00,
    id=5756591424929792,
    payment=Transfer(
        account_number=76543-8,
        amount=100000000,
        bank_code=665,
        branch_code=2201,
        name=Daenerys Targaryen Stormborn,
        tax_id=594.739.480-42
    ),
    status=pending,
    tags=['daenerys', 'request/1234'],
    type=transfer,
    description=Daenerys Targaryen Stormborn (594.739.480-42),
    updated=2020-10-23T19:36:59.345760+00:00
)
  

Javascript

PaymentRequest {
    id: '5756591424929792',
    centerId: '4762954029334528',
    due: '2020-10-24T03:00:00.000000+00:00',
    tags: [ 'daenerys', 'request/1234' ],
    amount: 100000000,
    status: 'pending',
    actions: [
        {
            name: 'SDK Node',
            action: 'requested',
            type: 'project',
            id: '5414728075575296'
        },
        {
            name: 'Rhaegar Targaryen',
            action: 'required',
            type: 'member',
            id: '6025356662276096'
        }
    ],
    payment: {
        name: 'Daenerys Targaryen Stormborn',
        accountNumber: '76543-8',
        taxId: '594.739.480-42',
        amount: 100000000,
        bankCode: '665',
        branchCode: '2201'
    },
    type: 'transfer',
    description: 'Daenerys Targaryen Stormborn (594.739.480-42)'
}
  

PHP

StarkBank\PaymentRequest Object
(
    [id] => 5756591424929792
    [centerId] => 4762954029334528
    [due] => 2020-10-24T03:00:00.000000+00:00
    [description] => Daenerys Targaryen Stormborn (594.739.480-42)
    [tags] => Array
        (
            [0] => daenerys
            [1] => request/1234
        )
    [amount] => 100000000
    [status] => pending
    [type] => transfer
    [payment] => StarkBank\Transfer Object
        (
            [amount] => 100000000
            [name] => Daenerys Targaryen Stormborn
            [taxId] => 594.739.480-42
            [bankCode] => 665
            [branchCode] => 2201
            [accountNumber] => 76543-8
        )
)
  

Java

PaymentRequest({
    "centerId": "4762954029334528",
    "payment": {
        "amount": 100000000,
        "name": "Daenerys Targaryen Stormborn",
        "taxId": "594.739.480-42",
        "bankCode": "665",
        "branchCode": "2201",
        "accountNumber": "76543-8"
    },
    "type": "transfer",
    "due": "2020-10-24T03:00:00+00:00",
    "tags": ["daenerys", "request/1234"],
    "amount": 100000000,
    "status": "pending",
    "description": "Daenerys Targaryen Stormborn (594.739.480-42)",
    "id": "5756591424929792"
})
  

Ruby

paymentrequest(
    payment: transfer(
        amount: 100000000,
        name: Daenerys Targaryen Stormborn,
        tax_id: 594.739.480-42,
        bank_code: 665,
        branch_code: 2201,
        account_number: 76543-8
    ),
    type: transfer,
    id: 5756591424929792,
    center_id: 4762954029334528,
    due: 2020-10-24T03:00:00.000000+00:00,
    tags: %[daenerys request/1234],
    amount: 100000000,
    status: pending,
    description: Daenerys Targaryen Stormborn (594.739.480-42)
)
  

Elixir

%StarkBank.PaymentRequest{
    amount: 100000000,
    center_id: "4762954029334528",
    created: ~U[2020-10-23 19:36:59.858275Z],
    description: "Daenerys Targaryen Stormborn (594.739.480-42)",
    due: ~U[2020-10-24 03:00:00.000000Z],
    id: "5756591424929792",
    payment: %StarkBank.Transfer{
        account_number: "76543-8",
        amount: 100000000,
        bank_code: "665",
        branch_code: "2201",
        name: "Daenerys Targaryen Stormborn",
        tax_id: "594.739.480-42"
    },
    status: "pending",
    tags: ["daenerys", "request/1234"],
    type: "transfer",
    updated: ~U[2020-10-23 19:36:59.858283Z]
}
  

C#

PaymentRequest(
    CenterID: 4762954029334528,
    Payment: Transfer(
        Amount: 100000000,
        Name: Daenerys Targaryen Stormborn,
        TaxID: 594.739.480-42,
        BankCode: 665,
        BranchCode: 2201,
        AccountNumber: 76543-8
    ),
    Type: transfer,
    Description: Daenerys Targaryen Stormborn (594.739.480-42),
    Due: 24/10/2020 03:00:00,
    Tags: { daenerys request/1234 },
    Amount: 100000000,
    Status: pending,
    ID: 5756591424929792
)
  

Go

{
    CenterId:4762954029334528
    Payment:{
        Name:Daenerys Targaryen Stormborn
        AccountNumber:76543-8
        TaxId:594.739.480-42
        Amount:100000000
        BankCode:665
        BranchCode:2201
    }
    Type:transfer
    Due:2020-10-24 03:00:00.000000 +0000 +0000
    Tags:[daenerys request/1234]
    Amount:100000000
    Status:pending
    Description:Daenerys Targaryen Stormborn (594.739.480-42)
    Id:5756591424929792
}
  

Clojure

{
    :amount 100000000,
    :tags [daenerys request/1234],
    :center-id 4762954029334528,
    :payment {
        :amount 100000000,
        :name Daenerys Targaryen Stormborn,
        :account-number 76543-8,
        :tax-id 594.739.480-42,
        :bank-code 665,
        :branch-code 2201
    },
    :type transfer,
    :description Daenerys Targaryen Stormborn (594.739.480-42),
    :due 2020-10-24T03:00:00.000000+00:00,
    :status pending,
    :id 5756591424929792
}
  

Curl

{
    "requests": [
        {
            "id": "5756591424929792",
            "centerId": "4762954029334528",
            "type": "transfer",
            "payment": {
                "amount": 100000000,
                "taxId": "594.739.480-42",
                "name": "Daenerys Targaryen Stormborn",
                "bankCode": "665",
                "branchCode": "2201",
                "accountNumber": "76543-8"
            },
            "due": "2020-10-24T03:00:00.000000+00:00",
            "tags": ["daenerys", "request/1234"],
            "amount": 100000000,
            "status": "pending",
            "description": "Daenerys Targaryen Stormborn (594.739.480-42)",
            "created": "2020-10-23T19:36:59.799815+00:00",
            "updated": "2020-10-23T19:36:59.799815+00:00"
        }
    ]
}