balanceCheck
Gets the balance of a gift card.
It communicates with the balanceCheck endpoint of the Vue Storefront API Middleware. In turn, it calls the POST /paymentMethods/balance Adyen endpoint directly and returns received response.
Signature
export declare function balanceCheck(
props: BalanceCheckParams,
options?: MethodOptions
): Promise<import("@adyen/api-library/lib/src/typings/checkout/balanceCheckResponse").BalanceCheckResponse>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | BalanceCheckParams | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
options | Optional | MethodOptions | Options that can be passed to additionally configure the request or customize the logic in a plugin. |
Returns
Returns Promise<BalanceCheckResponse>
Referenced Types
- BalanceCheckParams
- MethodOptions
BalanceCheckResponse
Examples
Retrieves the balance remaining on a shopper's gift card. For full context, check the Alokai's documentation.
import { sdk } from '~/sdk.config.ts';
// ... Inside adyenConfiguration.giftcard property passed in object to the mountPaymentElement SDK method call
async onBalanceCheck(resolve, reject, data) {
balanceCheckResponse = await sdk.adyen.balanceCheck({
..data,
paymentId: getPaymentMethodsResponse.payment.id,
});
resolve(balanceCheckResponse);
},
// ...