Skip to content

Latest commit

 

History

History
212 lines (160 loc) · 11.6 KB

File metadata and controls

212 lines (160 loc) · 11.6 KB

Payouts

Overview

Available Operations

  • list - List payouts created
  • create - Create a payout
  • get - Get a payout

list

Returns a list of payouts made.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.ListPayoutsResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("default")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();


        sdk.payouts().list()
                .cursor("ZXhhbXBsZTE")
                .limit(20L)
                .callAsStream()
                .forEach((ListPayoutsResponse item) -> {
                   // handle page
                });

    }
}

Parameters

Parameter Type Required Description Example
cursor JsonNullable<String> A pointer to the page of results to return. ZXhhbXBsZTE
limit Optional<Long> The maximum number of items that are at returned. 20
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

ListPayoutsResponse

Errors

Error Type Status Code Content Type
models/errors/Error400 400 application/json
models/errors/Error401 401 application/json
models/errors/Error403 403 application/json
models/errors/Error404 404 application/json
models/errors/Error405 405 application/json
models/errors/Error409 409 application/json
models/errors/HTTPValidationError 422 application/json
models/errors/Error425 425 application/json
models/errors/Error429 429 application/json
models/errors/Error500 500 application/json
models/errors/Error502 502 application/json
models/errors/Error504 504 application/json
models/errors/APIException 4XX, 5XX */*

create

Creates a new payout.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.*;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.CreatePayoutResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("default")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        CreatePayoutResponse res = sdk.payouts().create()
                .payoutCreate(PayoutCreate.builder()
                    .amount(1299L)
                    .currency("EUR")
                    .paymentServiceId("ed8bd87d-85ad-40cf-8e8f-007e21e55aad")
                    .paymentMethod(PayoutCreatePaymentMethod.of(PaymentMethodStoredCard.builder()
                        .id("852b951c-d7ea-4c98-b09e-4a1c9e97c077")
                        .build()))
                    .build())
                .call();

        if (res.payoutSummary().isPresent()) {
            System.out.println(res.payoutSummary().get());
        }
    }
}

Parameters

Parameter Type Required Description
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.
payoutCreate PayoutCreate ✔️ N/A

Response

CreatePayoutResponse

Errors

Error Type Status Code Content Type
models/errors/Error400 400 application/json
models/errors/Error401 401 application/json
models/errors/Error403 403 application/json
models/errors/Error404 404 application/json
models/errors/Error405 405 application/json
models/errors/Error409 409 application/json
models/errors/HTTPValidationError 422 application/json
models/errors/Error425 425 application/json
models/errors/Error429 429 application/json
models/errors/Error500 500 application/json
models/errors/Error502 502 application/json
models/errors/Error504 504 application/json
models/errors/APIException 4XX, 5XX */*

get

Retrieves a payout.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.GetPayoutResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Gr4vy sdk = Gr4vy.builder()
                .merchantAccountId("default")
                .bearerAuth(System.getenv().getOrDefault("BEARER_AUTH", ""))
            .build();

        GetPayoutResponse res = sdk.payouts().get()
                .payoutId("4344fef2-bc2f-49a6-924f-343e62f67224")
                .call();

        if (res.payoutSummary().isPresent()) {
            System.out.println(res.payoutSummary().get());
        }
    }
}

Parameters

Parameter Type Required Description
payoutId String ✔️ N/A
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

GetPayoutResponse

Errors

Error Type Status Code Content Type
models/errors/Error400 400 application/json
models/errors/Error401 401 application/json
models/errors/Error403 403 application/json
models/errors/Error404 404 application/json
models/errors/Error405 405 application/json
models/errors/Error409 409 application/json
models/errors/HTTPValidationError 422 application/json
models/errors/Error425 425 application/json
models/errors/Error429 429 application/json
models/errors/Error500 500 application/json
models/errors/Error502 502 application/json
models/errors/Error504 504 application/json
models/errors/APIException 4XX, 5XX */*