- 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 the configured payment services.
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
});
}
}
ListPaymentServicesResponse
| 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 |
*/* |
Configures a new payment service for use by merchants.
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());
}
}
}
| Parameter |
Type |
Required |
Description |
merchantAccountId |
JsonNullable<String> |
➖ |
The ID of the merchant account to use for this request. |
paymentServiceCreate |
PaymentServiceCreate |
✔️ |
N/A |
CreatePaymentServiceResponse
| 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 the details of a configured payment service.
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());
}
}
}
| 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. |
|
GetPaymentServiceResponse
| 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 |
*/* |
Updates the configuration of a payment service.
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());
}
}
}
| 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 |
|
UpdatePaymentServiceResponse
| 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 |
*/* |
Deletes all the configuration of a payment service.
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
}
}
| 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. |
|
DeletePaymentServiceResponse
| 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 the credentials of a configured payment service
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());
}
}
}
| Parameter |
Type |
Required |
Description |
merchantAccountId |
JsonNullable<String> |
➖ |
The ID of the merchant account to use for this request. |
verifyCredentials |
VerifyCredentials |
✔️ |
N/A |
VerifyPaymentServiceCredentialsResponse
| 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 |
*/* |
Creates a session for a payment service that supports sessions.
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());
}
}
}
| 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 |
|
CreatePaymentServiceSessionResponse
| 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 |
*/* |