BlinkDebitApiClient 1.0.1
See the version list below for details.
dotnet add package BlinkDebitApiClient --version 1.0.1
NuGet\Install-Package BlinkDebitApiClient -Version 1.0.1
<PackageReference Include="BlinkDebitApiClient" Version="1.0.1" />
paket add BlinkDebitApiClient --version 1.0.1
#r "nuget: BlinkDebitApiClient, 1.0.1"
// Install BlinkDebitApiClient as a Cake Addin #addin nuget:?package=BlinkDebitApiClient&version=1.0.1 // Install BlinkDebitApiClient as a Cake Tool #tool nuget:?package=BlinkDebitApiClient&version=1.0.1
Blink-Debit-API-Client-CSharp-DotNet
The Blink Debit API client for C# .NET.
APIs to execute Direct Credit payments for customers who use online banking with supported banks.
These APIs power Blink PayNow enabling one-off payments, and Blink AutoPay enabling recurring payments.
Request IDs Request IDs are included in the header in every response, to assist in tracing and debugging.
API Change Policy Additive changes may be made to request query parameters and JSON responses. To preserve backward compatibility, endpoint naming updates or JSON elements that already exist will not be removed or renamed until a major version (URL) change. This policy applies only after the official v1 release.
This C# SDK is automatically generated by the OpenAPI Generator project:
- API version: 1.0.19
- SDK version: 1.0.0
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen For more information, please visit https://www.blinkpay.co.nz/contact
<a id="frameworks-supported"></a>
Frameworks supported
<a id="dependencies"></a>
Dependencies
- RestSharp - 106.13.0 or later
- Json.NET - 13.0.2 or later
- JsonSubTypes - 1.8.0 or later
- System.ComponentModel.Annotations - 5.0.0 or later
The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.
<a id="installation"></a>
Installation
Run the following command to generate the DLL
- [Mac/Linux]
/bin/sh build.sh
- [Windows]
build.bat
Then include the DLL (under the bin
folder) in the C# project, and use the namespaces:
using BlinkDebitApiClient.Api;
using BlinkDebitApiClient.Client;
using BlinkDebitApiClient.Model.V1;
<a id="packaging"></a>
Packaging
A .nuspec
is included with the project. You can follow the Nuget quickstart to create and publish packages.
This .nuspec
uses placeholders from the .csproj
, so build the .csproj
directly:
nuget pack -Build -OutputDirectory out BlinkDebitApiClient.csproj
Then, publish to a local feed or other host and consume the new package via Nuget as usual.
<a id="usage"></a>
Usage
To use the API client with a HTTP proxy, setup a System.Net.WebProxy
Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;
<a id="getting-started"></a>
Getting Started
using System.Collections.Generic;
using System.Diagnostics;
using BlinkDebitApiClient.Api;
using BlinkDebitApiClient.Client;
using BlinkDebitApiClient.Model.V1;
namespace Example
{
public class Example
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://sandbox.debit.blinkpay.co.nz/payments/v1";
// Configure OAuth2 access token for authorization: Bearer
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new BankMetadataApi(config);
var requestId = 9f4cb72c-7563-4be5-b76f-1a4197fbad13; // Guid? | An optional request ID. If provided, it overrides the interaction ID generated by Blink Debit. (optional)
var xCorrelationId = f1e62d03-af1a-4c7b-aadb-d916adeb8d9d; // Guid? | An optional correlation ID for logging chain of events. If provided, it overrides the correlation ID generated by Blink Debit. (optional)
try
{
// Get Bank Metadata
List<BankMetadata> result = apiInstance.GetMeta(requestId, xCorrelationId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling BankMetadataApi.GetMeta: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
<a id="documentation-for-api-endpoints"></a>
Documentation for API Endpoints
All URIs are relative to https://sandbox.debit.blinkpay.co.nz/payments/v1
Class | Method | HTTP request | Description |
---|---|---|---|
BankMetadataApi | GetMeta | GET /meta | Get Bank Metadata |
EnduringConsentsApi | CreateEnduringConsent | POST /enduring-consents | Create Enduring Consent |
EnduringConsentsApi | GetEnduringConsent | GET /enduring-consents/{consent_id} | Get Enduring Consent |
EnduringConsentsApi | RevokeEnduringConsent | DELETE /enduring-consents/{consent_id} | Revoke Enduring Consent |
PaymentsApi | CreatePayment | POST /payments | Create Payment |
PaymentsApi | GetPayment | GET /payments/{payment_id} | Get Payment |
QuickPaymentsApi | CreateQuickPayment | POST /quick-payments | Create Quick Payment |
QuickPaymentsApi | GetQuickPayment | GET /quick-payments/{quick_payment_id} | Get Quick Payment |
QuickPaymentsApi | RevokeQuickPayment | DELETE /quick-payments/{quick_payment_id} | Revoke Quick Payment |
RefundsApi | CreateRefund | POST /refunds | Create Refund |
RefundsApi | GetRefund | GET /refunds/{refund_id} | Get Refund |
SingleConsentsApi | CreateSingleConsent | POST /single-consents | Create Single Consent |
SingleConsentsApi | GetSingleConsent | GET /single-consents/{consent_id} | Get Single Consent |
SingleConsentsApi | RevokeSingleConsent | DELETE /single-consents/{consent_id} | Revoke Single Consent |
<a id="documentation-for-models"></a>
Documentation for Models
- Model.Account
- Model.AccountNumberRefundRequest
- Model.Amount
- Model.AuthFlow
- Model.AuthFlowDetail
- Model.Bank
- Model.BankMetadata
- Model.BankMetadataFeatures
- Model.BankMetadataFeaturesDecoupledFlow
- Model.BankMetadataFeaturesDecoupledFlowAvailableIdentifiersInner
- Model.BankMetadataFeaturesEnduringConsent
- Model.BankMetadataRedirectFlow
- Model.Consent
- Model.ConsentDetail
- Model.CreateConsentResponse
- Model.CreateQuickPaymentResponse
- Model.DecoupledFlow
- Model.DecoupledFlowAllOf
- Model.DecoupledFlowHint
- Model.DecoupledFlowHintAllOf
- Model.DetailErrorResponseModel
- Model.EnduringConsentRequest
- Model.EnduringConsentRequestAllOf
- Model.EnduringPaymentRequest
- Model.FlowHint
- Model.FullRefundRequest
- Model.FullRefundRequestAllOf
- Model.GatewayFlow
- Model.GatewayFlowAllOf
- Model.GatewayFlowAllOfFlowHint
- Model.IdentifierType
- Model.PartialRefundRequest
- Model.PartialRefundRequestAllOf
- Model.Payment
- Model.PaymentRequest
- Model.PaymentResponse
- Model.Pcr
- Model.Period
- Model.QuickPaymentRequest
- Model.QuickPaymentResponse
- Model.RedirectFlow
- Model.RedirectFlowAllOf
- Model.RedirectFlowHint
- Model.Refund
- Model.RefundDetail
- Model.RefundRequest
- Model.RefundResponse
- Model.SingleConsentRequest
- Model.SingleConsentRequestAllOf
<a id="documentation-for-authorization"></a>
Documentation for Authorization
Authentication schemes defined for the API: <a id="Bearer"></a>
Bearer
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- create:single_consent: Create single consent requests
- view:single_consent: View single consent requests
- revoke:single_consent: Revoke a single payment consent, removing the ability to execute the payment
- create:enduring_consent: Create enduring consent requests
- view:enduring_consent: View enduring consent requests
- revoke:enduring_consent: Revoke an enduring payment consent, removing the ability to execute payments
- create:payment: Execute payment instructions with a consent
- view:payment: View the status of existing payments
- view:metadata: View bank metadata
- view:transaction: View transactions
- create:quick_payment: Create quick payments
- view:quick_payment: View quick payments
- create:refund: Create refunds
- view:refund: View refunds
Blink Debit API Client for Java
Table of Contents
- Minimum Requirements
- Dependency
- Quick Start
- Configuration
- Client Creation
- Correlation ID
- Full Examples
- Individual API Call Examples
This SDK allows merchants with Java-based e-commerce site to integrate with Blink PayNow and Blink AutoPay.
This SDK internally uses WebClient, a reactive web client introduced in Spring Framework 5, for making API calls.
Minimum Requirements
- Maven 3 or Gradle 7
- Java 8 or higher
- Lombok 1.18 (for development only)
Adding the dependency
For:
- Java 8 or higher using plain java
- or with Spring versions less than 6 (i.e. including Spring Boot 2)
use
blink-debit-api-client-java
Maven
<dependency>
<groupId>nz.co.blinkpay</groupId>
<artifactId>blink-debit-api-client-java</artifactId>
<version>${version}</version>
</dependency>
For Spring 6 (i.e. including Spring Boot 3), use blink-debit-api-client-java-spring6
<dependency>
<groupId>nz.co.blinkpay</groupId>
<artifactId>blink-debit-api-client-java-spring6</artifactId>
<version>${version}</version>
</dependency>
Gradle
implementation "nz.co.blinkpay:blink-debit-api-client-java:$version"
implementation "nz.co.blinkpay:blink-debit-api-client-java-spring6:$version"
Quick Start
String blinkpayUrl = "https://sandbox.debit.blinkpay.co.nz";
String clientId = "...";
String clientSecret = "...";
String profile = "local";
BlinkDebitClient client = new BlinkDebitClient(blinkpayUrl, clientId, clientSecret, profile);
QuickPaymentRequest request = (QuickPaymentRequest) new QuickPaymentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri("https://www.blinkpay.co.nz/sample-merchant-return-page")))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total("0.01"))
.pcr(new Pcr()
.particulars("particulars")
.code("code")
.reference("reference"));
CreateQuickPaymentResponse qpCreateResponse = client.createQuickPayment(request);
logger.info("Redirect URL: {}", qpCreateResponse.getRedirectUri()); // Redirect the consumer to this URL
UUID qpId = qpCreateResponse.getQuickPaymentId();
QuickPaymentResponse qpResponse = client.awaitSuccessfulQuickPaymentOrThrowException(qpId, 300); // Will throw an exception if the payment was not successful after 5min
Configuration
- Customise/supply the required properties in your
blinkdebit.yaml
orblinkdebit.properties
. This file should be available in your classpath, i.e. normally placed insrc/main/resources
. - The BlinkPay Sandbox debit URL is
https://sandbox.debit.blinkpay.co.nz
and the production debit URL ishttps://debit.blinkpay.co.nz
. - The client credentials will be provided to you by BlinkPay as part of your on-boarding process.
- Properties can be supplied using environment variables.
Warning Take care not to check in your client ID and secret to your source control.
Property precedence
Properties will be detected and loaded according to the heirarcy -
- As provided directly to client constructor
- Environment variables e.g.
export BLINKPAY_CLIENT_SECRET=...
- System properties e.g.
-Dblinkpay.client.secret=...
blinkdebit.properties
blinkdebit.yaml
- Default values
Property set-up examples
Environment variables
export BLINKPAY_DEBIT_URL=<BLINKPAY_DEBIT_URL>
export BLINKPAY_CLIENT_ID=<BLINKPAY_CLIENT_ID>
export BLINKPAY_CLIENT_SECRET=<BLINKPAY_CLIENT_SECRET>
# for non-Spring consumer as an alternative to spring.profiles.active property. Debugging profiles are local, dev or test. Any other value will behave in a production-like manner.
export BLINKPAY_ACTIVE_PROFILE=test
# Optional configuration values below
export BLINKPAY_MAX_CONNECTIONS=10
export BLINKPAY_MAX_IDLE_TIME=PT20S
export BLINKPAY_MAX_LIFE_TIME=PT60S
export BLINKPAY_PENDING_ACQUIRE_timeout=PT10S
export BLINKPAY_EVICTION_INTERVAL=PT60S
export BLINKPAY_RETRY_ENABLED=true
Properties file
Substitute the correct values to your blinkdebit.properties
file.
blinkpay.debit.url=<BLINKPAY_DEBIT_URL>
blinkpay.client.id=<BLINKPAY_CLIENT_ID>
blinkpay.client.secret=<BLINKPAY_CLIENT_SECRET>
# for non-Spring consumer as an alternative to spring.profiles.active property. Debugging profiles are local, dev or test. Any other value will behave in a production-like manner.
blinkpay.active.profile=test
# Optional configuration values below
blinkpay.max.connections=10
blinkpay.max.idle.time=PT20S
blinkpay.max.life.time=PT60S
blinkpay.pending.acquire.timeout=PT10S
blinkpay.eviction.interval=PT60S
blinkpay.retry.enabled=true
Properties file - Spring
The property placeholders below will only work for Spring consumers by substituting the corresponding environment variables.
blinkpay.debit.url=${BLINKPAY_DEBIT_URL}
blinkpay.client.id=${BLINKPAY_CLIENT_ID}
blinkpay.client.secret=${BLINKPAY_CLIENT_SECRET}
# for non-Spring consumer as an alternative to spring.profiles.active property. Debugging profiles are local, dev or test. Any other value will behave in a production-like manner.
blinkpay.active.profile=${BLINKPAY_ACTIVE_PROFILE:test}
# Optional configuration values below
blinkpay.max.connections=${BLINKPAY_MAX_CONNECTIONS:10}
blinkpay.max.idle.time=${BLINKPAY_MAX_IDLE_TIME:PT20S}
blinkpay.max.life.time=${BLINKPAY_MAX_LIFE_TIME:PT60S}
blinkpay.pending.acquire.timeout=${BLINKPAY_PENDING_ACQUIRE_TIMEOUT:PT10S}
blinkpay.eviction.interval=${BLINKPAY_EVICTION_INTERVAL:PT60S}
blinkpay.retry.enabled=${BLINKPAY_RETRY_ENABLED:true}
YAML properties file - Spring
The property placeholders below will only work for Spring consumers by substituting the corresponding environment variables.
blinkpay:
debit:
url: ${BLINKPAY_DEBIT_URL}
client:
id: ${BLINKPAY_CLIENT_ID}
secret: ${BLINKPAY_CLIENT_SECRET}
# Optional configuration values below
max:
connections: ${BLINKPAY_MAX_CONNECTIONS:10}
idle:
time: ${BLINKPAY_MAX_IDLE_TIME:PT20S}
life:
time: ${BLINKPAY_MAX_LIFE_TIME:PT60S}
pending:
acquire:
timeout: ${BLINKPAY_PENDING_ACQUIRE_TIMEOUT:PT10S}
eviction:
interval: ${BLINKPAY_EVICTION_INTERVAL:PT60S}
retry:
enabled: ${BLINKPAY_RETRY_ENABLED:true}
Client creation
Java
Plain Java client code can use the no-arg constructor which will attempt to populate the properties according to the hierarchy above.
BlinkDebitClient client = new BlinkDebitClient();
Another way is to supply the required properties on object creation:
BlinkDebitClient client = new BlinkDebitClient(blinkpayUrl, clientId, clientSecret, "production");
Spring
Spring-based client code can simply autowire/inject the API client when properties are supplied as above.
@Autowired
BlinkDebitClient client;
Correlation ID
An optional correlation ID can be added as the last argument to API calls. This is also the idempotency key for Blink API calls.
It will be generated for you automatically if it is not provided.
Full Examples
Quick payment (one-off payment), using Gateway flow
A quick payment is a one-off payment that combines the API calls needed for both the consent and the payment.
QuickPaymentRequest request = (QuickPaymentRequest) new QuickPaymentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri("https://www.blinkpay.co.nz/sample-merchant-return-page")))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total("0.01"))
.pcr(new Pcr()
.particulars("particulars")
.code("code")
.reference("reference"));
CreateQuickPaymentResponse qpCreateResponse = client.createQuickPayment(request);
logger.info("Redirect URL: {}", qpCreateResponse.getRedirectUri()); // Redirect the consumer to this URL
UUID qpId = qpCreateResponse.getQuickPaymentId();
QuickPaymentResponse qpResponse = client.awaitSuccessfulQuickPaymentOrThrowException(qpId, 300); // Will throw an exception if the payment was not successful after 5min
Single consent followed by one-off payment, using Gateway flow
SingleConsentRequest consent = new SingleConsentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri("https://www.blinkpay.co.nz/sample-merchant-return-page")
.flowHint(new RedirectFlowHint()
.bank(Bank.BNZ)))) // Optional, bank will be preselected
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total("0.01"))
.pcr(new Pcr()
.particulars("particulars"));
CreateConsentResponse createConsentResponse = client.createSingleConsent(consent);
String redirectUri = createConsentResponse.getRedirectUri(); // Redirect the consumer to this URL
PaymentRequest payment = new PaymentRequest().consentId(createConsentResponse.getConsentId());
PaymentResponse paymentResponse = client.createPayment(payment);
logger.info("Payment Status: {}", client.getPayment(paymentResponse.getPaymentId()).getStatus());
// TODO inspect the payment result status
Individual API Call Examples
Bank Metadata
Supplies the supported banks and supported flows on your account.
List<BankMetadata> bankMetadataList = client.getMeta();
Quick Payments
Gateway Flow
QuickPaymentRequest request = (QuickPaymentRequest) new QuickPaymentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateQuickPaymentResponse createQuickPaymentResponse = client.createQuickPayment(request);
Gateway Flow - Redirect Flow Hint
QuickPaymentRequest request = (QuickPaymentRequest) new QuickPaymentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)
.flowHint(new RedirectFlowHint()
.bank(bank))))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateQuickPaymentResponse createQuickPaymentResponse = client.createQuickPayment(request);
Gateway Flow - Decoupled Flow Hint
QuickPaymentRequest request = (QuickPaymentRequest) new QuickPaymentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)
.flowHint(new DecoupledFlowHint()
.identifierType(identifierType)
.identifierValue(identifierValue)
.bank(bank))))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateQuickPaymentResponse createQuickPaymentResponse = client.createQuickPayment(request);
Redirect Flow
QuickPaymentRequest request = (QuickPaymentRequest) new QuickPaymentRequest()
.flow(new AuthFlow()
.detail(new RedirectFlow()
.bank(bank)
.redirectUri(redirectUri)))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateQuickPaymentResponse createQuickPaymentResponse = client.createQuickPayment(request);
Decoupled Flow
QuickPaymentRequest request = (QuickPaymentRequest) new QuickPaymentRequest()
.flow(new AuthFlow()
.detail(new RedirectFlow()
.bank(bank)
.identifierType(identifierType)
.identifierValue(identifierValue)
.callbackUrl(callbackUrl)))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateQuickPaymentResponse createQuickPaymentResponse = client.createQuickPayment(request);
Retrieval
QuickPaymentResponse quickPaymentResponse = client.getQuickPayment(quickPaymentId);
Revocation
client.revokeQuickPayment(quickPaymentId);
Single/One-Off Consents
Gateway Flow
SingleConsentRequest request = new SingleConsentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateConsentResponse createConsentResponse = client.createSingleConsent(request);
Gateway Flow - Redirect Flow Hint
SingleConsentRequest request = new SingleConsentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)
.flowHint(new RedirectFlowHint()
.bank(bank))))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateConsentResponse createConsentResponse = client.createSingleConsent(request);
Gateway Flow - Decoupled Flow Hint
SingleConsentRequest request = new SingleConsentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)
.flowHint(new DecoupledFlowHint()
.identifierType(identifierType)
.identifierValue(identifierValue)
.bank(bank))))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateConsentResponse createConsentResponse = client.createSingleConsent(request);
Redirect Flow
Suitable for most consents.
SingleConsentRequest request = new SingleConsentRequest()
.flow(new AuthFlow()
.detail(new RedirectFlow()
.bank(bank)
.redirectUri(redirectUri)))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateConsentResponse createConsentResponse = client.createSingleConsent(request);
Decoupled Flow
This flow type allows better support for mobile by allowing the supply of a mobile number or previous consent ID to identify the customer with their bank.
The customer will receive the consent request directly to their online banking app. This flow does not send the user through a web redirect flow.
SingleConsentRequest request = new SingleConsentRequest()
.flow(new AuthFlow()
.detail(new DecoupledFlow()
.bank(bank)
.identifierType(identifierType)
.identifierValue(identifierValue)
.callbackUrl(callbackUrl)))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference));
CreateConsentResponse createConsentResponse = client.createSingleConsent(request);
Retrieval
Get the consent including its status
Consent consent = client.getSingleConsent(consentId);
Revocation
client.revokeSingleConsent(consentId);
Blink AutoPay - Enduring/Recurring Consents
Request an ongoing authorisation from the customer to debit their account on a recurring basis.
Note that such an authorisation can be revoked by the customer in their mobile banking app.
Gateway Flow
EnduringConsentRequest request = new EnduringConsentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)))
.maximumAmountPeriod(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.period(period)
.fromTimestamp(startDate)
.expiryTimestamp(endDate);
CreateConsentResponse createConsentResponse = client.createEnduringConsent(request);
Gateway Flow - Redirect Flow Hint
EnduringConsentRequest request = new EnduringConsentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)
.flowHint(new RedirectFlowHint()
.bank(bank))))
.maximumAmountPeriod(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.period(period)
.fromTimestamp(startDate)
.expiryTimestamp(endDate);
CreateConsentResponse createConsentResponse = client.createEnduringConsent(request);
Gateway Flow - Decoupled Flow Hint
EnduringConsentRequest request = new EnduringConsentRequest()
.flow(new AuthFlow()
.detail(new GatewayFlow()
.redirectUri(redirectUri)
.flowHint(new DecoupledFlowHint()
.identifierType(identifierType)
.identifierValue(identifierValue)
.bank(bank))))
.maximumAmountPeriod(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.period(period)
.fromTimestamp(startDate)
.expiryTimestamp(endDate);
CreateConsentResponse createConsentResponse = client.createEnduringConsent(request);
Redirect Flow
EnduringConsentRequest request = new EnduringConsentRequest()
.flow(new AuthFlow()
.detail(new RedirectFlow()
.bank(bank)
.redirectUri(redirectUri)))
.maximumAmountPeriod(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.period(period)
.fromTimestamp(startDate)
.expiryTimestamp(endDate);
CreateConsentResponse createConsentResponse = client.createEnduringConsent(request);
Decoupled Flow
EnduringConsentRequest request = new EnduringConsentRequest()
.flow(new AuthFlow()
.detail(new DecoupledFlow()
.bank(bank)
.identifierType(identifierType)
.identifierValue(identifierValue)
.callbackUrl(callbackUrl)))
.maximumAmountPeriod(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.period(period)
.fromTimestamp(startDate)
.expiryTimestamp(endDate);
CreateConsentResponse createConsentResponse = client.createEnduringConsent(request);
Retrieval
Consent consent = client.getEnduringConsent(consentId);
Revocation
client.revokeEnduringConsent(consentId);
Payments
The completion of a payment requires a consent to be in the Authorised status.
Single/One-Off
PaymentRequest request = new PaymentRequest()
.consentId(consentId);
PaymentResponse paymentResponse = client.createPayment(request);
Enduring/Recurring
If you already have an approved consent, you can run a Payment against that consent at the frequency as authorised in the consent.
PaymentRequest request = new PaymentRequest()
.consentId(consentId)
.enduringPayment(new EnduringPaymentRequest()
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference)));
PaymentResponse paymentResponse = client.createPayment(request);
Westpac
Westpac requires you to specify which account of the customers to debit.
The available selection of accounts is supplied to you in the consent response of an Authorised Westpac consent object, and the ID of the selected account in supplied here.
PaymentRequest request = new PaymentRequest()
.consentId(consentId)
.accountReferenceId(accountReferenceId);
PaymentResponse paymentResponse = client.createWestpacPayment(request);
Retrieval
Payment payment = client.getPayment(paymentId);
Refunds
Account Number Refund
AccountNumberRefundRequest request = (AccountNumberRefundRequest) new AccountNumberRefundRequest()
.paymentId(paymentId);
RefundResponse refundResponse = client.createRefund(request);
Full Refund (Not yet implemented)
FullRefundRequest request = (FullRefundRequest) new FullRefundRequest()
.consentRedirect(redirectUri)
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference))
.paymentId(paymentId);
RefundResponse refundResponse = client.createRefund(request);
Partial Refund (Not yet implemented)
PartialRefundRequest request = (PartialRefundRequest) new PartialRefundRequest()
.consentRedirect(redirectUri)
.pcr(new Pcr()
.particulars(particulars)
.code(code)
.reference(reference))
.amount(new Amount()
.currency(Amount.CurrencyEnum.NZD)
.total(total))
.paymentId(paymentId);
RefundResponse refundResponse = client.createRefund(request);
Retrieval
Refund refund = client.getRefund(refundId);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- JsonSubTypes (>= 2.0.1)
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 7.0.4)
- Microsoft.Extensions.Configuration.FileExtensions (>= 7.0.0)
- Microsoft.Extensions.Configuration.Json (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Newtonsoft.Json (>= 13.0.3)
- Polly (>= 7.2.3)
- Polly.Contrib.WaitAndRetry (>= 1.1.1)
- RestSharp (>= 110.2.0)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.IdentityModel.Tokens.Jwt (>= 6.31.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.