SDK creating payments

For creating payments you can use the following methods:

BrouwerVosSDK.getInstance().createPayment(Context context, double amount, Payment.Currency currency, String description, @Nullable JSONObject metadata, @Nullable PaymentCallback callback)
BrouwerVosSDK.getInstance().createPayment(Context context, Payment payment, @Nullable PaymentCallback callback);
BrouwerVosSDK.getInstance().createPayment(Context context, String paymentId, @Nullable PaymentCallback callback);

Note: that the context mentioned must be able to start a activity.

Depending on your use case, you might want to first create the payment in our backend, before you actually initialise the payment on the payment device.

The following code snippet will make a payment using the SDK:

BrouwerVosSDK.getInstance().createPayment(getApplicationContext(), 10.5, Payment.Currency.EUR, "test description", null, new BrouwerVosSDK.PaymentCallback() {
    @Override
    public void onResult(Payment payment) {
        // Payment has been completed
    }

    @Override
    public void onError(@Nullable Payment payment, Exception e) {
        // Payment has not been completed due to a error.
    }
});

Once the payment has been successfully completed the onResult function will be called with the final payment, and with the state = PaymentState.success.

Last updated