Skip to content

Latest commit

 

History

History
499 lines (382 loc) · 29.5 KB

File metadata and controls

499 lines (382 loc) · 29.5 KB

PaymentServices

Overview

Available Operations

  • list - List payment services
  • create - Configure a payment service
  • get - Get payment service
  • update - Update a configured payment service
  • delete - Delete a configured payment service
  • verify - Verify payment service credentials
  • session - Create a session for a payment service definition

list

List the configured payment services.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.ListPaymentServicesRequest;
import com.gr4vy.sdk.models.operations.ListPaymentServicesResponse;
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();

        ListPaymentServicesRequest req = ListPaymentServicesRequest.builder()
                .cursor("ZXhhbXBsZTE")
                .deleted(true)
                .build();


        sdk.paymentServices().list()
                .callAsStream()
                .forEach((ListPaymentServicesResponse item) -> {
                   // handle page
                });

    }
}

Parameters

Parameter Type Required Description
request ListPaymentServicesRequest ✔️ The request object to use for the request.

Response

ListPaymentServicesResponse

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

Configures a new payment service for use by merchants.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.Field;
import com.gr4vy.sdk.models.components.PaymentServiceCreate;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.CreatePaymentServiceResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

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

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

        CreatePaymentServiceResponse res = sdk.paymentServices().create()
                .paymentServiceCreate(PaymentServiceCreate.builder()
                    .displayName("Stripe")
                    .paymentServiceDefinitionId("stripe-card")
                    .fields(List.of(
                        Field.builder()
                            .key("api_key")
                            .value("key-12345")
                            .build()))
                    .acceptedCurrencies(List.of(
                        "USD",
                        "EUR",
                        "GBP"))
                    .acceptedCountries(List.of(
                        "US",
                        "DE",
                        "GB"))
                    .threeDSecureEnabled(true)
                    .settlementReportingEnabled(true)
                    .build())
                .call();

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

Parameters

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

Response

CreatePaymentServiceResponse

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

Get the details of a configured payment service.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.GetPaymentServiceResponse;
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();

        GetPaymentServiceResponse res = sdk.paymentServices().get()
                .paymentServiceId("fffd152a-9532-4087-9a4f-de58754210f0")
                .call();

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

Parameters

Parameter Type Required Description Example
paymentServiceId String ✔️ the ID of the payment service fffd152a-9532-4087-9a4f-de58754210f0
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

GetPaymentServiceResponse

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 */*

update

Updates the configuration of a payment service.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.PaymentServiceUpdate;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.UpdatePaymentServiceResponse;
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();

        UpdatePaymentServiceResponse res = sdk.paymentServices().update()
                .paymentServiceId("fffd152a-9532-4087-9a4f-de58754210f0")
                .paymentServiceUpdate(PaymentServiceUpdate.builder()
                    .settlementReportingEnabled(true)
                    .build())
                .call();

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

Parameters

Parameter Type Required Description Example
paymentServiceId String ✔️ the ID of the payment service fffd152a-9532-4087-9a4f-de58754210f0
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.
paymentServiceUpdate PaymentServiceUpdate ✔️ N/A

Response

UpdatePaymentServiceResponse

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 */*

delete

Deletes all the configuration of a payment service.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.DeletePaymentServiceResponse;
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();

        DeletePaymentServiceResponse res = sdk.paymentServices().delete()
                .paymentServiceId("fffd152a-9532-4087-9a4f-de58754210f0")
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description Example
paymentServiceId String ✔️ the ID of the payment service fffd152a-9532-4087-9a4f-de58754210f0
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

DeletePaymentServiceResponse

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 */*

verify

Verify the credentials of a configured payment service

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.components.VerifyCredentials;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.VerifyPaymentServiceCredentialsResponse;
import java.lang.Exception;
import java.util.List;

public class Application {

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

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

        VerifyPaymentServiceCredentialsResponse res = sdk.paymentServices().verify()
                .verifyCredentials(VerifyCredentials.builder()
                    .paymentServiceDefinitionId("stripe-card")
                    .fields(List.of())
                    .build())
                .call();

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

Parameters

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

Response

VerifyPaymentServiceCredentialsResponse

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 */*

session

Creates a session for a payment service that supports sessions.

Example Usage

package hello.world;

import com.gr4vy.sdk.Gr4vy;
import com.gr4vy.sdk.models.errors.*;
import com.gr4vy.sdk.models.operations.CreatePaymentServiceSessionResponse;
import java.lang.Exception;
import java.util.Map;

public class Application {

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

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

        CreatePaymentServiceSessionResponse res = sdk.paymentServices().session()
                .paymentServiceId("fffd152a-9532-4087-9a4f-de58754210f0")
                .requestBody(Map.ofEntries(
                ))
                .call();

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

Parameters

Parameter Type Required Description Example
paymentServiceId String ✔️ the ID of the payment service fffd152a-9532-4087-9a4f-de58754210f0
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.
requestBody Map<String, Object> ✔️ N/A

Response

CreatePaymentServiceSessionResponse

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 */*