Skip to content

Latest commit

 

History

History
273 lines (205 loc) · 18 KB

File metadata and controls

273 lines (205 loc) · 18 KB

PaymentLinks

Overview

Available Operations

  • create - Add a payment link
  • list - List all payment links
  • expire - Expire a payment link
  • get - Get payment link

create

Create a new payment link.

Example Usage

package hello.world;

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

public class Application {

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

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

        AddPaymentLinkResponse res = sdk.paymentLinks().create()
                .paymentLinkCreate(PaymentLinkCreate.builder()
                    .amount(1299L)
                    .country("DE")
                    .currency("EUR")
                    .store(true)
                    .build())
                .call();

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

Parameters

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

Response

AddPaymentLinkResponse

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

list

List all created payment links.

Example Usage

package hello.world;

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

public class Application {

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

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


        sdk.paymentLinks().list()
                .limit(20L)
                .callAsStream()
                .forEach((ListPaymentLinksResponse 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 returned. 20
buyerSearch List<String> Filters the results to only get the items for which some of the buyer data contains exactly the provided buyer_search values. [
"John",
"London"
]
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

ListPaymentLinksResponse

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

expire

Expire an existing payment link.

Example Usage

package hello.world;

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

public class Application {

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

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

        ExpirePaymentLinkResponse res = sdk.paymentLinks().expire()
                .paymentLinkId("a1b2c3d4-5678-90ab-cdef-1234567890ab")
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description Example
paymentLinkId String ✔️ The unique identifier for the payment link. a1b2c3d4-5678-90ab-cdef-1234567890ab
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

ExpirePaymentLinkResponse

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

Fetch the details for a payment link.

Example Usage

package hello.world;

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

public class Application {

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

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

        GetPaymentLinkResponse res = sdk.paymentLinks().get()
                .paymentLinkId("a1b2c3d4-5678-90ab-cdef-1234567890ab")
                .call();

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

Parameters

Parameter Type Required Description Example
paymentLinkId String ✔️ The unique identifier for the payment link. a1b2c3d4-5678-90ab-cdef-1234567890ab
merchantAccountId JsonNullable<String> The ID of the merchant account to use for this request.

Response

GetPaymentLinkResponse

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